473,409 Members | 1,985 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,409 software developers and data experts.

Form doesn't remember what's drawn on it?

If I draw on a form, then place another form on top of it, all the drawings
on the first form are erased. VB.Net doesn't have an AutoRedraw function.

How do I get graphics on a form to persist?
Nov 20 '05 #1
6 2115
Where are you drawing? If you put it in OnPaint, it should repaint whatever
you draw
"Noozer" <po********@127.0.0.1> wrote in message
news:OW*************@tk2msftngp13.phx.gbl...
If I draw on a form, then place another form on top of it, all the drawings on the first form are erased. VB.Net doesn't have an AutoRedraw function.

How do I get graphics on a form to persist?

Nov 20 '05 #2
I'm drawing based on events... The display could be empty for hours or fill
up within minutes, all depending on whether or not other controls generate
certain events.
"William Ryan" <do********@nospam.comcast.net> wrote in message
news:OD**************@tk2msftngp13.phx.gbl...
Where are you drawing? If you put it in OnPaint, it should repaint whatever you draw
"Noozer" <po********@127.0.0.1> wrote in message
news:OW*************@tk2msftngp13.phx.gbl...
If I draw on a form, then place another form on top of it, all the

drawings
on the first form are erased. VB.Net doesn't have an AutoRedraw function.
How do I get graphics on a form to persist?


Nov 20 '05 #3
* "Noozer" <po********@127.0.0.1> scripsit:
If I draw on a form, then place another form on top of it, all the drawings
on the first form are erased. VB.Net doesn't have an AutoRedraw function.


Create a 'Bitmap' of appropriate size, then obtain a 'Graphics' object
for the bitmap using 'Graphics.FromImage', draw onto the bitmap and
paint the bitmap onto the form in its 'Paint' event handler.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Noozer,
In addition to Herfried's comments.

When using the bitmap as Herfried suggested I normally resize the bitmap in
the Resize event (read create a new bitmap). Of course this can cause you to
loose the existing bitmap. You can either draw the existing onto the new
one, or simply allow a "blank" slate to be used.

Alternatively rather then "drawing on the form" I will store the information
that needs to be drawn in an object model, then in the Paint event (OnPaint
method) I call methods within this object model that cause it to be drawn.
This separates your data from the presentation, also if done carefully
enough allows you to present the info on the screen, a printer, or a bitmap.
The bitmap can then be stored in a database, sent over the internet, saved
in a file...

Of course this object model I can save to be reloaded later...

Hope this helps
Jay

"Noozer" <po********@127.0.0.1> wrote in message
news:OW*************@tk2msftngp13.phx.gbl...
If I draw on a form, then place another form on top of it, all the drawings on the first form are erased. VB.Net doesn't have an AutoRedraw function.

How do I get graphics on a form to persist?

Nov 20 '05 #5
The GDI+ FAQ has an article on creating retained mode graphics systems.

--
Bob Powell
Visit the GDI+ FAQ for articles, tips, tricks and code.
http://www.bobpowell.net/gdiplus_faq.htm

Read my blog
http://bobpowelldotnet.blogspot.com


"Noozer" <po********@127.0.0.1> wrote in message
news:OW*************@tk2msftngp13.phx.gbl...
If I draw on a form, then place another form on top of it, all the drawings on the first form are erased. VB.Net doesn't have an AutoRedraw function.

How do I get graphics on a form to persist?

Nov 20 '05 #6
The GDI+ FAQ has an article on creating retained mode graphics systems.

--
Bob Powell
Visit the GDI+ FAQ for articles, tips, tricks and code.
http://www.bobpowell.net/gdiplus_faq.htm

Read my blog
http://bobpowelldotnet.blogspot.com


"Noozer" <po********@127.0.0.1> wrote in message
news:OW*************@tk2msftngp13.phx.gbl...
If I draw on a form, then place another form on top of it, all the drawings on the first form are erased. VB.Net doesn't have an AutoRedraw function.

How do I get graphics on a form to persist?

Nov 20 '05 #7

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

Similar topics

32
by: Eli | last post by:
How can I POST a form into a new window where I control the size and other attributes of the new window? Also. Are there any implications, perhaps due to browser security (Interne Explorer?)...
2
by: Pete | last post by:
Before I get started with the question, does anyone have a (single) good book recommendation for database design? Not an Access-specific book, but something geared toward helping me figure out...
5
by: Stan Shankman | last post by:
C# -- Visual Studio.Net – Windows Application Greetings all, How do I copy a Form’s image to a bitmap? – And do so before it gets to the screen. I haven’t been able to find anyone that knows...
10
by: B-Dog | last post by:
I want to run something once my form in completely loaded and drawn but running at the end of form load doesn't do I guess cause of the large dataset fill and the form isn't fully loaded. Where...
8
by: Frank | last post by:
Hello, I have a form in which I draw a grid in the paint event. Works fine, except when using the scrollbars. Autoscroll is switched on, I use doublebuffering and userpaint and...
6
by: Paul | last post by:
Hi, Is is possible to display a form that slides up from the system tray like that of MSN Messenger? I have tried the AnimateWindow API and the various flags (blend, roll horizontal, roll...
17
by: pigeonrandle | last post by:
Hi, I have seen loads of different ways to do this, but the all seem to yield the same result - text that doesn't flicker when it's moving too slowly! Does anyone know 'the best way' to make text...
6
by: Harshpandya | last post by:
Hi all, I am working on the form in which you fill out the whole PHP form and e mail that details to someone. It is working fine. But now i want to send the same form to be sent to different...
2
by: KevinRR | last post by:
Hi, this it a sample code. let say I draw squares on a form SolidBrush myBrush = new SolidBrush(Color.Red); Graphics formGraphics = formnew.CreateGraphics(); ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.