本文整理匯總了VB.NET中System.Drawing.Graphics.DrawLine方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Graphics.DrawLine方法的具體用法?VB.NET Graphics.DrawLine怎麽用?VB.NET Graphics.DrawLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.DrawLine方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: DrawLinePointF
Public Sub DrawLinePointF(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create points that define line.
Dim point1 As New PointF(100.0F, 100.0F)
Dim point2 As New PointF(500.0F, 100.0F)
' Draw line to screen.
e.Graphics.DrawLine(blackPen, point1, point2)
End Sub
示例2: DrawLineInt
Public Sub DrawLineInt(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create coordinates of points that define line.
Dim x1 As Integer = 100
Dim y1 As Integer = 100
Dim x2 As Integer = 500
Dim y2 As Integer = 100
' Draw line to screen.
e.Graphics.DrawLine(blackPen, x1, y1, x2, y2)
End Sub
示例3: DrawLineFloat
Public Sub DrawLineFloat(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create coordinates of points that define line.
Dim x1 As Single = 100.0F
Dim y1 As Single = 100.0F
Dim x2 As Single = 500.0F
Dim y2 As Single = 100.0F
' Draw line to screen.
e.Graphics.DrawLine(blackPen, x1, y1, x2, y2)
End Sub
示例4: DrawLinePoint
Public Sub DrawLinePoint(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create points that define line.
Dim point1 As New Point(100, 100)
Dim point2 As New Point(500, 100)
' Draw line to screen.
e.Graphics.DrawLine(blackPen, point1, point2)
End Sub
示例5: Graphics.DrawLine(Pen p, Int x, Int y, Int x1, Int y1)
' 導入命名空間
Imports System
Imports System.Windows.Forms
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing.Imaging
Imports System.Drawing
Public Class MainClass
Shared Sub Main()
Dim bm As New Bitmap(256, 256)
' Draw on it.
Dim gr As Graphics = Graphics.FromImage(bm)
gr.Clear(Color.White)
gr.DrawEllipse(Pens.Red, 0, 0, bm.Width - 1, bm.Height - 1)
gr.DrawLine(Pens.Green, 0, 0, bm.Width - 1, bm.Height - 1)
gr.DrawLine(Pens.Blue, bm.Width - 1, 0, 0, bm.Height - 1)
' Save the result as a JPEG file.
bm.Save("test.gif", ImageFormat.Gif)
End Sub
End Class