Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smooth edges of non-rectangular form in .NET

I've created a form with rounded corners using Form.Region. It works, but unfortunately the rounding appears rough. Are there any tricks for smoothing such shaped form corners? I know many applications support this, just not sure how to make it in .NET.

Thanks guys.

like image 445
SharpAffair Avatar asked Jan 18 '11 18:01

SharpAffair


1 Answers

There is no good fix for this, regions cannot be anti-aliased. This is inevitable, anti-aliasing only works when you know the background colors so you can blend properly. That's not an option for windows, the background is by design unpredictable. If this is a splash screen then you can fake it by taking a screen shot of the background and drawing your fake window on top of it. Won't work for more than a few seconds.

Best thing to do is to keep the corner radius small so it is not so noticeable. Also use a tool like SysInternals' ZoomIt and take a close look at the rounded corners of a program like Windows Media Player. Note the gray tones it uses to draw the border.

like image 200
Hans Passant Avatar answered Nov 16 '22 04:11

Hans Passant