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

沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...