Hallo,
ich habe eine Stringgrid die ich zur Laufzeit an die aktuelle Auflösung anpasse. Die Spaltebreite
DefaultColWidth soll sich auch automatisch maximieren, halt je nach dem die Auflösung ist.
Ich habe in TForm1.Resize denselben Befehl geschrieben wie bei TForm1.Create und leider reagiert der nur beim ändern der Auslösung darauf, dann macht er es auch so wie er es soll, halt nur nicht beim Programmstart.
Weis einer weiter?
Thx, Marcel...
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34:
| procedure TForm1.FormCreate(Sender: TObject); begin res_width := screen.Width; res_height := screen.Height; label5.Left := 0 + stringgrid1.DefaultColWidth + 15; label6.Left := 0 + stringgrid1.DefaultColWidth * 2 + 15; label7.Left := 0 + stringgrid1.DefaultColWidth * 3 + 15; label8.Left := 0 + stringgrid1.DefaultColWidth * 4 + 15; stringgrid1.Height := pagecontrol1.ClientHeight - 270; stringgrid1.DefaultColWidth := stringgrid1.Width div 5 - 5; button6.Top := pagecontrol1.Height - 45; button7.Top := pagecontrol1.Height - 45; end;
procedure TForm1.FormResize(Sender: TObject); begin Pagecontrol1.Width := Form1.ClientWidth - 80; Pagecontrol1.Height := Form1.ClientHeight - 80; stringgrid1.DefaultColWidth := stringgrid1.Width div 5 - 5; Stringgrid1.Width := Pagecontrol1.Width - 30; stringgrid1.Height := pagecontrol1.ClientHeight - 270; button6.Top := pagecontrol1.Height - 45; button7.Top := pagecontrol1.Height - 45; label5.Left := 0 + stringgrid1.DefaultColWidth + 15; label6.Left := 0 + stringgrid1.DefaultColWidth * 2 + 15; label7.Left := 0 + stringgrid1.DefaultColWidth * 3 + 15; label8.Left := 0 + stringgrid1.DefaultColWidth * 4 + 15; end; |