http://163.13.128.197/1.jpg ~~~>這是參考的
總共要處理三個部份:
1. 拉動捲軸時, 如果捲軸的值為
25: 請在Label的地方顯示 \"已經到了四分之ㄧ了\", 並改變文字顏色(forecolor)
50: 請在Label的地方顯示 \"已經到了四分之二了\", 並改變文字顏色(forecolor)
75: 請在Label的地方顯示 \"已經到了四分之三了\", 並改變文字顏色(forecolor)
100: 請在Label的地方顯示 \"已經到了\", 並改變文字顏色(forecolor)
若非上述值, 則顯示\"加把勁\"
2. 文字方塊值改變時, 當值改變時ㄧ樣在Label顯示結果如上
3. 按下輸入按鈕後, 請跳出一個inputbox讓使用者輸入值, ㄧ樣在Label顯示結果
可以請您幫幫我麼 謝謝
2006-05-08 21:49:48 · 1 個解答 · 發問者 Anonymous in 電腦與網際網路 ➔ 程式設計
'請按照你的圖佈置元件Private Sub Command1_Click()Dim S$, N%Do S = InputBox("請輸入1~100的整數") If S = "" Then Exit Sub N = Int(Val(S))Loop Until N > 0 And N < 101HScroll1 = NEnd SubPrivate Sub Form_Load()HScroll1.Min = 1HScroll1.Max = 100HScroll1 = 1End SubPrivate Sub HScroll1_Change()Text1 = HScroll1With Label1 Select Case HScroll1 Case 25 To 49 .Caption = "已經到了四分之ㄧ了" .ForeColor = vbRed Case 50 To 74 .Caption = "已經到了四分之二了" .ForeColor = vbBlue Case 75 To 99 .Caption = "已經到了四分之三了" .ForeColor = vbYellow Case 100 .Caption = "已經到了" .ForeColor = vbGreen Case Else .Caption = "加把勁" .ForeColor = 0 End SelectEnd WithEnd SubPrivate Sub HScroll1_Scroll()HScroll1_ChangeEnd SubPrivate Sub Text1_Change()Text1 = Val(Text1)If Text1 < 1 Then Text1 = 1If Text1 > 100 Then Text1 = 100HScroll1 = Text1End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)If InStr("0123456789" & Chr(8), Chr(KeyAscii)) = 0 Then KeyAscii = 0End Sub
2006-05-09 08:15:07 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋