473,654 Members | 3,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Redrawing on GDI+

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

im testing around a little with system.drawing.
I setup a Form to paint on it.

The problem: Paintig on a form or else is ok, but if my form lose the
handle by switching into an other app or showing an dialog on my form
will erase the drawed things.

Here we go: How i can save it :) or how to solve that my drawed form
will not erased?

Regards, Lucas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFJoLdRzx qsJWDX28RAjhnAJ 49NAVO1I9dzei/eE0FIafct4k4IgC fQphu
3LVas32+wCDrEhX Z1/aIq90=
=Mx3k
-----END PGP SIGNATURE-----
Oct 6 '06 #1
4 1361

"Lucas Napzchyr" <lu************ @gmx.dewrote in message
news:Un******** **********@news fe04.ams...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

im testing around a little with system.drawing.
I setup a Form to paint on it.

The problem: Paintig on a form or else is ok, but if my form lose the
handle by switching into an other app or showing an dialog on my form
will erase the drawed things.

Here we go: How i can save it :) or how to solve that my drawed form
will not erased?

Regards, Lucas
Handle the "Paint" event of the form to do your painting.
Oct 6 '06 #2
"Robinson" <to************ ******@myinboxt oomuchtoooften. comschrieb:
>Here we go: How i can save it :) or how to solve that my drawed form
will not erased?

Handle the "Paint" event of the form to do your painting.
.... or override its 'OnPaint' method.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Oct 6 '06 #3
Herfried K. Wagner [MVP] schrieb:
"Robinson" <to************ ******@myinboxt oomuchtoooften. comschrieb:
>>Here we go: How i can save it :) or how to solve that my drawed form
will not erased?

Handle the "Paint" event of the form to do your painting.

... or override its 'OnPaint' method.
ok thanks for u'r answers but it's not running.
(Forgive me but i'm not very familiar with VB :) )

I tried both and in both cases the (in that example) rectangle
will erased on new 'Paint'. I'm sure i'm wrong handling the event
because i can't find an description for my problem on google :(

here a little code:
############### ############### ############### ############### ##########
Imports System.Drawing

Public Class Form1
Inherits System.Windows. Forms.Form

Structure MOUSE
Dim MousePos As Point
Dim Click1Pos As Point
End Structure

Dim mymouse As MOUSE
Dim desk As Graphics = Me.CreateGraphi cs()
Dim test1 As System.Windows. Forms.PaintEven tArgs
Dim rc As Rectangle

Private Sub Form1_MouseClic k(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles Me.MouseClick
mymouse.Click1P os = New Point(e.X, e.Y)
rc = New Rectangle(mymou se.Click1Pos.X, mymouse.Click1P os.Y, 50, 50)
'desk.DrawRecta ngle(New Pen(Color.Black , 10), rc)
'I tried this, but.. it produce an error: "error BC30491:
Expression does not produce a value."
'Call Form1_Paint(des k, desk.DrawRectan gle(New Pen(Color.Black ,
10), rc))
End Sub

Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles Me.MouseMove
mymouse.MousePo s = New Point(e.X, e.Y)
End Sub
Private Sub Form1_Paint(ByV al sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles Me.Paint

End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
desk.DrawRectan gle(New Pen(Color.Black , 10), rc)
End Sub 'OnPaint
End Class

############### ############### ############### ############### ###############

Greets, Lucas
Oct 7 '06 #4
Create a bitmap and draw on it and then use it as your background image.
But the Overrides onpaint event should persist the drawing
Oct 8 '06 #5

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

Similar topics

0
3423
by: Otie | last post by:
I have a circle that displays information in 1-degree increments - there are 90 such increments that comprise the circle. I need a pointer within the circle that rotates. The pointer must include areas to the left and right of the center line so that a person is better able to see when something is within 2 or 3 or 4 or 5 marks (degrees) of its neighbors. I can use a line and get it to rotate - that is no problem. The problem is drawing an...
6
4052
by: James dean | last post by:
I have heard that the video drivers in GDI+ are a big performance issue. But is this only an issue with something like Games Programming i think...is this wrong?. What about a drawing application just drawing simple one dimensional shapes(Polygons,beziers,polylines etc...) are these video drivers still useful for this?. If the video drivers are not a problem then is there any other performance problems that would be disastrous for a...
1
5319
by: James dean | last post by:
Could someone explain how this works. I think the graphics card is used to do blitting and drawing shapes like rectangles. How does it draw using the Graphics card on the PC and why is this feature left out of GDI+?. *** Sent via Developersdex http://www.developersdex.com ***
6
6273
by: James dean | last post by:
I want a good site that will show clearly how much more functionality GDI+ has. I cannot seem to find anything other than sites that list "some" of the new functionality that GDI+ offers. A comprehensive list would be great.... *** Sent via Developersdex http://www.developersdex.com ***
7
2935
by: | last post by:
We create VC++ programs that does some GDI drawing functionality. I discovered GDI+ and this seems to be a big step forward, and appears to be standard available in Windows XP and Windows Server 2003. But since .NET also uses it, does that mean that it gets automatically installed when I install a .NET framework on a Windows 2000?
5
1687
by: Michel | last post by:
How to force the redrawing of a Form?
0
4739
by: Brian Keating | last post by:
hi there i've a test program that creates a treeview and destroys it over and over, i keep track of the gdi object count for the process and see if they are ok. However when i switch on checkboxes for my test app i get a gdi handle leak anyone got any ideas on this one? using System;
7
5974
by: Marcin Rzeznicki | last post by:
Hello, Do you think it is legitimate practice to mix GDI+ and GDI calls (via Get/ReleaseHDC()) in paint event of a control? I've heard there is possibility of performance loss while "locking" Graphics object which is done as a side-effect to GetHDC() call - could you confirm? Another question that comes to my mind when planning mentioned operation is: if the control painted on uses double-buffering style, will GDI calls make use of "back...
2
2435
by: Khadim | last post by:
Friends, The problem I am facing is that when my form resizes or is loaded (invalidated), the background image of my form (which i have drawn through GDI+ and also by putting a picture box on the form) is redrawn several times which cause it to flicker a lot. setstyles(controlstyles.doublebuffer, true ) didn't solved my problem. I have 8 panels, 2 listviews and a few text boxes. All panels are transparent so the portions of background...
5
3636
by: Jonathan Boivin | last post by:
Hi, I've got some problems with loading bills using a bill usercontrol I built. If I load all current bills in my test environment (156) everything is fine once, but repeating the operation (which clear all the bills and reshow all of them) four to five times and I get a Error creating window handle. I investigated on all of this, a lot, and still I'm not able to find where this problem come from. I know that the GDI objects column in...
0
8375
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
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8482
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,...
0
8593
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
7306
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...
1
6161
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
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
2
1593
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.