在.NET非矩形形式平滑边缘 [英] Smooth edges of non-rectangular form in .NET

查看:210
本文介绍了在.NET非矩形形式平滑边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Form.Region圆角创建的窗体。它的工作原理,但遗憾的是四舍五入出现粗糙。是否有任何技巧平滑如异形窗体的角落?我知道很多应用程序都支持这一点,只是不知道如何使它在.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.

谢谢你们。

推荐答案

目前对此并没有很好的修复,区域不能消除锯齿。当你知道背景颜色,这是不可避免的,抗锯齿只能这样你就可以正确地融为一体。这不是一个Windows选项,背景是由设计未predictable。如果这是一个启动画面,那么你就可以伪造它,采取了截屏的背景,并在它上面绘制你的假窗。将不超过几秒钟的工作

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.

做的最好的事情就是保持圆角半径小,所以它不是那么明显。还可以使用像Sysinternals的Z​​oomIt的一个工具,仔细看看Windows Media Player等程序的圆角。需要注意的灰色调,使用它来绘制边界。

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.

这篇关于在.NET非矩形形式平滑边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆