2017年11月2日 星期四

[ VB2010 ] - 繪製線條


源自於
http://www.svbr8.url.tw/Prg_Coding/VB/Middle/Drawing/VB_00_00_VB2010/doc.php


Graphics.DrawLine(Pen物件, X1, Y1, X2, Y2)


Public Class Form1
    Dim Painting As Bitmap

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Painting = New Bitmap(200, 100)
        Dim G As Graphics = Graphics.FromImage(Painting)
        Dim Idx As Integer

        For Idx = 1 To 100 Step 3
            G.DrawLine(Pens.White, 0, Idx, 200, Idx)
            G.DrawLine(Pens.Gray, 0, Idx + 1, 200, Idx + 1)
            G.DrawLine(Pens.Black, 0, Idx + 2, 200, Idx + 2)
        Next

        G.DrawLine(New Pen(Brushes.Red, 7), 30, 1, 10, 100)
        G.DrawLine(New Pen(Brushes.Orange, 6), 27, 1, 20, 100)
        G.DrawLine(New Pen(Brushes.Yellow, 5), 24, 1, 30, 100)
        G.DrawLine(New Pen(Brushes.Green, 4), 21, 1, 40, 100)
        G.DrawLine(New Pen(Brushes.Blue, 3), 18, 1, 50, 100)
        G.DrawLine(New Pen(Brushes.Indigo, 2), 15, 1, 60, 100)
        G.DrawLine(Pens.Purple, 12, 1, 70, 100)
        G.DrawLine(Pens.Black, 9, 1, 80, 100)
        G.DrawLine(Pens.Gray, 6, 1, 90, 100)
        G.DrawLine(Pens.White, 3, 1, 100, 100)

        Me.BackgroundImageLayout = ImageLayout.None
        Me.BackgroundImage = Painting
    End Sub

End Class

沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...