TToolBar not moved by form scroll bar

I am trying to create a print preview form to preview multiple pages. I have a Tool Bar aligned to the top of a form. I want the tool bar to always be fixed to the top left of the form when scrolling the form using the horizontal and vertical scroll bars (so the tool bar will not move and the scroll bars only move the pages). The vertical scroll bar should also start at the top below the tool bar, not next to it.

Is there a way of doing this using the form scroll bars or do I need to create custom scroll bars that control the form scrolling manually?


  • Eh, not sure if i got what you are trying to do, but maybe OnConstrainedResize event can help?

    [code]void __fastcall TForm1::FormConstrainedResize(TObject *Sender,
    int &MinWidth, int &MinHeight, int &MaxWidth, int &MaxHeight)
    Button1->Top = 0;
    Button1->Left = 0;

    Just adjust your toolbar's position to 0,0 and it should stay visible no matter where you scroll.
  • Oops, double post, sorry
  • That method does work although the tool bar flickers as you adjust the scroll bar as it moves with the scroll bar then jumps back when set by this event handler.

    Also still have the problem of the vertical scroll bar starting at the top of the form (to the right of the tool bar) rather than under it. I want the tool bar to extend right across the form.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!