欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

DS控件库 一个简单的血条颜色渐变方案

程序员文章站 2022-04-07 08:42:10
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(... ......

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