Smooth edges are not rectangular in .NET.

I created a rounded shape using Form.Region. This works, but unfortunately rounding seems rude. Are there any tricks to smooth out such shape angles? I know that many applications support this, just not sure how to do it in .NET.

Thanks guys.

+6
forms winforms drawing smoothing
source share
2 answers

There is nothing good about it; regions cannot be smoothed out. This is inevitable, anti-aliasing only works when you know the background colors so that you can blend correctly. This is not an option for windows; the design background is unpredictable. If this is a splash, you can fake it by taking a screenshot and drawing a fake window on top of it. Not working for more than a few seconds.

It is best to keep the angle within a small radius so that it is not noticeable. Also use the ZoomIt tool from SysInternals and carefully look at the rounded corners of the program, for example, Windows Media Player. Pay attention to the gray tones that he uses to draw the border.

+7
source share

From what I read on the Internet, most people end up redefining the onpaint event forms and drawing the region there. This allows them to use GDI + with smoothing and make it much cleaner.

Examples I found:

http://netcode.ru/dotnet/?lang=&katID=30&skatID=283&artID=7833 http://www.xtremevbtalk.com/showthread.php?t=288178

+5
source share

All Articles