2017年12月11日 星期一

[ VB2010 ] - 繪製矩形

[ VB2010 ] - 繪製矩形


Graphics.DrawRectangle(Pen物件, X1, Y1, W, H)
Graphics.DrawRectangle(Pen物件, X1, Y1, X2 - X1, Y2 - Y1)
Graphics.FillRectangle(Brushes物件, X1, Y1, W, H)
Graphics.FillRectangle(Brushes物件, X1, Y1, X2 - X1, Y2 - Y1)




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)


        G.FillRectangle(Brushes.Black, 100, 50, 100, 50)

        G.DrawRectangle(Pens.Red, 20 + 20 * 0, 10 + 10 * 0, 40, 20)
        G.DrawRectangle(Pens.Purple, 20 + 20 * 16, 10 + 10 * 16, 40, 20)

        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...