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

沒有留言:

張貼留言

Modbus FC=1 (Coils read) & FC=15 (Coils Write)

Modbus FC=1  (Coils read)  & FC=15 (Coils Write)   「從 Modbus 設備讀取多個線圈(Coils)狀態,並立刻將這些狀態原封不動地轉寫到另一個記憶體位址(起始位址 16)」 。 整個流程使用了知名套件 node-red...