DS控件庫 一個簡單的血條顏色漸變方案

    Private Sub DS按鈕1_ButtonClick(Sender As Object) Handles DS按鈕1.ButtonClick
        Dim T As New Threading.Thread(AddressOf Doit)
        T.IsBackground = True
        T.Start()
    End Sub
    Private Sub Doit()
        For I As Integer = 1000 To 0 Step -1
            DS進度條1.當前值 = I
            Dim Cl As Color = Color.FromArgb(255 * (1 - I / 1000), 255 * (I / 1000), 0)
            DS進度條1.前景顏色 = Cl
            DS標籤1.Text = "<color=255,200,0>HP</color> " & I
            Threading.Thread.Sleep(10)
            Application.DoEvents()
        Next
        DS進度條1.當前值 = 0
        DS標籤1.Text = "<color=255,200,0>HP</color> 0"
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        CheckForIllegalCrossThreadCalls = False
    End Sub
相關文章
相關標籤/搜索