电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

1增加新按钮程序清单(增加新按钮exe)VIP专享VIP免费

1增加新按钮程序清单(增加新按钮exe)_第1页
1增加新按钮程序清单(增加新按钮exe)_第2页
1增加新按钮程序清单(增加新按钮exe)_第3页
1.增加新按钮程序清单(增加新按钮.exe) 注意:本程序较难。 '指出下面所使用的新变量必须先声明,这样会自动纠错 Option Explicit '通过使用 WithEvents 关键字声明一个对象变量为新的命令按钮 Private WithEvents NewButton As CommandButton Private Sub cmd_add_Click() If NewButton Is Nothing Then '增加新的按钮cmdNew Set NewButton = Controls.Add("vb.commandButton", "cmdnew", Me) NewButton.Move cmd_add.Left, cmd_add.Top - 580, cmd_add.Width NewButton.Caption = "新增的按钮" NewButton.Visible = True Else MsgBox "你已经增加了新的按钮!", 0, "提示框" End If End Sub Private Sub cmd_minus_Click() If NewButton Is Nothing Then MsgBox "你没有增加新按钮!", 0, "提示框" Else Controls.Remove NewButton Set NewButton = Nothing End If End Sub Private Sub cmd_test_Click() If NewButton Is Nothing Then MsgBox "你没有增加新的按钮!", 0, "提示框" Else NewButton.Caption = "测试成功!" End If End Sub '新增控件的单击事件 Private Sub NewButton_Click() MsgBox "您选中的是动态增加的按钮", 0, "提示框" End Sub 2. 文本框之间用 TAB 键切换的程序清单(文本框切换.exe) 注意:本程序需要建立文本框组。 Private Sub Command1_Click() Unload Me End Sub '文本框内的文本反白显示 Private Sub Text1_GotFocus(Index As Integer) Text1(Index).SelStart = 0 Text1(Index).SelLength = Len(Text1(Index).Text) End Sub '设置回车与TAB 键功能相同 Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii = 13 Then KeyAscii = 0 SendKeys "{tab}" End If End Sub 3. 在不同位置插入文本的程序清单(插入文本.exe) '注意:本程序需要建立optionbutton 组,并把该组建立在frame 框中。 Private Sub Command1_Click() Text1.Text = "天津大学职教学院" Option1(0).Value = True Image1.Picture = LoadPicture("d:\11\20.jpg") Picture1.Picture = LoadPicture("d:\11\21.jpg") End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Image1_Click() Image1.Picture = Loa...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部