Results 1 to 5 of 5

Thread: [RESOLVED] LaVolpe AlphaImgControl - Capture Picbox To AIC...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2013
    Posts
    127

    Resolved [RESOLVED] LaVolpe AlphaImgControl - Capture Picbox To AIC...

    I have controls inside a PictureBox. I am capturing the PictureBox with controls as an Image and would like to set that image to the AlphaImgControl, but it keeps telling me that it's an invalid picture. Need the captured image in the AlphaImgControl and would like to do so without file-saving. Any ideas?

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: LaVolpe AlphaImgControl - Capture Picbox To AIC...

    If picbox AutoRedraw is set true, try passing: picbox.Image. Otherwise, show the code you are using to assign it to the AIC
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2013
    Posts
    127

    Re: LaVolpe AlphaImgControl - Capture Picbox To AIC...

    Code:
    Private Declare Function SendMessage Lib "USER32" Alias _
       "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
       ByVal wParam As Long, ByVal lParam As Long) As Long
    
    Private Const WM_PAINT = &HF
    Private Const WM_PRINT = &H317
    Private Const PRF_CLIENT = &H4&    ' Draw the window's client area
    Private Const PRF_CHILDREN = &H10& ' Draw all visible child
    Private Const PRF_OWNED = &H20&    ' Draw all owned windows
    Code:
    Dim rv As Long
    
    Picture2.AutoRedraw = True
    rv = SendMessage(Picture1.hWnd, WM_PAINT, Picture2.hDC, 0)
    rv = SendMessage(Picture1.hWnd, WM_PRINT, Picture2.hDC, PRF_CHILDREN + PRF_CLIENT + PRF_OWNED)
        
    Set Picture2.Picture = Picture2.Image
    The following gives me the error "Invalid Picture"
    Code:
    Alpha.Picture = LoadPictureGDIplus(Picture2.Picture)

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: LaVolpe AlphaImgControl - Capture Picbox To AIC...

    When a picture property is passed, the control attempts to use the picture's function .SaveAsFile to write the image to a stream. I've had intermittent failures with that function failing to return a stream. In your case, the solution is easier since no transparency is in play... Pass the bitmap handle:
    Alpha.Picture = LoadPictureGDIplus(Picture2.Picture.Handle)
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2013
    Posts
    127

    Re: LaVolpe AlphaImgControl - Capture Picbox To AIC...

    Thank You!!!

Tags for this Thread

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