Sondre Garmo

Sondre Garmo

  • NA
  • 15
  • 0

Need to Invalidate my form

Jan 23 2006 7:15 AM

If I start my C# program and another program will come over my program window, some of my buttons will have a black background (ownmaked buttons with transparent background). If I minimize my program and then open it up the black background will be transparent. Also if I use 'this.Invalidate()' the background will be transparent.

If I start my C# program and no other programs will come over my program window, the buttons will have transparent background (ownmaked buttons with transparent background).
I'm using GDI to paint my buttons and to paint my backround on my form.

How can I call 'this.Invalidate' then I go (set focus) from another program to my program?
I will have transparent background on my buttons and not black, and with use of this.Invalidate() the buttons will get transparent background.



My solution to now: 

private void frmMyForm_MouseEnter(object sender, EventArgs e)

{

this.Invalidate();

}




Why doesn't the function under work in my form application?

protected override void OnGotFocus(EventArgs e)

{

base.OnGotFocus(e);

this.Invalidate();

}


I'm using:
Windows XP SP-2
Visual Studio 2005, C# (not express)
Net Framework 2.0


Sondre Garmo


Answers (1)