j: Variable 'j' inaccessible here due to optimization为什么呢?
还有
i :=0;
while (i < gCol) do
begin
arrX[i] := TPanel.Create(Panel1);
arrX[i].Parent := Panel1;
arrX[i].left := edtShow.Width + (RoomW * i);
arrX[i].Top := 0;
arrX[i].Width := RoomW;
arrX[i].Height := RoomH;
if (i < 9)
then
arrX[i].caption :='0' + IntToStr(i + 1)
else
arrX[i].Caption :=IntToStr(i + 1);
i :=i + 1;
end;其中的arrX[] 是TPanel数组为什么在arrX[i]的第一次计算时,arrX[0].left会等于零
而实际上应该出来edtShow.Width才对的。那为大哥帮我看看啊/
还有
i :=0;
while (i < gCol) do
begin
arrX[i] := TPanel.Create(Panel1);
arrX[i].Parent := Panel1;
arrX[i].left := edtShow.Width + (RoomW * i);
arrX[i].Top := 0;
arrX[i].Width := RoomW;
arrX[i].Height := RoomH;
if (i < 9)
then
arrX[i].caption :='0' + IntToStr(i + 1)
else
arrX[i].Caption :=IntToStr(i + 1);
i :=i + 1;
end;其中的arrX[] 是TPanel数组为什么在arrX[i]的第一次计算时,arrX[0].left会等于零
而实际上应该出来edtShow.Width才对的。那为大哥帮我看看啊/
解决方案 »
- 如何在combobox中添加数据并显示检索到的第一条记录
- 关于不规则图形(其中颜色也各不相同)如何计算的问题
- 组件编辑器问题,ExecuteVerb中无法创建子控件!!!
- 求救,急了我几天的问题啊!如何不打开指定文件直接将该文件送到当前打印机打印呢.
- delphi动态申请的空间,在VC中是不是就不能用
- 怎样做一个动态的BMP图像分割?
- 一个关于数据类型的问题?
- 谁能给我一个好的答复?(http://www.csdn.net/expert/topic/169/169121.shtm)
- 能用ScanLine来替代Pixels吗???
- delphi读取Clipboard中的Excel中的数据,急,速给分
- image1.assign(image2)传递图片的问题
- 一个关剪贴板的问题
否则编译器就把变量释放了,后面没有用的变量就看不见了
var
i, j :integer;
arrX:array of TPanel;
begin
Panel1.SetBounds(0,120,700,400);
Panel1.AutoSize :=false;
if (Edit1.Text <> '')
then
gRow :=StrToInt(Edit1.Text)
else begin
ShowMessage('楼层数不能为空');
Edit1.SetFocus;
halt;
end;
if (Edit2.Text <> '')
then
gCol :=StrToInt(Edit2.text)
else begin
ShowMessage('每层房间数不能为空');
Edit2.SetFocus;
halt;
end;
if ((Panel1.Width - 4 - RoomW) div gCol < 25)
then
RoomW :=25;
if ((Panel1.Width - 4 - RoomW) div gCol >= 25) and ((Panel1.Width - 4 - RoomW) div gCol <= 50 )
then
RoomW :=((Panel1.Width - 4 - 27) div gCol) - 1;
if ((Panel1.Width - 4 - RoomW) div gCol > 50)
then
RoomW :=50;
if ((Panel1.Height - RoomH) div gRow < 25 )
then
RoomH :=25;
if ((Panel1.Height - RoomH) div gRow >= 25 ) and ((Panel1.Height - RoomH) div gRow <= 50 )
then
RoomH :=((Panel1.Height - 40) div gRow) - 1 ;
if ((Panel1.Height - RoomH) div gRow > 50 )
then
RoomH :=50;
if (RoomH < 40 )
then
edtShow.Width :=40
else
edtShow.Width :=RoomH;
edtShow.Height :=RoomH;
SetLength(arrZ,gRow,gCol);
SetLength(arrY,gRow);
Panel1.AutoSize :=true;
for i := 0 to gRow - 1 do
begin
arrY[i].Flag :=false;
for j := 0 to gCol - 1 do
arrZ[i, j].Flag :=false;
end;
SetLength(arrX,gCol);
i :=0;
while (i < gCol) do
begin
arrX[i] := TPanel.Create(Panel1);
arrX[i].Parent := Panel1;
arrX[i].left := edtShow.Width + (RoomW * i);
arrX[i].Top := 0;
arrX[i].Width := RoomW;
arrX[i].Height := RoomH;
if (i < 9)
then
arrX[i].caption :='0' + IntToStr(i + 1)
else
arrX[i].Caption :=IntToStr(i + 1);
i :=i + 1;
end;
i := 0;
while (i < gRow) do
begin
arrY[i].Panel := TPanel.Create(Panel1);
arrY[i].Panel.Parent := Panel1;
arrY[i].Panel.left := 0;
arrY[i].Panel.Top := (i + 1) * RoomH;
arrY[i].Panel.Width := edtShow.Width;
arrY[i].Panel.Height := RoomH;
arrY[i].initTop := (i + 1) * RoomH;
arrY[i].CurTop := (i + 1) * RoomH;
if (i < 9)
then
arrY[i].Panel.caption :='0' + IntToStr(i + 1)
else
arrY[i].Panel.Caption :=IntToStr(i + 1);
i :=i + 1;
end;
Notebook1.ActivePage :='2';
gBottom :=RoomH * (gRow + 1);
end;
arrY[i].Panel.left := 0;每个都是0啊,并非第一个才是0啊?