2017年12月12日 星期二

[ VB2010 ] - 文字抹上漸層色

[ VB2010 ] - 文字抹上漸層色



Public Class Form1
    Dim BMP As Bitmap

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim X As Integer
        Dim Y As Integer

        BMP = New Bitmap(250, 48)

        Dim GF As Graphics = Me.CreateGraphics
        Dim GB As Graphics = Graphics.FromImage(BMP)

        GB.FillRectangle(Brushes.White, 0, 0, 250, 48)
        GB.DrawString("VB研究小站", New Font("標楷體", 28, FontStyle.Bold), Brushes.Black, 0, 0)

        For X = 0 To 249
            For Y = 0 To 47
                If BMP.GetPixel(X, Y) <> Color.FromArgb(255, 255, 255, 255) Then
                    BMP.SetPixel(X, Y, Color.FromArgb(255, 250 - X, 15, X))
                End If
            Next
        Next

        GF.DrawImage(BMP, 0, 0)
        GF.Dispose()
        GB.Dispose()
    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...