Michael Breuer

Michael Breuer

  • NA
  • 4
  • 4.8k

OnPaint customize

Nov 17 2010 12:53 PM

I want to switch the OnPaint Method of a Button
1 custom
2 default
I can switch between several customs but I can noit get the default OnPaint by using this
 
public void ActivatePaintHandler(PaintEventHandler theHandler)
{
this.Paint -= oldPaintEventHandler;
if (null != theHandler)
{
this.Paint += theHandler;
}
}

 
I switch with
 

 
public static void getStyle(ControlButton theButton)
{
if (myStyleTheme == StyleTheme.Window)
{
theButton.ActivatePaintHandler(
new PaintEventHandler(theButton.OnPaint3));
}
else if (myStyleTheme == StyleTheme.one)
{
theButton.ActivatePaintHandler(
new PaintEventHandler(theButton.OnPaint2));
}
else
{
//***********************
// this is the paint handler which is located here
//***********************
theButton.ActivatePaintHandler(
new PaintEventHandler(OnPaint4));
}
}

 
how can I activate the base.OnPaint function ?
If I try it in my source I get an inifitite loop
 
Thank you

Answers (2)