private sub Button1_MouseEnter() dim ButtonState as integer=0 '按钮3种状态:普通、移入、按下 Using B as new bitmap("c:\1.bmp") '图片文件路径 if button1.backgroundimage isnot noth then button1.backgroundimage.dispose button1.backgroundimage=new bitmap(button1.width,button1.height) using g as graphics=graphics.fromimage(button1.backgroundimage) g.drawimage(b,new rectangle(buttonstate*(b.width/3),0,button1.width,button1.height),new rectangle(buttonstate*(b.width/3),0,b.width/3,b.height),pixelmode) end using end sub在Button1_MouseEnter/Button1_MouseLeave/Button1_MouseDown中分别修改ButtonState的值(0-2)即可
不胜感激啊……
dim ButtonState as integer=0 '按钮3种状态:普通、移入、按下
Using B as new bitmap("c:\1.bmp") '图片文件路径
if button1.backgroundimage isnot noth then button1.backgroundimage.dispose
button1.backgroundimage=new bitmap(button1.width,button1.height)
using g as graphics=graphics.fromimage(button1.backgroundimage)
g.drawimage(b,new rectangle(buttonstate*(b.width/3),0,button1.width,button1.height),new rectangle(buttonstate*(b.width/3),0,b.width/3,b.height),pixelmode)
end using
end sub在Button1_MouseEnter/Button1_MouseLeave/Button1_MouseDown中分别修改ButtonState的值(0-2)即可