Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 135,911 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,565 people online right now. Registration is fast and FREE... Join Now!




Scrolling with GDI

 
Reply to this topicStart new topic

Scrolling with GDI

Echilon
19 May, 2008 - 01:41 AM
Post #1

New D.I.C Head
*

Joined: 23 Feb, 2007
Posts: 12


My Contributions
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?
User is offlineProfile CardPM
+Quote Post

zakary
RE: Scrolling With GDI
19 May, 2008 - 11:06 AM
Post #2

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 404



Thanked: 6 times
Dream Kudos: 175
My Contributions
you cannot scroll a panel, what you can do is add a RichTextBox to that panel and use that columns and rows. Or you can just use a DataGrid which is already like an excel spreadsheet.
User is online!Profile CardPM
+Quote Post

Echilon
RE: Scrolling With GDI
19 May, 2008 - 11:20 AM
Post #3

New D.I.C Head
*

Joined: 23 Feb, 2007
Posts: 12


My Contributions
QUOTE(zakary @ 19 May, 2008 - 12:06 PM) *

you cannot scroll a panel, what you can do is add a RichTextBox to that panel and use that columns and rows. Or you can just use a DataGrid which is already like an excel spreadsheet.

I've managed to get it working by using panelName.AutoScrollPosition.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 07:45AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month