Bill

Bill

  • NA
  • 16
  • 0

Scrolling with GDI

May 19 2008 5:33 AM
I'm trying to draw a sort of table onto a UserControl in C#. The table will resemble something like an Excel spreadsheet, with a header at the top and a column visible to the left side (these will always be visible, regardless of scroll state). I'm also going to have a number of vertical columns, each of which will line up with a rectangle on the header. I've split my UserControl into two sectione by adding panels, one for the header and one for the rest. The problem is the scrolling.

I can't see to get the panel to scroll, even though there are rectangles drawn outisde the visible co-ordinates and autoscroll is set to true.

I read that drawing to a bitmap might be an option, but I need to process mouse clicks on elements which are drawn inside the columns. I was thinkining of splitting them each into separate UserControls, then rendering each one and the sub-controls it contains. This would allow me to process mouse events much more easily.

Would this be the best option? Is it even possible to scroll a panel when you're drawing with GDI?

Answers (1)