2017年12月11日 星期一

[ VB2010 ] - 繪製線條

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(400, 400)
        Dim G As Graphics = Graphics.FromImage(Painting)
        Dim Idx As Integer
        For Idx = 1 To 400 Step 5
            G.DrawLine(Pens.Navy, 0, Idx, 400, Idx)
        Next


        For Idx = 1 To 400 Step 50
            G.DrawLine(New Pen(Brushes.Red, 5), Idx, 0, Idx, 400)
        Next

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

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
End Class

沒有留言:

張貼留言

WOKWI LED + MQTT Node-Red SQLite

WOKWI LED + MQTT Node-Red SQLite const char *mqtt_broker = "broker.mqtt-dashboard.com" ; const char *topic1 = "alex9ufo/e...