473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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
4 3759
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Champika Nirosh | last post by:
Hi, I want to create drawing board application that can draw Line, rectagle, circle and free hand drawing. Each drawing need to be transparent, moveable (draggable), have bring to front and...
6
by: iwdu15 | last post by:
hi, this is a n00b question but when i draw on a panel in my form using GDI and a pen, but when i minimize the form, or put anything in front of the item in drawing on, the graphics go away. how...
2
by: George | last post by:
Dear colleagues, I refer to your help with specific graphic problem. It is necessary to create a viewfinder in graphic application. It seems that the algorithm is simple: just draw lines in...
1
by: Niels Jensen | last post by:
Hi guys, I have the following code which is supposed to draw a grid in a panel consisting of a specified number of squares. I can get it to draw the grid and activate the autoscroll feature,...
1
by: R2D2 | last post by:
Hello, I am trying to get a form to draw arrows linking 2 list boxes to each other. I can write the code to draw the arrows / make them follow the boxes around when they are dragged around the...
11
by: dongarbage | last post by:
Hi there, I'm very much a C# novice. How do you do freehand drawing on a panel with a mouse in c#? Thanks, Don
12
by: Petra Rohmer | last post by:
Hello, I want to ake following 0,0 (900mm,900mm) -------------------------------------- |....................................| |....................................|...
1
by: YouPoP | last post by:
I am doing an app (C# 2.0) where you can draw in a panel with your mouse in "real time". I actually have 2 problems; 1- it does not really is "real time", if your mouse move fast or very fast the...
0
by: BarryM | last post by:
Iv got a panel on the main form which is set to auto scroll. In the panel there is a picture box that i draw lines in. the lines work perfectly fine until the scroll bar comes up. The picture box...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.