PDA

Click to See Complete Forum and Search --> : Screen Eraseing


deoblo1
Oct 3rd, 2000, 09:26 PM
ok I have a Picture box and I am useing the api

Private Declare Function LineTo Lib "gdi32" _
(ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long) As Long

to do my lines, so I do
dim RC as long

RC = LineTo(Picture1.hdc,100,100)

when I minimize, or move something over it, the line erases. I have a button to draw a line, and the function looks like this:

Picture1.AutoRedraw = False
Dim rc As Long
rc = LineTo(Picture1.hdc, 100, 100)
Picture1.AutoRedraw = True

but yet the pic still gets erased, any ways to stop this?

PaulLewis
Oct 3rd, 2000, 09:38 PM
If you set AutoRedraw to false then the line will be drawn on the pictureBox but when the pictureBox is next refreshed (i.e. repainted) the line will disappear.

If you want the line to stay, Set AutoRedraw=True in the property of the picturebox or at the top of your sub.

Then after calling LineTo, call Picture1.Refresh to force VB to re-paint the PictureBox (VB doesn't know that an API call was made to do something in the PictureBox DC).

Hope it helps.