您的位置:逆风者 VC++ 正文
 添加时间:2007-09-01 原文发表:2007-08-31 人气:32 来源:vckbase.com

本文章共4978字,分3页,当前第2页,快速翻页:
 
此接口我们使用m_piResponse->BinaryWrite(vReturnBuffer);将读入内存的图像数据转发给用户浏览器。另外,为了灵活地改变图像字体,大小,字符集及图像长宽等,我们要为组件添加以下属性。
STDMETHOD(get_bAutoHeighten)(/*[out, retval]*/ BOOL *pVal);

STDMETHOD(put_bAutoHeighten)(/*[in]*/ BOOL newVal);

STDMETHOD(get_l3D)(/*[out, retval]*/ long *pVal);

STDMETHOD(put_l3D)(/*[in]*/ long newVal);

STDMETHOD(get_lWeight)(/*[out, retval]*/ long *pVal);

STDMETHOD(put_lWeight)(/*[in]*/ long newVal);

STDMETHOD(get_lTop)(/*[out, retval]*/ long *pVal);

STDMETHOD(put_lTop)(/*[in]*/ long newVal);

STDMETHOD(get_lLeft)(/*[out, retval]*/ long *pVal);

STDMETHOD(put_lLeft)(/*[in]*/ long newVal);

STDMETHOD(get_lCSet)(/*[out, retval]*/ long *pVal);

STDMETHOD(put_lCSet)(/*[in]*/ long newVal);

STDMETHOD(put_bstrBgImg)(/*[in]*/ BSTR newVal);

STDMETHOD(put_bstrFilePath)(/*[in]*/ BSTR newVal);

STDMETHOD(put_bstrFont)(/*[in]*/ BSTR newVal);

STDMETHOD(put_bstrText)(/*[in]*/ BSTR newVal);

STDMETHOD(get_llfHeight)(/*[out, retval]*/ long *pVal);

STDMETHOD(put_llfHeight)(/*[in]*/ long newVal);

STDMETHOD(get_lHeight)(/*[out, retval]*/ long *pVal);

STDMETHOD(put_lHeight)(/*[in]*/ long newVal);

STDMETHOD(get_lWidth)(/*[out, retval]*/ long *pVal);

STDMETHOD(put_lWidth)(/*[in]*/ long newVal);
分别实现自定义图象长,宽,字体大小,字体名称等属性。如:设置图像文本

STDMETHODIMP CAspImage::put_bstrText(BSTR newVal)

{

	bstrText = newVal;

	return S_OK;

}		
设置图像高度

STDMETHODIMP CAspImage::put_lHeight(long newVal)

{

	lHeight = newVal;

	return S_OK;

}		
四、ASP程序使用此组件输出图像到用户浏览器,在使用之前首先在服务器上注册此组件,方法:
  1. 拷贝XTAspImage.dll 到系统目录,一般为C:\WINNT\SYSTEM32
  2. 运行-> regsvr32 XTAspImage.dll

逆风编程精品
如果安装成功,会有成功提示。此过程只使用一次。下面是在asp里调用方法:

1. <!--#include file="Config/Function.asp"-->
2. <!--#include file="Config/SiteInfo.asp"-->
3. <!--#include file="Config/DbConn.asp"-->

4. <%
a) Dim TeachID, PageTextLen, Page, SumPage, BodyLen, \
  TemplateBody, Width, Height, FHeight, sEndStr
b) TeachID = INT(Request("TeachID"))
c) PageTextLen = INT(Request("PageTextLen"))

d) IF PageTextLen <= 0 THEN
i. PageTextLen = 300
e) END IF

f) Page = INT(Request("Page"))

g) Set Rs = Server.CreateObject("ADODB.Recordset")
h) Sql="select * from Article where id=" & TeachID
i) Rs.open sql,conn,1,1

j) IF NOT Rs.EOF THEN
i. TeachingBody = Rs("Content") & constEndStr
k) ELSE
i. Response.Write("记录不存在")
ii. Rs.Close
iii. Set Rs = Nothing
iv. Conn.Close
v. Set Conn = Nothing
vi. Response.End
l) END IF

m) BodyLen = len(TeachingBody)

n) SumPage = GetMaxPageNum(BodyLen, PageTextLen)

o) Dim sPageText

p) IF Page >= SumPage THEN
i. Page = SumPage
 

本文章更多内容<<上一页 - 1 - 2 - 3 - 下一页>>
相关文章

从 ADO 迁移到 ADO.NET(一)
获得 Win32 窗口句柄的更好的方法
关于 IDispatch 接口的 LPDispatch 属性的实
用ATL开发复合控件
后缀表达式求值及校验
浅谈PDFlib中文输出(四)PDFlib 接收的几种
事件编程(二)
用鼠标手势动作来发送命令
在VC中使用 Flash 美化你的程序
更改屏幕显示数据的作弊程序
可设置单元格颜色的ClistCtrl类
IP Messenger 详细分析
C :使用 Visual C 2005 的现代语言特色
毫秒定时器
类似于FlashGet的悬浮框的制作
不重起Windows直接更改IP地址
MFC程序员的WTL指南: 中文版序言
COM 组件设计与应用(五)——用 ATL 写第一
编写多文档应用程序
PhotoShop插件开发之选区(Selection)

相关评论


本文章所属分类:首页 VC++

  热门关键字: