在CE反走样的DrawLineCE、DrawLine

2023-09-03 13:48:48 作者:人从了心就怂了

我画一条线,在Windows CE的一个图形对象使用C#.NET 3.5。

I am drawing a line to a Graphics object in Windows CE using C#.NET 3.5.

在code我使用看起来像这样:

The code I am using looks like this:

e.Graphics.DrawLine(new Pen(Color.FromArgb(11, 118, 200), 2), x1, y1, x2, y2);

这工作但是看起来很可怕,由于锯齿状等反正我有可以借鉴的反走样线?

This works however looks terrible due to jaggies etc. Is there anyway I can draw anti aliased lines?

从我可以告诉图形对象不支持它,但是反正是有使用一些挂羊头卖狗肉欺骗这样的效果?

From what I can tell the Graphics object doesn't support this natively but is there anyway to "cheat" this effect using some trickery?

推荐答案

如果你正在绘制一个纯色背景的快速诀窍,你可以画一个较厚的笔线和背景颜色和之间的颜色线的颜色前的实际行,例如,在黑色背景上绘制时:

A fast trick if you're drawing on a solid color background, you can draw a line with a thicker pen and a color in between the background color and the line color prior to the actual line, for instance, when drawing on a black background:

e.Graphics.DrawLine(new Pen(Color.FromArgb(5, 59, 100), 3), x1, y1, x2, y2);
e.Graphics.DrawLine(new Pen(Color.FromArgb(11, 118, 200), 2), x1, y1, x2, y2);

这增加了一个发光的线(甚至在完美的水平/垂直线条虽然)。

This adds a "glow" to the line (even on perfect horizontal / vertical lines though).