Rounded borders Rectangle

  • Thread starter Thread starter Carlo, MCP
  • Start date Start date
C

Carlo, MCP

Hello

I'm having lot of problems in writing a method that returns a Path for a
rounded corners rectangle for drawing a non-rectangular border.
The resulting path is ok for using with FillPath method, but applied to a
DrawPath method the resulting non-rectangular rectangle is wrong.
Applying a Pen to my path, the resulting non-rectangluar rectangle results
cut by 1 pixel in width and 1 pixel in height. Currently, I'm using a
Pen.Alignment=Inset. I observed errors with an even value in the width of
the pen (1, 3, 5, ...).

Does someone has some lines of code that may help me to draw a
non-rectangular border?

TIA

Carlo
 
You should be handling the WM_NCCREATE and WM_NCPAINT messages to set up
your non-client areas in which to draw your border.

For rounded rectangle code see the GDI+ FAQ.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Back
Top