saeidsg
سه شنبه 15 آذر 1390, 01:33 صبح
با سلام خدمت دوستان
میخواستم آرایه ای از BitBtn در داخل یک TabSheet ساخته شود
در کد زیر ساخته می شود ولی در روی فرم ساخته می شود در جای مورد نظر من نیست
procedure TMainProg.FormShow(Sender: TObject);
var
ctrlCount,i,iCountButtom: Integer;
Top, ICountFull,ICountFree : Integer;
;
begin
SetLength(buttonsArray, Dbs.RoomTbl.RecordCount);
i := 0;
iCountButtom := 0;
Top := 150;
Dbs.RoomTbl.First;
while not Dbs.RoomTbl.Eof do begin
buttonsArray[iCountButtom] := TdxButton.CreateParented(c);
buttonsArray[iCountButtom].Width := 50;
buttonsArray[iCountButtom].Align := alNone;
if i = 15 then begin
Top := buttonsArray[iCountButtom].Height + Top + 30;
i:=0;
end;
buttonsArray[iCountButtom].Top := Top;
buttonsArray[iCountButtom].Left := 150+(50*i)+(i*3);
buttonsArray[iCountButtom].Height := 50;
buttonsArray[iCountButtom].Caption := Dbs.RoomTbl.FieldByName('NumberRoom').AsString;
buttonsArray[iCountButtom].Color := clYellow;
buttonsArray[iCountButtom].Parent := Self;
buttonsArray[iCountButtom].Hint := Dbs.RoomTbl.FieldByName('NumberRoom').AsString;
buttonsArray[iCountButtom].ShowHint := True;
Inc(i);
buttonsArray[iCountButtom].ControlStyle := buttonsArray[iCountButtom].ControlStyle + [csClickEvents];
buttonsArray[iCountButtom].OnClick := MainProg.Label1.OnClick;
buttonsArray[iCountButtom].Colors.BackgroundFrom:= clRed; //$00F5BF76;
buttonsArray[iCountButtom].Layout := blGlyphTop;
if buttonsArray[iCountButtom].Caption = '110' then begin
buttonsArray[iCountButtom].Colors.BackgroundFrom:= clRed;
end;
ImgMain.GetBitmap(iCountButtom, buttonsArray[iCountButtom].Glyph) ;
Dbs.RoomTbl.Next;
Inc(iCountButtom);
end;
میخواستم آرایه ای از BitBtn در داخل یک TabSheet ساخته شود
در کد زیر ساخته می شود ولی در روی فرم ساخته می شود در جای مورد نظر من نیست
procedure TMainProg.FormShow(Sender: TObject);
var
ctrlCount,i,iCountButtom: Integer;
Top, ICountFull,ICountFree : Integer;
;
begin
SetLength(buttonsArray, Dbs.RoomTbl.RecordCount);
i := 0;
iCountButtom := 0;
Top := 150;
Dbs.RoomTbl.First;
while not Dbs.RoomTbl.Eof do begin
buttonsArray[iCountButtom] := TdxButton.CreateParented(c);
buttonsArray[iCountButtom].Width := 50;
buttonsArray[iCountButtom].Align := alNone;
if i = 15 then begin
Top := buttonsArray[iCountButtom].Height + Top + 30;
i:=0;
end;
buttonsArray[iCountButtom].Top := Top;
buttonsArray[iCountButtom].Left := 150+(50*i)+(i*3);
buttonsArray[iCountButtom].Height := 50;
buttonsArray[iCountButtom].Caption := Dbs.RoomTbl.FieldByName('NumberRoom').AsString;
buttonsArray[iCountButtom].Color := clYellow;
buttonsArray[iCountButtom].Parent := Self;
buttonsArray[iCountButtom].Hint := Dbs.RoomTbl.FieldByName('NumberRoom').AsString;
buttonsArray[iCountButtom].ShowHint := True;
Inc(i);
buttonsArray[iCountButtom].ControlStyle := buttonsArray[iCountButtom].ControlStyle + [csClickEvents];
buttonsArray[iCountButtom].OnClick := MainProg.Label1.OnClick;
buttonsArray[iCountButtom].Colors.BackgroundFrom:= clRed; //$00F5BF76;
buttonsArray[iCountButtom].Layout := blGlyphTop;
if buttonsArray[iCountButtom].Caption = '110' then begin
buttonsArray[iCountButtom].Colors.BackgroundFrom:= clRed;
end;
ImgMain.GetBitmap(iCountButtom, buttonsArray[iCountButtom].Glyph) ;
Dbs.RoomTbl.Next;
Inc(iCountButtom);
end;