user6782146 user6782146 - 3 months ago 30
Vb.net Question

PictureBox transparent in all tools in vb.net

How could I make the PictureBox transparent.

My work :

My work

I already set the PictureBox BackColour to transparent but still I cannot see the DataGridView also the TextBox beside status label.

Can some one help me to achieve like this.

I want to acheive :

I want to acheive

Thanks in advance :)

Answer

Setting background color to Transparent can lead to misunderstandings. The white colour that you see is the form background.

There is no way to make a control transparent without drawing the picture by yourself in the form's Paint event

EDIT:

Say you have a DataGridView1 control you want to draw the image on:

Private Sub DataGridView1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles DataGridView1.Paint

        ' Create image.
        Dim newImage As Image = Image.FromFile("pic.png")

        ' Adjust this as you need
        Dim x As Single = 100
        Dim y As Single = 50
        Dim width As Single = 100
        Dim height As Single = 100

        ' Draw image on top of the control
        e.Graphics.DrawImage(newImage, x, y, width, height)

    End Sub
Comments