Results 1 to 2 of 2

Thread: Making Picturebox transparent,Set Alpha Channel Image

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Making Picturebox transparent,Set Alpha Channel Image

    Making Picturebox transparent(support PNG alpha)

    https://forums.codeguru.com/showthre...ox-transparent
    My transparent approach now is to let UserControl Transparent and supports container functionality
    Programming Challenge:How to make Picturebox1 control truly transparent.Remove the background color, set the transparency of the PNG channel as a background image function.
    Code:
    SetWindowLong Picturebox1.hwnd, GWL_EXSTYLE, GetWindowLong(Picturebox1.hwnd, GWL_EXSTYLE) Or WS_EX_TRANSPARENT
        Set mSubclass = New clsTrickSubclass
        mSubclass.Hook Me.hwnd
    VB6 Transparent Textbox By API(WM_CTLCOLOREDIT)
    https://www.vbforums.com/showthread.php?891144-VB6-Transparent-Textbox-By-API(WM_CTLCOLOREDIT)

    Quote Originally Posted by iPrank View Post
    @Napoleon,
    You can do so without regioning - by using a transparent usercontrol instead.

    1. Create a UserControl.
    2. Set it's ControlContainer = True and BackStyle = Transparent
    3. FILL the usercontrol with a Rounded Rectangle shape. (For smoother effect,set the Shape's BorderStyle to Transparent.)
    4. Set the shape's FillStyle to Solid.
    5. Now use this user control as the container of your WebBrowser Cotrol.


    PS. It is better idea to create a new thread (with link to the original one) rather than digging up an old one.
    (Possibly CodeBank threads are only exceptions)
    https://www.vbforums.com/showthread....e-Transparency
    Last edited by xiaoyao; Mar 29th, 2021 at 06:48 PM.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: Transparency Picturebox1 control,Set Transparent Channel Image

    Reference VB.NET,When loading the form, specify the background of PictureBox1 as transparent, and then specify PictureBox1 as the parent container of PictureBox2, so that PictureBox2 can be transparent to PictureBox 1 and both transparent to the form background. VB2010 environment. The code is as follows: The left side of the screenshot is the running effect, the right side is the programming environment, I hope you will be satisfied with this effect.
    Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            PictureBox1.BackColor = Color.Transparent
    
            PictureBox2.Parent = PictureBox1
    
        End Sub
    Transparent PictureBox Over Another PictureBox with Image
    https://social.msdn.microsoft.com/Fo...box-with-image
    Attached Images Attached Images  
    Last edited by xiaoyao; Mar 29th, 2021 at 06:40 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