Delphi:绘制抗锯齿三角形
如何在 ListBoxDrawItem 上绘制抗锯齿三角形?
ListBox.Canvas.Polygon
绘制有锯齿。
谢谢!!!
How can I draw anti-aliased triangle on ListBoxDrawItem?
ListBox.Canvas.Polygon
draws with jags.
Thanks!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 GDI 实现抗锯齿绘图的最简单方法是绘制到更大的表面,然后在启用半色调拉伸模式的情况下缩小到原始尺寸。
下面的代码示例使用了一个比列表框的客户区大 16 倍的位图(这是一个相当大的位图,绘制起来会花费很多时间,但应该更容易看到效果)。
在下图中,左侧是 ListBox1 - 使用抗锯齿绘制的列表框。请注意,文本也获得了一些效果:
我当然建议您考虑 David 的建议之一。这段代码相当实验性:)。
The simplest approach to achieve anti-aliased drawing with GDI is to draw to a larger surface, then scale back to original dimensions having halftone enabled stretching mode.
Below code example uses a 16 times larger bitmap then the list box's client area (this is a considerably larger bitmap and it will take a good time to do the drawings, but the effect should be seen easier).
In the below picture, in the left is the ListBox1 - the one drawn with anti-aliasing. Please notice that the text also have gained some of the effect:
I would of course advise you to take one of David's suggestions into account. This code was rather experimental :).
没有内置任何东西可以进行抗锯齿。您可以使用 GDI+,但我会推荐 graphics32 ,它会愉快地绘制 graphics32 。 org/documentation/Docs/Units/GR32_Polygons/Routines/Polygon.htm" rel="nofollow">抗锯齿多边形。
There is nothing built in that will do anti-aliasing. You could use GDI+ but I would recommend graphics32 which will happily draw anti-aliased polygons.