本文整理汇总了VB.NET中System.Drawing.Pen.Pen构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET Pen构造函数的具体用法?VB.NET Pen怎么用?VB.NET Pen使用的例子?那么, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Drawing.Pen
的用法示例。
在下文中一共展示了Pen构造函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ShowLineJoin
Private Sub ShowLineJoin(ByVal e As PaintEventArgs)
' Create a new pen.
Dim skyBluePen As New Pen(Brushes.DeepSkyBlue)
' Set the pen's width.
skyBluePen.Width = 8.0F
' Set the LineJoin property.
skyBluePen.LineJoin = Drawing2D.LineJoin.Bevel
' Draw a rectangle.
e.Graphics.DrawRectangle(skyBluePen, _
New Rectangle(40, 40, 150, 200))
'Dispose of the pen.
skyBluePen.Dispose()
End Sub
示例2: Pen
Private Sub Button3_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button3.Click
Dim buttonGraphics As Graphics = Button3.CreateGraphics()
Dim myPen As Pen = New Pen(Color.ForestGreen, 4.0F)
myPen.DashStyle = Drawing2D.DashStyle.DashDotDot
Dim theRectangle As Rectangle = Button3.ClientRectangle
theRectangle.Inflate(-2, -2)
buttonGraphics.DrawRectangle(myPen, theRectangle)
buttonGraphics.Dispose()
myPen.Dispose()
End Sub
示例3: 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