Custom buttons and OnPaint Issues
Ok, so i am creating a custom shaped button and I am overriding the OnPaint method in the class and using regions within it to get the shape i wanted. this is is my over rode OnPaint
when i initially load the application with this custom button on it, the button region is black.
protected override void OnPaint(PaintEventArgs e)
GraphicsPath myGraphicsPath = new System.Drawing.Drawing2D.GraphicsPath();
myGraphicsPath.AddRectangle(new Rectangle(80, 0, 40, 40));
myGraphicsPath.AddRectangle(new Rectangle(40, 40, 80, 40));
myGraphicsPath.AddRectangle(new Rectangle(0, 80, 80, 40));
this.Region = new Region(myGraphicsPath);
when i mouse over it, it has what looks like one of the other buttons on my application sort of shadowing it.
click to see the image
On the image linked above, you can see that the top portion of that shape has half a button and is a different BG color than the rest of it.
Anyone have an idea why this happens?
I can pull the same stuff from about and put in an button_Paint method and re-assign the Paint function through the designer and it works fine. Is there something else I am missing when you override an OnPaint?