2017年11月2日 星期四

[ VB2010 ] - 畫線與畫圓



源自於
http://www.svbr8.url.tw/Prg_Coding/VB/index_middle_drawing.php


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim BMP As Bitmap = New Bitmap(200, 100, Imaging.PixelFormat.Format32bppArgb)
        Dim g As Graphics = Graphics.FromImage(BMP)
        Dim f As Font = New Font(Me.Font.Name, 12, FontStyle.Bold)

        g.FillRectangle(Brushes.White, 0, 0, 200, 200)
        g.DrawRectangle(Pens.Black, 0, 0, 199, 99)

        g.DrawLine(Pens.Black, 1, 1, 200, 100)
        g.DrawLine(Pens.Black, 1, 1, 200, 50)
        g.DrawLine(Pens.Black, 1, 1, 100, 100)

        g.DrawEllipse(Pens.Black, 15, 5, 10, 12)
        g.DrawEllipse(Pens.Black, 30, 10, 20, 24)
        g.DrawEllipse(Pens.Black, 60, 20, 40, 48)
        g.DrawEllipse(Pens.Black, 120, 40, 80, 96)

        g.DrawString("S", f, Brushes.Red, 5, 55)
        g.DrawString("V", f, Brushes.Orange, 15, 55)
        g.DrawString("B", f, Brushes.Green, 25, 55)
        g.DrawString("R", f, Brushes.Blue, 35, 55)

        g.Dispose()
        Me.BackgroundImageLayout = ImageLayout.None
        Me.BackgroundImage = BMP

    End Sub

End Class

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...