Rounded borders Rectangle

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
 
B

Bob Powell [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top