What I like to do is use a UserControl rather than a picturebox.
Create a usercontrol and add the following propertiesNow to use it, draw it onto your form, let's call it MyControlVB Code:
Option Explicit Private Sub UserControl_Initialize() UserControl.BackStyle = 0 End Sub Public Property Get MaskColor() As Long MaskColor = UserControl.MaskColor End Property Public Property Let MaskColor(ByVal New_MaskColor As Long) 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 PropertyChanged "Picture" End Property Private Sub UserControl_ReadProperties(PropBag As PropertyBag) UserControl.MaskColor = PropBag.ReadProperty("MaskColor", vbWhite) Set Picture = PropBag.ReadProperty("Picture", Nothing) End Sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("MaskColor", UserControl.MaskColor, vbWhite) Call PropBag.WriteProperty("Picture", Picture, Nothing) End SubIf move over your existing controls you will see it has a transparent backgroundVB Code:
MyControl.MaskColor = vbWhite Set MyControl.Picture = LoadPicture("whatever.gif")




Reply With Quote