Private Sub Image1_Click()
'这里放入点击图片后要执行的代码
End Sub
如果想更美观一些,你可以另外再做一张鼠标悬停时的图片,以及鼠标点击时候的图片,然后结合Image1_MouseMove事件和Image1_MouseDown事件,做出有动态效果的图形按钮来
设置按钮的属性Style为1,且将按钮的属性Picture选你想加载的图片或设置按钮的属性BackColor的颜色,都可作出漂亮的按钮.如要改变按钮形状则较复杂.可使用2个Shape控件和1个Label控件完成(仿3D效果),3控件的颜色设成一样。如需加载图片则Label控件改用PictureBox控件,具体代码:Private Sub Form_Load()
Shape2.Visible = False
End Sub
Private Sub Label1_Click()
Form2.Show
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape2.Visible = True
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape2.Visible = False
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)