请问:怎样在窗体加载时创建9百9十9万9千9百9十9个(9999999)个CheckBox控件并显示出来。
用代码创建。
我做了一个
运行了半个多小时那个窗体都还没有显示出来。
有谁有更好的跟快的解决办法吗?
大哥大姐们帮忙呀!谢谢!
用代码创建。
我做了一个
运行了半个多小时那个窗体都还没有显示出来。
有谁有更好的跟快的解决办法吗?
大哥大姐们帮忙呀!谢谢!
调试欢乐多
9987
9988
未处理的“System.ComponentModel.Win32Exception”类型的异常出现在 system.windows.forms.dll 中其他信息:创建窗口句柄时出错。
--------------------------
Determines whether the list box is standard or owner-draw and whether it is virtual.type TListBoxStyle = (lbStandard, lbOwnerDrawFixed, lbOwnerDrawVariable, lbVirtual, lbVirtualOwnerDraw);
property Style: TListBoxStyle;DescriptionUse Style to specify whether the list box is a standard list box that displays text strings, or an owner-draw list box that can display graphical images. Owner-draw list boxes let you display items in some nonstandard way. In this case, you must write the code to paint items in the list box. In addition, Style controls whether the list box is virtual, which means that items are supplied dynamically using event handlers. By default, Style is lbStandard, meaning that the list box is not virtual and it displays each item as a string.
---------------------------
lbVirtual The list box is virtual, but all items are strings with the same height. You must indicate the number of items in the list box by setting the Count property. You must supply the items in the list box using an OnData event handler. If the items have associated objects, you must supply them using an OnDataObject event handler. In addition, you must supply an OnDataFind event handler to provide the mapping from the strings in the list box to their indexes.可见,TCheckListBox可以实现你所说的功能。将style设为lbVirtual,然后分别在OnDataObject、OnData、OnDataFind里写相应代码。这些列表项目不是直接添加到列表里去的,而是在需要显示的时候指定数据。这个速度很快的,可以处理数据量很大的情况。
var
MyCheckBoxs:array of TCheckBox; //全局变量........
........procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
setlength(MyCheckBoxs,9999999);
for i:=low(MyCheckBoxs) to high(MyCheckBoxs) do begin
MyCheckBoxs[i]:=TCheckBox.Create(Self);
MyCheckBoxs[i].Parent:=Self;
MyCheckBoxs[i].Caption:=Inttostr(i);
MyCheckBoxs[i].Left:=5;
MyCheckBoxs[i].Width:=30;
MyCheckBoxs[i].Top:=15*i;
MyCheckBoxs[i].Visible:=true;
end;
showmessage('ok')
end;
本回复由大傻的破玩意儿【CSDN's forum Explorer】完成!
软件功能强大,速度超快!!支持中...
软件下载地址:http://CoolSlob.ys168.com
这几个OnDataObject、OnData、OnDataFind事件怎么用!
我看了帮助没有看明白
还有批发CheckBox控件的
好家伙