简体   繁体   中英

Delphi How to force Main form scrollbars to be visible

What options/properties should use to show a main from scrolbars when I want to? or always visible in Delphi 2010 The help is as too often useless thanks Pw

@Philippe, you can use the ShowScrollBar function and the HorzScrollBar, VertScrollBar propeties to do this.

check this code

procedure TForm1.FormCreate(Sender: TObject);
begin
  HorzScrollBar.Range := 10000; // set the range to an higher number
  VertScrollBar.Range := 10000; // set the range to an higher number
  ShowScrollBar(Handle, SB_BOTH, True);
end;

If you set AutoScroll = true, they should show up if needed. That is, if any visual component is placed outside of the visible client area.

If you do not have any components 'off-screen', why would you need the scrollbar showing?

Anyway, you can set Horz-/VertScrollBar.Range to anything larger than the clientheight/width, and they will show up.

If you need the scrollbar for something else, you can always drop a TScrollBar component on the form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM