Needless to say, my GooglFu is weak today.
I have a small WinForm, that has, as it's background, an asymmetrical image. To accommodate this image, the form itself is a bit larger than the image itself.
I have the forms background color set to LightSalmon as well as the form's TransparencyKey.
I don't think it's totally necessary to post the code (I think it came from CodeProject) that does this little bit, but, just in case, I have included it as well.
The FadeIn:
private void opTimer_Tick(object sender, EventArgs e)
{
if (opacityIncrease > 0)
{
if (this.Opacity < 1)
this.Opacity += opacityIncrease;
}
else
{
if (this.Opacity > 0)
this.Opacity += opacityIncrease;
else
this.Close();
}
}
The FadeOut (called on formClosing event)
public void FadeForm()
{
opacityIncrease = -opacityDecrease;
}
The code works as it should, but, the problem lies when the form is fading in and out. As the form fades in, I can see the forms background, that awful LightSalmon. Once the form has reached full Opacity, the background is, indeed, fully transparent.
Is there a way to keep the TransparencyKey color (the forms background), well, Transparent during the fade-in/out?
The easiest solution would be to change the forms background image to one that fit's the form without having to bother with the whole TransparencyKey business, but, I rather like the image that I am using, but, it's certainly not a ShowStopper to change it to something else.
Using VS2008, .NET 3.5
As always, happy to answer any follow-up questions if necessary.
Thanks.