473,403 Members | 2,359 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,403 software developers and data experts.

Drawing And Resized Forms

Hey,
I have a simple Win Forms that draws a line (graphics.drawLine) on the
current form,
All is well until the user resizes the form - after the resize,
When I draw a line on a part of the form that was not visible befure
the resize,
It does nothing! I mean I get no exception but it doesnt draw the line!
Any suggestions?
Thanks ahead

--sternr

Jul 27 '06 #1
2 1318
Sternr,

Where are you executing the code to draw the line? My guess is that it
is not in the OnPaint method of the form, or in an event handler for the
Paint event.

The reason this doesn't work is that programs with a UI in Windows have
a message pump. This is basically a while loop that gets messages from the
OS, and then performs an action based on that message. Being notified to
paint itself is one of those messages.

If you are not overriding the OnPaint method, or adding an event handler
to the Paint event and performing your drawing there, then when the form is
told to repaint itself, it has no clue that a line should be there, and then
erases what you had already painted.

Hope this helps.
"sternr" <St****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hey,
I have a simple Win Forms that draws a line (graphics.drawLine) on the
current form,
All is well until the user resizes the form - after the resize,
When I draw a line on a part of the form that was not visible befure
the resize,
It does nothing! I mean I get no exception but it doesnt draw the line!
Any suggestions?
Thanks ahead

--sternr

Jul 27 '06 #2
Hey Nicholas tahnks for your reply!
You misunderstood me - when I enlarge my form all the lines I drew are
still visible,
The problem is, I'm trying to draw a link in a part of the form that is
visible only after the enlargment, and nothing happens...
Any idea?
Thanks ahead,

--sternr

Jul 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: padawan | last post by:
I have a winforms control that draws a rectangle for a boarder and positions some graphical elements around the control to create the boarder effect I desired. In the control I have overriden the...
1
by: zengou | last post by:
My application have many picturebox objects,when run it ,sometimes i will have a strange error,how to work out ,help me please!(in windows98,the error cause frequently than in windowsxp) ...
4
by: funcSter | last post by:
Hey, got a prob which is driving me nuts! I'm trying to resize the resolution of an image as well as it's pyhsical byte size. I've got: byte bytImage = null; System.Drawing.Image imgImage =...
2
by: Tyler Foreman | last post by:
Hello, I had an earlier post regarding a strange exception I (thought) I was getting in my windows form. I have since been able to trace the problem to a picturebox control on my form. I can...
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,...
2
by: Martin Horn | last post by:
Hi all, I'm adding basic drawing capability to an application that I am writing, and I have been having problems with making the graphics output persist when the application is re-sized,covered...
0
by: Hasim AH | last post by:
Hi .. Just getting interested to learn C# and needs help. I want to write C# application so that the program will execute and draw graphics when the user select the drawing menu from the main...
1
by: kelvin.koogan | last post by:
In my application I'm doing some drawing in my OnPaint routine using Graphics->DrawRectangle. The rect bounds are constant and not scaled in anyway. One of our Chinese customers is seeing the...
7
by: raylopez99 | last post by:
I have a logical drawing space much bigger than the viewport (the screen) and I'd like to center the viewport (the screen) to be at the center of the logical drawing space. After following the...
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
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
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...
0
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,...
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.