I am ShowDialoging one form in which the activate event increases the opacity from 0 to 1. I set the opacity to 0 in it's constructor.The problem is that during the showing of the form it becomes black.
And after it's opacity becomes one it becoems the normal color (Control).
The code is as follows
I wanted to show the screenshot but when i print-screen while it is black and paste it in MS Paint it shows the normal way !
Tha's weird.How to get around this ?
EDIT:I found the solution.The thread is Sleeping so how would it display the opacity changed form !
I used this.Refresh(); before the sleep and it worked.
And after it's opacity becomes one it becoems the normal color (Control).
The code is as follows
Code:
public Form1()
{
InitializeComponent();
this.Opacity = 0;
}
private void Form1_Activated(object sender, EventArgs e)
{
while (this.Opacity < 1)
{
this.Opacity += .01;
Thread.Sleep(100);
}
}
I wanted to show the screenshot but when i print-screen while it is black and paste it in MS Paint it shows the normal way !
Tha's weird.How to get around this ?
EDIT:I found the solution.The thread is Sleeping so how would it display the opacity changed form !
I used this.Refresh(); before the sleep and it worked.
Comment