473,763 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3782
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*****@hotmai l.com.dontspamw rote in message
news:D5******** *************** ***********@mic rosoft.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*****@hotmai l.com.dontspamw rote in message
news:D5******** *************** ***********@mic rosoft.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*****@hotmai l.com.dontspamw rote in message
news:1C******** *************** ***********@mic rosoft.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*****@hotmai l.com.dontspamw rote in message
news:D5******* *************** ************@mi crosoft.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
12344
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 send to back feature etc. How can I do this .. where should I start?
6
1497
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 can i fix this? -- -iwdu15
2
2249
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 specific position in according to value of some controls, track bars, for example. Next read the track bars value to find the coordinates of lines cross. It works, but I can not get real cross because the background image is being deface by lines...
1
1578
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, however I cant get it to scroll properly. I dont want to make the grid a bitmap and move that as the grid can get very large and I want to keep memory and performance as high as possible. Is there an easy way to get the grid to to scroll so that...
1
6235
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 form, however, the form always draws the arrow under the child controls. I was wondering if anyone could tell me how I would make the arrows draw over the list boxes, instead of pass under them? The only idea I had was to call base.onPaint...
11
11270
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
18351
by: Petra Rohmer | last post by:
Hello, I want to ake following 0,0 (900mm,900mm) -------------------------------------- |....................................| |....................................| |....................................|
1
3985
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 line is added after a very small delay. 2-Because I use AddLine(), it adds very short lines from one point to another and it does not give a very good result. Also because of this and my "not real time" problem, when the mouse moves fast it adds...
0
1127
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 expands in the scrollable panel but the program wont allow the lines to continuing drawing(vb 2005) here's the coding Public Class Form1 Dim DrawGraphics As Graphics Dim DrawBitmap As Bitmap Dim y2 As Integer
0
10145
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.