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.
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?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.