Thema: Delphi Scrollbars

Einzelnen Beitrag anzeigen

Bjoerk

Registriert seit: 28. Feb 2011
Ort: Mannheim
1.384 Beiträge
 
Delphi 10.4 Sydney
 
#9

AW: Scrollbars

  Alt 3. Mär 2012, 14:50
Ja, ich weiß, ihr habt da alle Recht. Mich bitte auch jetzt nicht falsch verstehen. Ich hab meine Gründe, warum ich das so frage. Normalerweise arbeite ich constraints usw., zur Not mit einer Scrollbox und fertig. Ich hab‘ ca. 100 Forms, bei denen das so ist, wie oben beschrieben. Wenn ich da jetzt anfange zu ändern, wird‘ ich nie mehr fertig. Dann hab ich in OnResize auch noch einiges stehen. Meine Notlösung sah bis bisher so aus:

Delphi-Quellcode:
procedure MainFormPaint;
var
  ATop, ALeft, AWidth, AHeight, SWidth, SHeight, SLeft, STop, T: integer;
begin
  ALeft:= Application.MainForm.Left;
  ATop:= Application.MainForm.Top;
  AWidth:= Application.MainForm.Width;
  AHeight:= Application.MainForm.Height;

  SWidth:= Screen.WorkAreaWidth;
  SHeight:= Screen.WorkAreaHeight;
  STop:= Screen.WorkAreaTop;
  SLeft:= Screen.WorkAreaLeft;

  if ((SWidth-AWidth) < 0) or ((SHeight-AHeight) < 0) then
  begin
    Application.MainForm.HorzScrollBar.Range:= AWidth;
    Application.MainForm.VertScrollBar.Range:= AHeight;
    AWidth:= SWidth;
    AHeight:= SHeight;
  end;

  T:= ALeft;
  while (T+SLeft+AWidth) > SWidth do Dec(T);
  if T < SLeft then T:= SLeft;
  ALeft:= T;

  T:= ATop;
  while (T+STop+AHeight) > SHeight do Dec(T);
  if T < STop then T:= STop;
  ATop:= T;

  Application.MainForm.SetBounds(ALeft, ATop, AWidth, AHeight);
end;
  Mit Zitat antworten Zitat