永发信息网

编写VB事件过程实现以下效果:

答案:3  悬赏:20  手机版
解决时间 2021-04-29 17:25
  • 提问者网友:难遇难求
  • 2021-04-29 02:19
(1) 当用户卸载Form1时,弹出内容为“拜拜”的消息框,并显示窗体Form2

(2) 单击按钮Command1使窗体Form1隐藏,显示窗体Form2,按钮Command1失效。

(3) 窗体Form1加载时背景图片为win.jpg,双击窗体后背景图片效果变为某种背景色(颜色随机显示)
最佳答案
  • 五星知识达人网友:青尢
  • 2021-04-29 03:11

(1)
Private Sub Form_Unload(Cancel As Integer)
MsgBox "拜拜"
Form2.Show
End Sub
(2)
Private Sub Command1_Click()
Me.Hide
Form2.Show
Command1.Enabled = False
End Sub
(3)
Private Sub Form_DblClick()
Randomize


Form1.BackColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Form1.Picture = loadpicture("")
End Sub
Private Sub Form_Load()
Form1.Picture = LoadPicture("f:\win.jpg")
End Sub

全部回答
  • 1楼网友:轮獄道
  • 2021-04-29 05:09
(1) Private Sub Form_Unload(Cancel As Integer) MsgBox "拜拜" Form2.Show End Sub (2) Private Sub Command1_Click() Me.Visible = False Form2.Show Command1.Enabled = False End Sub (3) Private Sub Form_DblClick() Me.BackColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) Set Me.Picture = Nothing End Sub Private Sub Form_Load() Me.Picture = LoadPicture("f:\win.jpg") '注意路径和名称 End Sub 也可以加我的QQ:9986666@qq.tm 答案:110 一直交流一下
  • 2楼网友:思契十里
  • 2021-04-29 04:35

Private Sub Command1_Click() Me.Hide Form2.Show Command1.Enabled = False End Sub

Private Sub Form_DblClick() Dim r, g, b As Integer r = Int(Rnd * 255 + 1) g = Int(Rnd * 255 + 1) b = Int(Rnd * 255 + 1) Form1.Picture = LoadPicture("") Form1.BackColor = RGB(r, g, b) Debug.Print r, g, b End Sub

Private Sub Form_Load() Form1.Picture = LoadPicture(App.Path & "\win.jpg") End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) MsgBox "拜拜" Form2.Show End Sub

把win.jpg放到程序的根目录下就可以了

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯