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

沒有留言:

張貼留言

2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2

 2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2 AngularJS 實例 <!DOCTYPE html> <html> <head> &...