是否可以更改PowerPacks.LineShape
平滑模式?
我尝试使用此代码(继承的类LineShape
):
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim g As Graphics = e.Graphics
' no difference when changing the SmoothingMode '
g.SmoothingMode = SmoothingMode.AntiAlias
Using pen As New Pen(Color.Blue, 3)
g.DrawLine(pen, X1, Y1, X2, Y2)
End Using
' MyBase.OnPaint(e) '
End Sub
我总是有相同的结果,如下所示: alt text http://lh6.ggpht.com/_1TPOP7DzY1E/S3v1IbxlbCI/AAAAAAADD4/q1Y9kP8wJ0g/s800/Capture2.png
=======
编辑
更新了测试:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim g As Graphics = e.Graphics
Dim oldmode As SmoothingMode = g.SmoothingMode
Using pen As New Pen(Color.Blue, 3)
g.SmoothingMode = SmoothingMode.AntiAlias
g.DrawLine(pen, X1, Y1, X2, Y2)
g.SmoothingMode = SmoothingMode.None
g.DrawLine(pen, X1 + 50, Y1, X2 + 50, Y2)
End Using
g.SmoothingMode = oldmode
g.Flush()
'MyBase.OnPaint(e)'
End Sub
结果(不考虑标签和圆圈):
替代文字 http://lh3.ggpht.com/_1TPOP7DzY1E/S447qYvTqzI/AAAAAAAADE8/eP3kCLqQJbk/s800/Capture2.png
显然平滑模式没有被忽视......