pencaps.vb
来自「Samples are organized by chapter, and th」· VB 代码 · 共 54 行
VB
54 行
Imports System.Drawing.Drawing2D
Public Class PenCaps
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
Me.Text = "PenCaps"
End Sub
#End Region
Private Sub PenCaps_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim MyPen As New Pen(Color.Blue, 10)
Dim y As Integer = 20
Dim Cap As LineCap
For Each Cap In System.Enum.GetValues(GetType(LineCap))
MyPen.StartCap = Cap
MyPen.EndCap = Cap
e.Graphics.DrawLine(MyPen, 20, y, 100, y)
e.Graphics.DrawString(Cap.ToString(), New Font("Tahoma", 8), Brushes.Black, 120, y - 10)
y += 30
Next
End Sub
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?