Results 1 to 2 of 2

Thread: Screen Eraseing

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    Question

    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?

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    AutoRedraw

    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.


    Paul Lewis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width