一个LinearGradientBrush神器解决方法? [英] LinearGradientBrush Artifact Workaround?

查看:686
本文介绍了一个LinearGradientBrush神器解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.NET中的一个LinearGradientBrush似乎有一个严重的错误:有时,介绍文物。 (请参见这里 - 本质上,第一行线性渐变在ENDCOLOR得出,即从白到黑的渐变将开始与一个黑线,然后用适当的白色到黑色渐变)

The LinearGradientBrush in .net (or even in GDI+ as a whole?) seems to have a severe bug: Sometimes, it introduces artifacts. (See here or here - essentially, the first line of a linear gradient is drawn in the endcolor, i.e. a gradient from White to Black will start with a Black line and then with the proper White to Black gradient)

我不知道如果有人发现这个工作解决方法吗?这是一个非常恼人的错误: - (

I wonder if anyone found a working workaround for this? This is a really annoying bug :-(

下面是文物的照片,请注意,有2 LinearGradientBrushes:

Here is a picture of the Artifacts, note that there are 2 LinearGradientBrushes:

推荐答案

我一直在使用渐变画笔时,注意到了这一点。唯一有效的解决方法我是始终创建比该地区的所有边即是要与被涂渐变画笔矩形1个像素大它,这可以让你免受所有四个边的问题。缺点是在边缘使用的颜色是关闭那些你指定的一小部分,但是这要比绘制神器问题的更好!

I have noticed this as well when using gradient brushes. The only effective workaround I have is to always create the gradient brush rectangle 1 pixel bigger on all edges than the area that is going to be painted with it. That protects you against the issue on all four edges. The downside is that the colors used at the edges are a fraction off those you specify, but this is better than the drawing artifact problem!

这篇关于一个LinearGradientBrush神器解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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