VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 创建一个递增数字框
发表评论(0)作者:Bryan Shoemaker, 平台:VB6.0+Win98, 阅读:9338, 日期:2000-10-17
    You can注释:t increment a vertical scroll bar注释:s value -- a fact that can become annoying. For example, start a new project and place a text box and a vertical scroll bar on the form. Place the vertical scroll bar to the right of the text box and assign their Height and Top properties the same values. Assign the vertical scroll bar a Min property value of 1 and a Max value of 10. Place the following code in the vertical scroll bar注释:s Change event:


Text1.Text = VScroll1.Value
Now press [F5] to run the project. Notice that if you click on the bottom arrow of the vertical scroll bar, the value increases; if you click on the top arrow, the value decreases. From my perspective, it should be the other way around.

To correct this, change the values of the Max and Min properties to negative values. For example, end the program and return to the design environment. Change the vertical scroll bar注释:s Max value to -1 and its Min value to -10. In its Change event, replace the line you entered earlier with the following:


Text1.Text = Abs(Vscroll1.Value)
Now press [F5] to run the project. When you click on the top arrow of the vertical scroll bar, the value now increases. Adjust the Height properties of the text box and the scroll bar so you can注释:t see the position indicator, and your number box is ready to go.