Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   ScrollBox mit permanenter vertikaler Scrollbar (https://www.delphipraxis.net/194558-scrollbox-mit-permanenter-vertikaler-scrollbar.html)

hoika 7. Dez 2017 07:46

ScrollBox mit permanenter vertikaler Scrollbar
 
Hallo,
das Thema ist wohl so alt wie Delphi selbst ...

Der unten stehende Code funktioniert, solange die Scrollbar nicht dynamisch erzeugt wird.
Packe ich den FormCreate-Code mit ins FormActivate (oder FormShow), klappt es nicht.
Das liegt wohl daran, dass das eigentliche Window-Handle dann schon erzeugt ist.

Was kann ich tun?

PS: Eine abgeleitete Klasse will ich nicht verwenden.


Delphi-Quellcode:
procedure TForm115.FormActivate(Sender: TObject);
begin
  ShowScrollBar(ScrollBox1.Handle, SB_VERT, True);
  ShowScrollBar(ScrollBox1.Handle, SB_HORZ, False);
end;

procedure TForm115.FormCreate(Sender: TObject);
var
  iStyle: Integer;
begin
  iStyle:=GetWindowLong(ScrollBox1.Handle,GWL_STYLE);
  SetWindowLong(ScrollBox1.Handle,GWL_STYLE,iStyle or WS_HSCROLL or WS_VSCROLL);

  ScrollBox1.VertScrollBar.Visible := True;
  ScrollBox1.HorzScrollBar.Visible := True;

  ScrollBox1.AutoScroll := True;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:17 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz