|
-
Jan 25th, 2010, 05:54 AM
#1
Thread Starter
Fanatic Member
Transpaernt Picture Box
Dears,
How can i make a Picturebox Transparent. Please suggest the way
-
Jan 25th, 2010, 06:00 AM
#2
Lively Member
Re: Transpaernt Picture Box
 Originally Posted by hafizfarooq
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.
-
Jan 25th, 2010, 07:08 AM
#3
Re: Transpaernt Picture Box
 Originally Posted by hafizfarooq
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,...
-
Jan 25th, 2010, 08:15 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|