Results 1 to 4 of 4

Thread: [RESOLVED] picture help

  1. #1

    Thread Starter
    Hyperactive Member Rattled_Cage's Avatar
    Join Date
    Dec 2005
    Posts
    315

    Resolved [RESOLVED] picture help

    could anyone direct me to a way of removing all the whiteness in a picture box from so i can drag it over another picture box with transparency

    ive uploaded a picture of some eyes as an example
    Attached Images Attached Images  

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: picture help

    One way is to use a UserControl, any color in the image that matches the MaskColor should appear transparent.

    Code:
    Option Explicit ' UserControl code
    ' Add an image to the UserControl Picture property.
    Private Sub UserControl_Initialize()
        UserControl.BackStyle = 0 ' transparent UC
        Redraw
    End Sub
    
    Public Sub Redraw()
        UserControl.MaskColor = vbWhite ' Make white transparent
        UserControl.Picture = UserControl.Image
        Set UserControl.MaskPicture = UserControl.Image
    End Sub
    Or using a picbox inside the control,
    Code:
    Option Explicit ' UserControl code
    ' Add an image to Picture1 picture property.
    Private Sub UserControl_Initialize()
        Picture1.BorderStyle = 0
        Picture1.Visible = False ' hide the pic box
        UserControl.BackStyle = 0 ' transparent UC
        Redraw
    End Sub
    
    Public Sub Redraw()
        UserControl.Cls
        UserControl.MaskColor = vbWhite ' Make white transparent
        UserControl.Picture = Picture1.Image
        Set UserControl.MaskPicture = Picture1.Image
    End Sub
    BTW, You'd need to clean up your eyes image, that white area needs to be a solid color.
    Last edited by Edgemeal; Oct 19th, 2008 at 09:06 PM. Reason: UPDATED

  3. #3

    Thread Starter
    Hyperactive Member Rattled_Cage's Avatar
    Join Date
    Dec 2005
    Posts
    315

    Re: picture help

    thanks verry much for your answer

    will this only work with .gif

  4. #4
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: picture help

    Quote Originally Posted by Rattled_Cage
    thanks verry much for your answer

    will this only work with .gif
    Should work with any image that the picture property supports.

    If you use a Gif that has transparency you could use VBs Image control.
    Last edited by Edgemeal; Oct 19th, 2008 at 11:07 PM.

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