用户登录  |  用户注册
首 页商业源码原创产品编程论坛
当前位置:PB创新网文章中心编程技巧计算机应用

利用VB开发CAI课件

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2009-01-10 11:56:32
菜单选择,作法如下。
①用photonshop作一小BMP图,用来表示滚动条中的滑块,取名为hk.bmp。
②在窗体中放一lable控件,设置属性borderdtyle为1-Fixed single,backstyle为0-transparent,caption为空,适当调节lable的高度及宽度,name为Lable1。
③在窗体中紧挨Lable1放置一sspanell控件,调节其高度及宽度与Lable1的高度宽度相等,bevellnner为1-inset,bevellouter为0-none,bevellwidth=1,borderwidth=0,name为sspanell1。
④在sspanell1中放置一picture控件,将borderstyle设置为0-none,调节其宽度及高度为适当值,并在其中放置要选取择的项(用lable控件或imager控件表示),命名为picture1。
⑤在lable1中放image控件,设置picture为hk.bmp,borderstyle为1-fixed single,调节其高度及宽度。
⑥程序如下:
'======================================================================
'当鼠标右键在滚动条的滑块上按下时,将标志置为真
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
vscroll_m = True
End Sub
'=======================================================================
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'滑块可移动范围
temp1 = lable1.height+lable.top-image1.height   '上限
temp2 = lable1.top期                                      '下限
If vscroll_m Then
  top_m = Image1.Top + Y
   If top_m > temp1 Then
     top_m =temp1
    ElseIf top_m < temp2 Then
      top_m = temp2
     End If
'移动滑块
Image1.Top = top_m
'计算滑块移动后,对应的菜单区应移动的距离
Picture1.Top = -(top_m -temp2 ) *picture1.height/lable1.height
End If
End Sub
'=======================================================================
'当鼠标右键在滚动条的滑块上弹起时,将标志置为假
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
vscroll_m = False
End Sub

上一页  [1] [2] 

Tags:

作者:佚名

文章评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
PB创新网ourmis.com】Copyright © 2000-2009 . All Rights Reserved .
页面执行时间:21,593.75000 毫秒
Email:ourmis@126.com QQ:2322888 蜀ICP备05006790号