Jump to content

C# form opacity help

WolfDeville
Go to solution Solved by madknight3,
 

WinForms

 

The forms Opacity property works fine for me.

public partial class Form1 : Form{    public Form1()    {        InitializeComponent();    }    private void button1_Click(object sender, EventArgs e)    {        this.Opacity = 0.5;    }}

Hallo,

 

I'm working on application and I need to be able to change the opacity of Form1 with the click of a button but everything I've tried doesn't work. I'd like to do this without having to create a new Form if possible.

 

Cheers.

Link to comment
Share on other sites

Link to post
Share on other sites

What are your current attempts? it shouldn't be hard in theory.

Link to comment
Share on other sites

Link to post
Share on other sites

 

WinForms

 

The forms Opacity property works fine for me.

public partial class Form1 : Form{    public Form1()    {        InitializeComponent();    }    private void button1_Click(object sender, EventArgs e)    {        this.Opacity = 0.5;    }}
Link to comment
Share on other sites

Link to post
Share on other sites

What are your current attempts? it shouldn't be hard in theory.

I tried making a bool and a while loop in public Form1 that checks the status of the bool but it kept creating heaps of items in the system tray.

Link to comment
Share on other sites

Link to post
Share on other sites

 

 
 

 

The forms Opacity property works fine for me.

public partial class Form1 : Form{    public Form1()    {        InitializeComponent();    }    private void button1_Click(object sender, EventArgs e)    {        this.Opacity = 0.5;    }}

Son of a bitch... I was going to try this.opacity but I thought that would change the opacity of the button. I fucking love you bro haha cheers!

Link to comment
Share on other sites

Link to post
Share on other sites

Son of a bitch... I was going to try this.opacity but I thought that would change the opacity of the button. I fucking love you bro haha cheers!

Too basic C# lol.

Anyway, we are all here to learn.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×