我在窗体创建的时候给组件的索引赋值,但是我显示这些索引的值的时候,却不是我事先赋的值,这是怎么回事啊?procedure TForm1.FormCreate(Sender: TObject);
begin
BitBtn1.ComponentIndex := 18;
BitBtn2.ComponentIndex := 19;
BitBtn3.ComponentIndex := 2;
BitBtn4.ComponentIndex := 17;
BitBtn5.ComponentIndex := 20;
end;procedure TForm1.Button1Click(Sender: TObject);
var
i :integer;
begin
for i:=0 to ComponentCount-1 do
if (Components[i] is TBitBtn ) then
showmessage(Components[i].Name+'的ComponentIndex是:'+
inttostr(Components[i].ComponentIndex));
end;
begin
BitBtn1.ComponentIndex := 18;
BitBtn2.ComponentIndex := 19;
BitBtn3.ComponentIndex := 2;
BitBtn4.ComponentIndex := 17;
BitBtn5.ComponentIndex := 20;
end;procedure TForm1.Button1Click(Sender: TObject);
var
i :integer;
begin
for i:=0 to ComponentCount-1 do
if (Components[i] is TBitBtn ) then
showmessage(Components[i].Name+'的ComponentIndex是:'+
inttostr(Components[i].ComponentIndex));
end;
解决方案 »
- 急求!错误“SQL语句之后缺少分号(;)。”
- 什么行为导致卡巴 误报 Worm.P2P.generic
- 谁给这段C玩意用Delphi翻译一下,关于剪贴板操作的,很有用!
- 各位大哥大姐些,小妹请教个关于clientdataset的问题
- 如何把剪贴板里的BMP图片保存到JPEG对象里
- 如何将PDF的电子图书分割?
- 请问各位,我用ADO写的c/s程序可以在正常的局域网内运行,现在想把她拿到无盘工作站上,服务器是2000,能不能在各个客户端正常运行呀??
- 两台机器同时上宽带网,用程序是如何通讯的?(IP地址都不是固定的)
- 初学Delphi,请高手指点!MDI程序问题!
- ADO 的Bug?
- 字符串问题(大富翁没人理):#$19#$C==>'#$19#$C'
- 如何用Delphi6实现对计算机的远程控制
procedure TForm1.FormCreate(Sender: TObject);
begin
BitBtn1.ComponentIndex := 18;
BitBtn2.ComponentIndex := 19;
BitBtn3.ComponentIndex := 2;
BitBtn4.ComponentIndex := 17;
BitBtn5.ComponentIndex := 20; BitBtn1.ComponentIndex := 18;
BitBtn2.ComponentIndex := 19;
BitBtn3.ComponentIndex := 2;
BitBtn4.ComponentIndex := 17;
BitBtn5.ComponentIndex := 20;
end;
你的方法是成功了,但我不明白为什么,能说说是什么原因吗
就是說如下連續兩次付值比較好!!
BitBtn3.ComponentIndex := 2;
BitBtn4.ComponentIndex := 17;
BitBtn1.ComponentIndex := 18;
BitBtn2.ComponentIndex := 19;
BitBtn5.ComponentIndex := 20;
为什么要写两次啊,为什么要大于20个控件啊??
the second has a value of 1, and so on.赋值无效
那请问有没有解决方法啊
改變, 如改到20, 會引致原來位置的那個 ComponentIndex = 20 自動尋找一個新的有效的值,測試中, 原位置的并不是自動退到最後一位, 而且, 系統保證排在它後面的控件還是排在它後面, 所以, 可能就會引起一串控件改變ComponentIndex, 就會再次引起 ComponentIndex 的變化, 但第二次, 由于你設置的位置已經相對比較接近了! 所以, 影響到的重排列的控件就不是那麼多, 就成功了!!