Results 1 to 5 of 5

Thread: Anything Faster than Picture1.Refresh???

  1. #1
    Guest
    I'm looking for speed here, and I need to refresh a picturebox as fast as possible.

    Please post any alternatives to the .Refresh property!!

    Thanks,

    Jordan

  2. #2
    Guest
    anything?

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    there's the redraw window API, it may be slightly faster
    Code:
    Declare Function RedrawWindow Lib "user32" Alias (ByVal hwnd As Long, lprcUpdate As RECT, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
    I've never bothered using it before so I don't know exactly how, I recon you can Ignore hRgnUpdate and fuRedraw, and that hWnd is the hWnd of the picture box you need to refresh and lprcUpdate is the rectangle you want to update (so you don't have to refresh the whole thing) if you set lprcUpdate to 0 then it'll probably do the whole thing.

  4. #4
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    Yeah, If you set lprcUpdate to vbNull, hrgnUpdate to vbNull and fuRedraw to 0, it redraws the entire client area. It might be faster to update just a rectangle (in lprcUpdate), but this depends on what you are doing.
    Courgettes.

  5. #5
    Guest
    Send the WM_PAINT message. It's 3-4 times faster.

    Code:
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Const WM_PAINT = &HF
    
    Private Sub Command1_Click()
        SendMessage Picture1.hwnd, WM_PAINT, Picture1.hDC, 0
    End Sub

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