本文整理汇总了VB.NET中System.Drawing.Pen.DashPattern属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Pen.DashPattern属性的具体用法?VB.NET Pen.DashPattern怎么用?VB.NET Pen.DashPattern使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Drawing.Pen
的用法示例。
在下文中一共展示了Pen.DashPattern属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ShowPensAndSmoothingMode
Private Sub ShowPensAndSmoothingMode(ByVal e As PaintEventArgs)
' Set the SmoothingMode property to smooth the line.
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
' Create a new Pen object.
Dim greenPen As New Pen(Color.Green)
' Set the width to 6.
greenPen.Width = 6.0F
' Set the DashCap to round.
greenPen.DashCap = Drawing2D.DashCap.Round
' Create a custom dash pattern.
greenPen.DashPattern = New Single() {4.0F, 2.0F, 1.0F, 3.0F}
' Draw a line.
e.Graphics.DrawLine(greenPen, 20.0F, 20.0F, 100.0F, 240.0F)
' Change the SmoothingMode to none.
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.None
' Draw another line.
e.Graphics.DrawLine(greenPen, 100.0F, 240.0F, 160.0F, 20.0F)
' Dispose of the custom pen.
greenPen.Dispose()
End Sub
示例2: LineDashCap
' 导入命名空间
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class LineDashCap
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
public class Form1
Inherits System.Windows.Forms.Form
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = Me.CreateGraphics()
g.Clear(Me.BackColor)
Dim blackPen As New Pen(Color.Black, 10)
blackPen.DashStyle = DashStyle.DashDotDot
blackPen.DashPattern = New Single() {10}
blackPen.DashCap = DashCap.Triangle
g.DrawLine(blackPen, 20, 10, 500, 10)
blackPen.DashCap = DashCap.Flat
g.DrawLine(blackPen, 20, 30, 500, 30)
blackPen.DashCap = DashCap.Round
g.DrawLine(blackPen, 20, 50, 500, 50)
blackPen.Dispose()
g.Dispose()
End Sub
Public Sub New()
MyBase.New()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
End Sub
End Class