简体   繁体   English

Windows窗体应用程序中的图像质量较差(无AA)

[英]poor image quality in windows forms app (no AA)

I have a Windows Forms app where I created a UserControl that consists of two Buttons and one Label. 我有一个Windows窗体应用程序,我在其中创建了一个由两个按钮和一个Label组成的UserControl。 The Buttons have an png with transparent Background assigned. 按钮具有分配了透明背景的png。

If I look at the UserControl in the Windows Forms Designer it looks great. 如果我在Windows窗体设计器中查看UserControl,它看起来很棒。 However, if I drop the UserControl onto a form it doesn't have it's smooth edges anymore. 但是,如果我将UserControl放到表单上,它就不再具有平滑的边缘。

Here are some screenshot to show what I mean: 这是一些截图,以显示我的意思:

替代文字替代文字

Does anyone know how to fix this? 有谁知道如何解决这一问题?

I tried the thing you have said.. I have few suggestions 我试过你说过的话......我的建议很少

  1. The png resolution might be a problem. png分辨率可能是个问题。
  2. VS version you are using 你正在使用的VS版本
  3. Also check whether you have docked the buttons in the usercontrol therefore when you resize it in your form the image quality might go down... (Not so sure) 还要检查是否已将按钮停靠在用户控件中,因此当您在表单中调整其大小时,图像质量可能会下降...(不太确定)

Anyway you can try with another image. 无论如何,您可以尝试使用其他图像。 Because when I tried this with my PNGs no problems occured. 因为当我用我的PNG尝试这个时没有出现任何问题。

From the looks of it, you are rescaling your PNG for few pixels down or up. 从它的外观来看,你可以向下或向上重新缩放你的PNG几个像素。 Try to see what will happen if you ensure that size on the screen is the size of the image itself. 如果您确保屏幕上的大小是图像本身的大小,请尝试查看会发生什么。

So, try to increase or decrease button sizes one pixel at a time and see what happens. 因此,尝试一次增加或减少一个像素的按钮大小,看看会发生什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM