steve
steve

Reputation: 1

Overriding OnPaint: Drawing more than one rectangle

Can anyone provide me C# code to fill two rectangles in override onpaint method.Here I'm trying to create a messagebox dialog which has a message title topbar and message text.

Upvotes: 0

Views: 477

Answers (2)

Justin
Justin

Reputation: 86799

Well, there is a short article on MSDN on How to draw a filled rectangle - if you want to draw two rectangles then do that twice! Note that if you are handling the OnPaint event there is no need to call CreateGraphics as a Graphics object is passed to you in the event arguments.

However it sounds like you shouldn't need to do any of this. You should be able to do what you are asking with standard forms and controls (or possibly just the MessageBox class)

Can you elaborate slightly more on what it is you need to do in your dialog?

Upvotes: 0

SLaks
SLaks

Reputation: 888283

Call e.Graphics.FillRectangle twice.

Upvotes: 1

Related Questions