שתף באמצעות


Vb.net - Opacity Panel

Question

Sunday, January 27, 2013 7:16 AM

Hi everyone

         I have a form that has 3 panels, and 1 textbox inside the panel, i want all the panel to be transparent or opacity into 50% without taking changes or make the textbox to opacity in 50%. I'm using Visual Basic .Net 2010

thanks and regards.

All replies (5)

Sunday, January 27, 2013 8:11 AM ✅Answered | 1 vote

You can mess around with this. In my form in the image I have a panel with 3D background and a button on it. It is mostly transparent except for the red tint.

 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Panel1.BackColor = Color.FromArgb(25, Color.Red)
    End Sub

You've taught me everything I know but not everything you know.


Sunday, January 27, 2013 8:16 AM ✅Answered | 1 vote

This works too

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Panel1.BackColor = Color.FromArgb(200, 100, 100, 100)
    End Sub

You've taught me everything I know but not everything you know.


Sunday, January 27, 2013 8:36 AM ✅Answered | 1 vote

You could even do this for testing to see what colors you like.

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Panel1.BackColor = Color.FromArgb(200, 100, 100, 100)
    End Sub

    Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    End Sub

    Private Sub Panel2_Paint(sender As Object, e As PaintEventArgs) Handles Panel2.Paint

    End Sub

    Private Sub VScrollBars_Scroll(sender As Object, e As ScrollEventArgs) Handles VScrollBar1.Scroll, VScrollBar2.Scroll, VScrollBar3.Scroll, VScrollBar4.Scroll
        Panel1.BackColor = Color.FromArgb(VScrollBar1.Value, VScrollBar2.Value, VScrollBar3.Value, VScrollBar4.Value)
        Label1.Text = VScrollBar1.Value.ToString
        Label2.Text = VScrollBar2.Value.ToString
        Label3.Text = VScrollBar3.Value.ToString
        Label4.Text = VScrollBar4.Value.ToString
    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

    End Sub

    Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click

    End Sub

    Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click

    End Sub
End Class

You've taught me everything I know but not everything you know.


Tuesday, October 4, 2016 7:08 AM

Its Not Working  Please check the code


Tuesday, October 4, 2016 9:26 PM

Its Not Working  Please check the code

You don't display any code to check. You are piggybacking off a 3 year old thread created by Aron29 so if you have a question create your own question thread. The code works for me.

Option Strict On

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Location = New Point(CInt((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Me.Width / 2)), CInt((Screen.PrimaryScreen.WorkingArea.Height / 2) - (Me.Height / 2)))
        Panel1.BackColor = Color.FromArgb(60, 255, 0, 0)
    End Sub

End Class

La vida loca