我在TabPage标头上显示的图像的图像质量有问题。我的源图像是具有透明性的16x16 png。当我将其加载到TabPage标头中时,质量非常糟糕。到目前为止,我能想到的最好的方法是使用8位png而不是32位png。这有很大帮助,但是质量仍然不如我想要的好,并且仍然不如32位png好。有没有人能保持png品质的好方法?
(左侧为32位原始文件。右侧为32位制表符标头,质量较低。)
(左侧为8位原稿。右侧为8位制表符标头,质量较低。)
(左侧为32位原稿。右侧为8位制表符标头,质量较低。)
我正在尝试/希望使其尽可能接近原始32位png。
我正在使用以下代码:
using System.Drawing;
using System.Windows.Forms;
public class Form1
{
public void Form1()
{
InitializeComponent();
// initialize the imagelist
ImageList imageList1 = new ImageList();
imageList1.Images.Add("key1", Properties.Resources.Image1png);
imageList1.Images.Add("key2", Properties.Resources.Image2png);
//initialize the tab control
TabControl tabControl1 = new TabControl();
tabControl1.Dock = DockStyle.Fill;
tabControl1.ImageList = imageList1;
tabControl1.TabPages.Add("tabKey1", "TabText1", "key1");
tabControl1.TabPages.Add("tabKey2", "TabText2", "key2");
this.Controls.Add(tabControl1);
}
}
不知道这是否能回答您的问题,但必须将其发布为答案以包括快照。
您可以尝试以下操作:
或者只是在代码中更改它:
imageList1.ColorDepth = ColorDepth.Depth32Bit;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句