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 h开发者_高级运维as a message title topbar and message text.
Call e.Graphics.FillRectangle
twice.
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?
精彩评论