473,801 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When the messagebox disappears, it leaves a white square


I've created a demo program that draws random lines on the form. At the end,
a messagebox pops up with the words"I'm done!". When I click on "OK", the
messagebox disappears, but a white square is left in its place. I can still
see the randomly drawn lines on the form, but some are covered up by the
white square. How do I prevent the white square from showing after the
messagebox closes? Thank you. David
Jul 8 '06 #1
10 1823
if you are using the "Graphics" object to draw lines, this will happen. just
as your lines will go away if you minimize your app. you can either
dynamically create an array to keep track of all the points you draw, or the
way i prefer which is to use a GrpahicsPath object. take a look at the
GraphicsPath and "Start Figure" items. they should be what your looking for,
ive used them and they worked prefectly
--
-iwdu15

Jul 8 '06 #2

I am using the graphics object. Is there an alternative to using the
graphics object for drawing lines? I want to keep it simple because I'm a
newbie to VB.NET. Do I find info on the GraphicsPath object & the Start
Figure in the Help? I've noticed that the same problem happens when I use a
menu. When the menu disappears, there is a blank area. I don't have this
problem with the "same" demo program in VB6. When I click on the messagebox,
it disappears & I can still see the lines.

"iwdu15" wrote:
if you are using the "Graphics" object to draw lines, this will happen. just
as your lines will go away if you minimize your app. you can either
dynamically create an array to keep track of all the points you draw, or the
way i prefer which is to use a GrpahicsPath object. take a look at the
GraphicsPath and "Start Figure" items. they should be what your looking for,
ive used them and they worked prefectly
--
-iwdu15
Jul 9 '06 #3

pcnerd a écrit :
but a white square is left in its place.
It has maybe nothing to do with the program but with ... your graphic
memory. Not enough memory. Check that you free all the objects you use.
Could be!

Michel.

Jul 9 '06 #4
no, its not the graphics memory, if you do not do your drawing in the forms
"OnPaint" method, then when something covers the form, the graphics are lost.
try this, create a sample app and put a button on the form, in the button
click event, draw a couple lines. minimize the form, the bring it back up.
the lines are gone, now if you do the same thing but put the drawing events
in the forms "Paint" event, the lines will stay so in the button click even,
put Me.Invalidate() and in the Paint event, put the drawing code. voila!

so to answer your question, you have to do one of the following: all drawing
in the Paint event, keep track of the points you draw and redraw the lines
when necessary, or use a GraphicsPath object, which you can read about in
help under System.Drawing2 D
--
-iwdu15
Jul 9 '06 #5
A faster option is to do your drawing on a bitmap then in the form's
"onpaint" event, copy the bitmap to the form's graphics object using the API
"bitblt".
--
Dennis in Houston
"iwdu15" wrote:
no, its not the graphics memory, if you do not do your drawing in the forms
"OnPaint" method, then when something covers the form, the graphics are lost.
try this, create a sample app and put a button on the form, in the button
click event, draw a couple lines. minimize the form, the bring it back up.
the lines are gone, now if you do the same thing but put the drawing events
in the forms "Paint" event, the lines will stay so in the button click even,
put Me.Invalidate() and in the Paint event, put the drawing code. voila!

so to answer your question, you have to do one of the following: all drawing
in the Paint event, keep track of the points you draw and redraw the lines
when necessary, or use a GraphicsPath object, which you can read about in
help under System.Drawing2 D
--
-iwdu15
Jul 9 '06 #6
Using the OnPaint event can give serious performance problems!
As soon as anything has to be (re)painted on your form, you get this
event and your drawcode will execute.

A better way is to use the background image of the form; create a
bitmap, draw on this bitmap, and set this bitmap as background image.
In this way, your drawing will be automaticly updated by the window
repaints.
Dennis wrote:
A faster option is to do your drawing on a bitmap then in the form's
"onpaint" event, copy the bitmap to the form's graphics object using the API
"bitblt".
Jul 9 '06 #7

Now you are totally confusing me! I've gotten different suggestions. I'm
going to put the drawing code in the paint event & put me.invalidate in the
button click event. Something really weird is happening to the random lines
demo. After the 3rd buton click, the lines are drawn & then the form clears
itself!! The next time that I click the button, the lines are drawn again.
Really weird!! Why would it do that?

"Theo Verweij" wrote:
Using the OnPaint event can give serious performance problems!
As soon as anything has to be (re)painted on your form, you get this
event and your drawcode will execute.

A better way is to use the background image of the form; create a
bitmap, draw on this bitmap, and set this bitmap as background image.
In this way, your drawing will be automaticly updated by the window
repaints.
Dennis wrote:
A faster option is to do your drawing on a bitmap then in the form's
"onpaint" event, copy the bitmap to the form's graphics object using the API
"bitblt".
Jul 10 '06 #8
What happens when you put me.refresh after me.invalidate?

pcnerd wrote:
Now you are totally confusing me! I've gotten different suggestions. I'm
going to put the drawing code in the paint event & put me.invalidate in the
button click event. Something really weird is happening to the random lines
demo. After the 3rd buton click, the lines are drawn & then the form clears
itself!! The next time that I click the button, the lines are drawn again.
Really weird!! Why would it do that?

"Theo Verweij" wrote:
>Using the OnPaint event can give serious performance problems!
As soon as anything has to be (re)painted on your form, you get this
event and your drawcode will execute.

A better way is to use the background image of the form; create a
bitmap, draw on this bitmap, and set this bitmap as background image.
In this way, your drawing will be automaticly updated by the window
repaints.
Dennis wrote:
>>A faster option is to do your drawing on a bitmap then in the form's
"onpaint" event, copy the bitmap to the form's graphics object using the API
"bitblt".
Jul 10 '06 #9
Is setting the background of the form to the bitmap quicker than using the
API "Bitblt" to copy the invalidated section to the form's graphic object in
the "onpaint" event?
--
Dennis in Houston
"Theo Verweij" wrote:
Using the OnPaint event can give serious performance problems!
As soon as anything has to be (re)painted on your form, you get this
event and your drawcode will execute.

A better way is to use the background image of the form; create a
bitmap, draw on this bitmap, and set this bitmap as background image.
In this way, your drawing will be automaticly updated by the window
repaints.
Dennis wrote:
A faster option is to do your drawing on a bitmap then in the form's
"onpaint" event, copy the bitmap to the form's graphics object using the API
"bitblt".
Jul 10 '06 #10

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

Similar topics

6
5239
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and black text but when I change Windows start menu->settings->control panel ->display -> appearance and change scheme to 'High Contrast Black' the background in the browser changes to black and the text to white. I understand that the windows scheme...
0
2735
by: yurps | last post by:
Hello here is my html, if you click the missing image in the first column on the left, the div is shown, when clicked again the div disappears...but the bottom border disappears as well...Is there anyway to stop this...??? <HTML> <HEAD> <title>Conform Inbox</title> <meta content="False" name="vs_snapToGrid">
3
7182
by: Tony Johansson | last post by:
Hello! Assume you want to store field object that a chess board consist of. A chess board consist of 64 fields where each field is either white or black. Now to my question how should I implement this putFieldAt below when I have field object that should be placed at position row i and kolumn j. So this putFieldAt is called 64 timmes where i has the value from 0 to 7 and j has value from 0 to
5
6801
by: adolf garlic | last post by:
Im trying to return xml from sql. The xml is made up of different fragments, some using FOR XML ... syntax. The result is a valid xml doc. There is a working stored proc that returns the xml In .net i'm having problems loading this up. I've now tried installing sqlxml managed classes and the following appears to work when stepping through, but the result just disappears.
5
3431
by: John Bowman | last post by:
Hi, I need some dialog handling help, I must be missing something obvious here but I can't figure out the solution to the following problem... Simple Win Forms app that has button on the form. The click event handler for the button creates another dialog (as a form object) and calls it's ShowDialog method to dsiplay it modally. The secondary dialog then appears that has OK and Cancel buttons and the user can interact as expected. Now...
6
1936
by: Mark | last post by:
Hello all - I'm trying to incorporate a stylesheet into an ASP.Net page but everytime I include the "LINK" code to the .css file in the HEADER location of the HTML code, the background color that I have set (which is blue) gets changed to white. Below is my code in the HTML of the ASP.NET page and then my code in the .css file. Any help is sincerely appreciated as I haven't worked with stylesheets alot in my past. Thanks for any...
2
1467
by: Matt Gabbard | last post by:
Greetins all, I have a problem that has me beating my head against the desk.. A simple form with a buttong, creates a sime form via click: --- If lv1.SelectedItems.Count > 0 Then Dim f As New frmAddEditEmp(CInt(lv1.SelectedItems(0).SubItems(0).Text)) f.ShowDialog()
2
4753
by: spifster | last post by:
Hello all, I am building a collapsable tree using Javascript with DOM in IE. In order to make collapsed cells disappear I have been hiding the text. The cells collapse but still leave borders behind. I have set the borderStyle to none and the black lines go away, but there is still white space where the borders were. Following are my html files I am using to test it. ----------------BEGIN HTML FILE----------------
5
13978
tharden3
by: tharden3 | last post by:
How do I remove white space around an icon? I have been using some helpful icon pics from google images to spice up a website that I'm making. In many instances though, the icon is not square, but irregularly shaped, leaving white space to make a square around the icon. In one case, I was using a 16 x 16 gif image of a movie reel (a round object) but I could not get rid of the white space around the object. How can I do this?
0
9698
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10292
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...
1
10262
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7589
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6829
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
5479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5616
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4156
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
2959
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.