本文整理汇总了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