Windows Develop Bookmark and Share   
 index > Windows Forms General > Drawing in Panel - maximum height? (C#)
 

Drawing in Panel - maximum height? (C#)

Hi out there, I've got another question which I do not want to discuss in my other (resolved) Thread:
I am drawing some lines in a panel, but after 38 lines, the drawing stops.

Here is one example:

e.Graphics.DrawLine(Pens.Black,0,0,100000,100000);
//nochangetothisone, although its 100000px not 1000px:
e.Graphics.DrawLine(Pens.Black,0,0,1000,1000);


This line just goes to the end of the screen, a scrollbar actually appears on the right side, but there is nearly nothing to scroll (a real tiny scrollbar... maybe scrolling 1cm, not more)

So:
Is there something like a maximum height when drawing in a panel or why is there no change between both DrawLine commands? Is it technically possible to draw a line at ~2000px (only visible by scrolling then)?

Background:
I am drawing 110 lines - one under the other one, but the drawing stops at line 38 (which is located at the end of my screen)
(AutoScroll is enabled, when trying to go step by step through the code with breakpoints, everything is right, calculations are right - just drawing does not go on any more)

Help would be very nice... Thanks to all in advance!
Chriz Mas  Thursday, January 22, 2009 1:09 PM
You didn't set the panel's AutoScrollMinSize property correctly. If you want to see a (0,0) - (10000,10000) line completely, you have to set AutoScrollMinSize to (10000,10000).
Hans Passant.
  • Marked As Answer byChriz Mas Friday, January 23, 2009 3:07 PM
  •  
nobugz  Friday, January 23, 2009 11:51 AM

I did not know this Kira Qian. But that was what i basically thought.. Unfortunately.

And nobugz, you once saved my life again.

My solution now (as AutoScrollMinSize did not do well on the panel):

I added AutoScroll and AutoScrollMinSize to the form - it is not good looking, but it is working.

So: Thanks alot to you both.

Greetings

Chriz

Chriz Mas  Friday, January 23, 2009 3:10 PM

Hi Chriz Mas,

"This line just goes to the end of the screen", do you mean you want to draw the line out of the monitor screen?

Base on my experience, the maximum value of the Size property of the Form is limited by the resolution of the screen on which the form runs. The value cannot be greater than 12 pixels over each screen dimension (horizontal + 12 and vertical + 12).

Please look at two documentation on MSDN.
http://msdn.microsoft.com/en-us/library/25w4thew.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.size.aspx

If I misunderstood something, please feel free to tell me.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, January 23, 2009 9:57 AM
You didn't set the panel's AutoScrollMinSize property correctly. If you want to see a (0,0) - (10000,10000) line completely, you have to set AutoScrollMinSize to (10000,10000).
Hans Passant.
  • Marked As Answer byChriz Mas Friday, January 23, 2009 3:07 PM
  •  
nobugz  Friday, January 23, 2009 11:51 AM

I did not know this Kira Qian. But that was what i basically thought.. Unfortunately.

And nobugz, you once saved my life again.

My solution now (as AutoScrollMinSize did not do well on the panel):

I added AutoScroll and AutoScrollMinSize to the form - it is not good looking, but it is working.

So: Thanks alot to you both.

Greetings

Chriz

Chriz Mas  Friday, January 23, 2009 3:10 PM

You can use google to search for other answers

Custom Search

More Threads

• How to intercept a WM_SYSCOMMAND sent to another app
• Windows taskbar help
• Adding a picturebox on a menustrip.
• Button FocusRectangle Problem
• Adding a Rectangle object to a Panel
• How to override the drawitem event of the tab control to get the appearance of the normal tab control.
• [C#] DragDrop to Desktop/Explorer
• check points from drawline c#
• Get text from datagrid cell
• Accessing SetStyle from Outside the Control