各位,帮帮忙吧,近来给讲讲这些语句是什么意识????????????????
代码没有写全!
//定义类
type
TWindowInfo = class
WindowsName,
WindowsClass: String;
end;
//在函数中用到:
procedure TMainform.ListBox1DrawItem(.....);
begin
....
with TWindowInfo(ListBox1.Items.Objects[Index]) do
beign
DrawText(ListBox1.Canvas.Handle, Pchar(WindowsName),
Length(WindowsName), Rect, dt_Left or dt_VCenter);
Rect.Left:=Rect.Left+HeaderControl1.Sections[0].Width;
DrawText(ListBox1.Canvas.Handle, Pchar(WindowsClass),
Length(WindowsClass), Rect, dt_Left or dt_VCenter);
end;
end;
//Index,Rect是过程Listbox1DrawItem所带参数
请问:
TWindowInfo(ListBox1.Items.Objects[Index]) 是什么意识,是构造函数吗?
还有:
DrawText(ListBox1.Canvas.Handle, Pchar(WindowsName),
Length(WindowsName), Rect, dt_Left or dt_VCenter);
是干什么的,里面的参数是干什么的??????????
谢谢
问题点数:50、回复次数:4Top
1 楼qrlvls( 空 气 )回复于 2002-03-11 12:40:56 得分 15
DrawText里的参数分别是:
ListBox1.Canvas.Handle: 窗口句柄
Pchar(WindowsName): 要写的字符串
Length(WindowsName): 字符串长度
Rect: 位置
dt_Left or dt_VCenter: 对齐方式Top
2 楼milpas(我带着我的影子去流浪)回复于 2002-03-11 12:41:19 得分 10
应该是ListBox1.Items中插入了TWindowInfo类的对象,所以要对这个对象操作就要用TWindowInfo来声明一下Top
3 楼BlackPoint(黑点)回复于 2002-03-11 12:42:45 得分 15
TWindowInfo(ListBox1.Items.Objects[Index]) 是把ListBox1.Items.Objects[Index]所存储的对象强制转化为TWindowInfo类型
DrawText是API函数,用于在ListBox1.Canvas上显示文本,至于参数可以在Delphi 的帮助里找到。Top
4 楼taber(李沉舟)回复于 2002-03-11 12:45:11 得分 10
1
TWindowInfo(ListBox1.Items.Objects[Index]) 表示将ListBox1中指定的对象转化为TWindowInfo类型的。
2
DrawText是一个Windows的API,用来在指定设备上画出指定文本内容,这一句是将ListBox1中第Index项的名称显示在Rect区域,文本左对齐或中央对齐。Top




