Timdong大虾的10分是历史上最值的10分。
以下我本人的一个程序单元,其中的第一个函数就是。对所有的TWinContrl继承类
有特效,使用时:
xSetReDraw(ListView.Handle, false);
try
With Listview
Clear all item;
For
Add Item;
Next
...
finally
xSetReDraw(Listview.handle, true);
end;
unit xCtrlFunc;
interface
uses
windows, Messages, Classes, controls, stdctrls;
procedure xSetReDraw(Handle:integer; CanReDraw : Boolean);
procedure xSetAllEmpty(Comp : TWinControl);
implementation
//uses windows;
procedure xSetReDraw(Handle:integer; CanReDraw : Boolean);
begin
SendMessage(Handle, WM_SETREDRAW, integer(CanReDraw), 0);
end;
procedure xSetAllEmpty(Comp : TWinControl);
var n, k : integer;
begin
k := Comp.ControlCount;
for n:=0 to k-1 do begin
if Comp.Controls[n] is TCustomEdit then
(Comp.Controls[n] as TCustomEdit).Text := ''
else if Comp.Controls[n] is TComboBox then
(Comp.Controls[n] as TComboBox).Text := ''
else if Comp.Controls[n] is TCheckBox then
(Comp.Controls[n] as TCheckBox).Checked := false;
end;
end;
end.