|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Redrawing on GDI+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 iD8DBQFFJoLdRzxqsJWDX28RAjhnAJ49NAVO1I9dzei/eE0FIafct4k4IgCfQphu 3LVas32+wCDrEhXZ1/aIq90= =Mx3k -----END PGP SIGNATURE-----
Show quote
Hide quote
"Lucas Napzchyr" <lucas-napzc***@gmx.de> wrote in message Handle the "Paint" event of the form to do your painting.news:UnvVg.11975$Mv1.8996@newsfe04.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 > "Robinson" <toomuchspamhaspassed@myinboxtoomuchtoooften.com> schrieb: .... or override its 'OnPaint' method.>> 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. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Herfried K. Wagner [MVP] schrieb:
> "Robinson" <toomuchspamhaspassed@myinboxtoomuchtoooften.com> schrieb: ok thanks for u'r answers but it's not running.>>> 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. > (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.CreateGraphics() Dim test1 As System.Windows.Forms.PaintEventArgs Dim rc As Rectangle Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick mymouse.Click1Pos = New Point(e.X, e.Y) rc = New Rectangle(mymouse.Click1Pos.X, mymouse.Click1Pos.Y, 50, 50) 'desk.DrawRectangle(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(desk, desk.DrawRectangle(New Pen(Color.Black, 10), rc)) End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove mymouse.MousePos = New Point(e.X, e.Y) End Sub Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) desk.DrawRectangle(New Pen(Color.Black, 10), rc) End Sub 'OnPaint End Class ########################################################################### Greets, Lucas Create a bitmap and draw on it and then use it as your background image.
But the Overrides onpaint event should persist the drawing
vb 6.0 naar vb.net 2005
Dynamic mapping string to function Overlapping controls creating pictureboxes on the fly How to determen the object ? WEB combobox won't fire event NullReferenceException with shared members Website local/remote login Access My.Settings from class library crash at closue msvbvm60.dll |
|||||||||||||||||||||||