467,911 Members | 1,527 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,911 developers. It's quick & easy.

Drawing Lines on specific panel

Hi,

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.
Sep 26 '07 #1
  • viewed: 3489
Share:
4 Replies
Hi,

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.
"Gidi" wrote:
Hi,

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.
Sep 26 '07 #2
The Paint event occurs every time the Control needs to be painted, so you
just put your code in there, and it will be redrawn automatically whenever
the Panel is repainted.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Gidi" <sh*****@hotmail.com.dontspamwrote in message
news:D5**********************************@microsof t.com...
Hi,

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.
"Gidi" wrote:
>Hi,

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.

Sep 26 '07 #3
Thanks Kevin,

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.
"Kevin Spencer" wrote:
The Paint event occurs every time the Control needs to be painted, so you
just put your code in there, and it will be redrawn automatically whenever
the Panel is repainted.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Gidi" <sh*****@hotmail.com.dontspamwrote in message
news:D5**********************************@microsof t.com...
Hi,

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.
"Gidi" wrote:
Hi,

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.


Sep 26 '07 #4
you can't. Drawing using the Graphics object is via GDI+. It means you will
have to redraw everything on every paint event.
If you don't, your drawing will be cleared when another window will hover
your panel and you will lost your drawing.

For performance you can use double buffering and pre initialization of some
of the objects.

"Gidi" <sh*****@hotmail.com.dontspamwrote in message
news:1C**********************************@microsof t.com...
Thanks Kevin,

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.
"Kevin Spencer" wrote:
>The Paint event occurs every time the Control needs to be painted, so you
just put your code in there, and it will be redrawn automatically
whenever
the Panel is repainted.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Gidi" <sh*****@hotmail.com.dontspamwrote in message
news:D5**********************************@microso ft.com...
Hi,

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.
"Gidi" wrote:

Hi,

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.


Sep 26 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Champika Nirosh | last post: by
6 posts views Thread by iwdu15 | last post: by
1 post views Thread by Niels Jensen | last post: by
1 post views Thread by R2D2 | last post: by
11 posts views Thread by dongarbage | last post: by
12 posts views Thread by Petra Rohmer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.