白色背景图 显示这个正常的,白色被掩盖了。
图片出现在黑色背景上出很严重的锯齿边缘。用的是TransparencyKey ,这个有什么办法解决吗?
this.TransparencyKey = System.Drawing.Color.White;
白色背景图 显示这个正常的,白色被掩盖了。
图片出现在黑色背景上出很严重的锯齿边缘。用的是TransparencyKey ,这个有什么办法解决吗?
this.TransparencyKey = System.Drawing.Color.White;
1. 控件OnPaint时设置高质量、抗锯齿
g.CompositingMode = CompositingMode.SourceOver;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.SmoothingMode = SmoothingMode.AntiAlias;
2. 设置控件支持透明背景,无解。
SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
this.BackColor = Color.Transparent;
3. 设置控件支持透明背景方法2,无解。
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARENT
return cp;
}
}