Results 1 to 4 of 4

Thread: Transpaernt Picture Box

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    Transpaernt Picture Box

    Dears,

    How can i make a Picturebox Transparent. Please suggest the way

  2. #2
    Lively Member agent_007's Avatar
    Join Date
    Jan 2010
    Posts
    93

    Re: Transpaernt Picture Box

    Quote Originally Posted by hafizfarooq View Post
    Dears,

    How can i make a Picturebox Transparent. Please suggest the way
    piturebox cannot be made tranparent they can only be made invisible use image control instead it is transparent

    Im Pro in C#,VB.NET,Batch,Socket Programming, SPY Software Programming, VB6, Win32Api, VBscript, Windows Registry, ASP.NET, PHP, Jquery, AJAX.

  3. #3
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Transpaernt Picture Box

    Quote Originally Posted by hafizfarooq View Post
    Dears,

    How can i make a Picturebox Transparent. Please suggest the way
    This question was asked for several times.... Do a search on the forum....
    Click here to search

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  4. #4
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    Re: Transpaernt Picture Box

    IMO, the easiest way to achieve transparency is to use a UserControl, which
    has the MaskPicture and MaskColor properties. The code below only exposes
    two properties, Picture and MaskColor. Add a new UserControl to your project and
    insert the code below. Once you have sited it on a form, assign a picture. Then
    assign a MaskColor and that will be the transparent color.

    As written, this does nothing more than display the picture. You will likely want to
    assign some PictureBox events, such as MouseDown, etc.

    Code:
    Option Explicit
    Private Sub UserControl_InitProperties()
     BackStyle = 0 'transparent
     MaskColor = vbMagenta
    End Sub
    Public Property Get MaskColor() As OLE_COLOR
     MaskColor = UserControl.MaskColor
    End Property
    Public Property Let MaskColor(ByVal New_MaskColor As OLE_COLOR)
     UserControl.MaskColor() = New_MaskColor
     PropertyChanged "MaskColor"
    End Property
    Public Property Get Picture() As Picture
     Set Picture = UserControl.Picture
    End Property
    Public Property Set Picture(ByVal New_Picture As Picture)
     Set UserControl.Picture = New_Picture
     Set UserControl.MaskPicture = New_Picture
     'remove if you don't want autosize
     Width = ScaleX(Picture.Width, vbHimetric, vbPixels) * Screen.TwipsPerPixelX
     Height = ScaleY(Picture.Height, vbHimetric, vbPixels) * Screen.TwipsPerPixelY
     PropertyChanged "Picture"
    End Property
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
     UserControl.MaskColor = PropBag.ReadProperty("MaskColor", vbMagenta)
     Set Picture = PropBag.ReadProperty("Picture", Nothing)
     Set UserControl.MaskPicture = UserControl.Picture
    End Sub
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
     Call PropBag.WriteProperty("MaskColor", UserControl.MaskColor, vbMagenta)
     Call PropBag.WriteProperty("Picture", Picture, Nothing)
    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