VFP循環(huán)微調(diào)控件(CycleSpinner)

字號(hào):

循環(huán)微調(diào)控件(CycleSpinner)所實(shí)現(xiàn)的功能是:當(dāng)單擊向上箭頭而達(dá)到值時(shí),再單擊向上箭頭,能自動(dòng)跳到最小值;當(dāng)單擊向下箭頭而達(dá)到最小值時(shí),能自動(dòng)跳到值;其余功能均繼承Spinner基類(lèi)的功能。具體實(shí)現(xiàn)方法如下:
    利用表單控件,在表單中一個(gè)微調(diào)按鈕,并設(shè)置如下屬性:
    SpinnerHighValue=Max
    &&Max應(yīng)小于Spinner基類(lèi)所
    &&提供的默認(rèn)值
    SpinnerLowValue=Min  
    &&Min應(yīng)大于Spinner基類(lèi)所
    &&提供的最小默認(rèn)值
    Value=1
    Name=′CycleSpinner′
    在Init事件中寫(xiě)入如下代碼:
    This.SpinnerHighValue=This.SpinnerHighValue+This.Increment
    This.SpinnerLowValue=This.SpinnerLowValue-This.Increment
    在InteractiveChange事件中寫(xiě)入如下代碼:
    If This.Value=This.SpinnerHighValue
    This.Value=Int(This.SpinnerLowValue+This.Increment)
    Endif
    If This.Value=This.SpinnerLowhValue
    This.Value=Int(This.SpinnerHighValue-This.Increment)
    Endif
    Thisform.Refresh
    再將其作為類(lèi)保存起來(lái),添加到你的類(lèi)庫(kù)中。
    若你在編程中,需用此功能,就可直接用此循環(huán)微調(diào)控件類(lèi)了。