Using Scrollbars with User Painted Controls

  • Thread starter Thread starter Alex Glass
  • Start date Start date
A

Alex Glass

Im using double buffering to draw a scheduling grid on a form. The grid can
take up more space than the form can display. I would like to use a
scrollbar to control which part of the window the user can view. Does
anyone know a simple way to do this?

Any help is always greatly appreciated,

-Alex
 
* "Alex Glass said:
Im using double buffering to draw a scheduling grid on a form. The grid can
take up more space than the form can display. I would like to use a
scrollbar to control which part of the window the user can view. Does
anyone know a simple way to do this?

Take a look at the control's 'AutoScroll' property (inherited from
'ScrollableControl').
 
The problem with the autoscroll property is that the origin (X,Y start of
drawing) remains the same while using the scrollbar. This means that if i
scroll down to the bottom of the page, the window still only paints the
upper portion. Furthermore I was unable to find the event that reacts to
the scrollbar moving.

-Alex
 
Try:

g.TranslateTransform(this.AutoScrollPosition.X, this.AutoScrollPosition.Y);

before painting

HTH

Paul Wardle

Alex Glass said:
The problem with the autoscroll property is that the origin (X,Y start of
drawing) remains the same while using the scrollbar. This means that if i
scroll down to the bottom of the page, the window still only paints the
upper portion. Furthermore I was unable to find the event that reacts to
the scrollbar moving.

-Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top