是要这样的代码?像这样的代码适合制作自定义漂亮的按钮 Private Sub button1_Click(sender As Object,e As EventArgs) Handles button1.Click Dim 背景图 = button1.BackgroundImage If 背景图 Is nothing Then button1.BackgroundImage = Image.Fromfile(System.Environment.CurrentDirectory + "\熊猫.bmp") button1.BackgroundImage.Tag = "熊猫" button1.Text = "" Else Dim 景图 = button1.BackgroundImage.Tag If 景图 = "熊猫" Then button1.BackgroundImage = Image.Fromfile(System.Environment.CurrentDirectory + "\水滴.gif") button1.BackgroundImage.Tag = "水滴" ElseIf 景图 = "水滴" Then button1.BackgroundImage = Image.Fromfile(System.Environment.CurrentDirectory + "\双狮子.png") button1.BackgroundImage.Tag = "双狮子" ElseIf 景图 = "双狮子" Then button1.BackgroundImage = Image.Fromfile(System.Environment.CurrentDirectory + "\熊猫.bmp") button1.BackgroundImage.Tag = "熊猫" End If End If button1.Size = button1.BackgroundImage.Size Me.CreateGraphics.Clear(button1.Backcolor) End Sub这个例子不断点击按钮循环更换图片 Me.ResizeRedraw = True Private Sub Form1_Paint(sender As Object,e As PaintEventArgs) Handles MyBase.Paint Dim 花篮 = Image.Fromfile(System.Environment.CurrentDirectory + "\花篮.jpg") e.Graphics.DrawImage(花篮,Me.WIDth,Me.Height) End Sub总结
以上是内存溢出为你收集整理的vb里面图片怎么使按钮上面图片交替显示的代码全部内容,希望文章能够帮你解决vb里面图片怎么使按钮上面图片交替显示的代码所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)