I've windows form, in this form i've a panel.
I want to draw lines inside the panel using the panel coordinates( meaing
that the left upper corner of the panel is 0,0), how can i do it?
Thanks,
Gidi.
I found out that i can draw on the panel with panel1.Paint event.
my question now is, how can i draw lines in a specific location, at when the
form loads and not call the paint event again with the lines will be erased ?
Thanks,
Gidi.
--
HTH,
Kevin Spencer
Microsoft MVP
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
"Gidi" <shn...@hotmail.com.dontspam> wrote in message
news:D5E77969-CA8A-4EA1...@microsoft.com...
the problem is that my form heightis smaller then my panel height, so i have
to scroll the panel up and down to see all it's content. now when i scroll
the panel the paint event starts again, but not from point (0,0) of the
orginal panel but from the point that the scroll stopped and i don't want
that. I want to draw the lines one time from height = 0 to panel's height,
without calling the drawing line again after scrolling.
how can i do it?
Thanks,
Gidi.
For performance you can use double buffering and pre initialization of some
of the objects.
"Gidi" <shn...@hotmail.com.dontspam> wrote in message
news:1CF70135-0276-46C1...@microsoft.com...
As has been mentioned, in the Windows display paradigm requires that you
always respond to the Paint event, drawing your image each time.
You can cache your drawing to a bitmap if you want persistence without
having to go through all of the drawing code each time, but a) this is
often not actually required in order to achieve good performance, and b)
it won't address what appears to be your _actual_ question.
Specifically, it sounds as though you are having trouble with the
scrolling aspect of the drawing. You need to handle this yourself,
regardless of how you actually do the drawing. The basic issue is that
the drawing origin of the control doesn't actually change according to
the scrollbar position.
You can address this either by using the Panel's AutoScrollPosition
property to offset your own drawing (either explicitly or by changing
the Transform property of the Graphics object you're using for drawing),
or you can just "nest" your custom-drawn Panel inside a different Panel
or UserControl that handles the actual scrolling (in that way, you'll
always be drawing relative to your custom-drawn Panel's origin, and that
Panel will be moved as appropriate within the control that's actually
scrolling.
Pete