困扰了我2天,查出错误了,但是不知道为什么,也没办法解决 ,求大神们指点一二
解决方案 »
- 动态数组的问题
- 菜鸟问题,来者有分
- 热烈庆祝唐山新维软件开发有限公司成立2周年
- delphi与Oracle连接问题,急!
- ActiveForm Dynamic Package Ocx
- 根据我这样的要求,我该选择Delphi7里哪种类型的COM(100分)
- IXMLDocument内存泄漏的问题
- 请问OfficeXP(WindowsXP)中的特别美的菜单是用什么控件作的,如果有,哪可一下载的到?请告知。
- NetMessageBufferSend 这个API怎么用,给我一个DELPHI的例子.(70分相送)
- D2006,使用indy发https请求,并支持TLS1.2 ,卡壳了。。。。。
- 利用TUniQuery、TUniConnection写库出错
- 如何判断 字符串中 包含有 unicode 字符
Delphi7下,窗体文件:
object Form1: TForm1
Left = 192
Top = 114
Width = 870
Height = 640
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object pgc1: TPageControl
Left = 0
Top = 0
Width = 862
Height = 606
ActivePage = ts3
Align = alClient
TabOrder = 0
object ts1: TTabSheet
Caption = 'ts1'
end
object ts2: TTabSheet
Caption = 'ts2'
ImageIndex = 1
end
object ts3: TTabSheet
Caption = 'ts3'
ImageIndex = 2
end
end
end
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ComCtrls;type
TForm1 = class(TForm)
pgc1: TPageControl;
ts1: TTabSheet;
ts2: TTabSheet;
ts3: TTabSheet;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
Self.BorderIcons :=[biSystemMenu,biMinimize] ;
pgc1.Pages[1].TabVisible :=False;
end;end.
program Project1;uses
Forms,
Unit1 in 'Unit1.pas' {Form1};{$R *.res}begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
list index out of bounds(3)意思是我下标超了但是我不知道为什么.
object ts2: TTabSheet
Caption = 'ts2'
ImageIndex = 1
end
object ts3: TTabSheet
Caption = 'ts3'
ImageIndex = 2
end你的TTabSheet中ImageIndex 有值
但是没看到有TImageList控件, 应该是这个问题
问题关键是在以下两句:
Self.BorderIcons :=[biSystemMenu,biMinimize] ;
pgc1.Pages[1].TabVisible :=False;
如果这两句放在其他事件里,错误就会消失;
如果BorderIcons不用语句控制,而提前在属性里设置,错误也会消失。
第一句去掉,错误也会消失。
pgc1.Pages[1]用Ts2来代替,错误依旧。
问题应该就是出在了窗体的构造函数中,谁能帮解析下,在程序结构不变的基础上提出解决办法最好。
pgc1.Pages[1].TabVisible :=False;
Self.BorderIcons :=[biSystemMenu,biMinimize] ;想来是更改Self.BorderIcons属性导致窗体暂时不可见了。
加入一个语句也没有问题。
Self.BorderIcons :=[biSystemMenu,biMinimize] ;
self.Visible:=true;
self.pgc1.Pages[1].TabVisible :=False;
只能说窗体不可见的时候,无法对其拥有的控件进行操作,只是BorderIcons的改变居然会引起窗体在Create过程中暂时不可见,这个要从构造函数理解起,我会继续查一查原因,或者再盼望哪位大哥再指点1,2。3天后结帖,谢谢大家。