扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:阿虎 来源:天极开发者网络 2007年11月9日
关键字:
组件类型 | 组件名称 | 属性 | 设置结果 |
Form | Form1 | Text | 利用MsgBox函数制作提示框 |
MaximizeBox | False | ||
MinimizeBox | False | ||
GroupBox | GroupBox1 | Text | 显示图标 |
GroupBox | GroupBox2 | Text | 显示按钮 |
GroupBox | GroupBox3 | Text | 缺省焦点按钮 |
RadioButton | RadioButton1 | Text | 关键符号 |
RadioButton | RadioButton1 | Checked | True |
RadioButton2 | Text | 惊叹符号 | |
RadioButton3 | Text | 信息符号 | |
RadioButton4 | Text | 问号 | |
RadioButton5 | Text | 终止重试忽略 | |
RadioButton6 | Text | 是否取消 | |
RadioButton7 | Text | 是否 | |
RadioButton8 | Text | 重试取消 | |
RadioButton9 | Text | 确定取消 | |
RadioButton10 | Checked | True | |
RadioButton10 | Text | 确定 | |
RadioButton12 | Text | 第三按钮 | |
RadioButton13 | Text | 第二按钮 | |
RadioButton14 | Text | 替换 | |
RadioButton14 | Checked | True | |
TextBox | TextBox1 | Text | |
TextBox2 | Text | ||
TextBox3 | Text |
AddHandler RadioButton1.Click, AddressOf Icon_Click AddHandler RadioButton2.Click, AddressOf Icon_Click AddHandler RadioButton3.Click, AddressOf Icon_Click AddHandler RadioButton4.Click, AddressOf Icon_Click AddHandler RadioButton5.Click, AddressOf Button_Click AddHandler RadioButton6.Click, AddressOf Button_Click AddHandler RadioButton7.Click, AddressOf Button_Click AddHandler RadioButton8.Click, AddressOf Button_Click AddHandler RadioButton9.Click, AddressOf Button_Click AddHandler RadioButton10.Click, AddressOf Button_Click AddHandler RadioButton12.Click, AddressOf Default_Click AddHandler RadioButton13.Click, AddressOf Default_Click AddHandler RadioButton14.Click, AddressOf Default_Click |
Dim MsgIcon As MsgBoxStyle = MsgBoxStyle.Critical Dim MsgButton As MsgBoxStyle = MsgBoxStyle.OKOnly Dim DefaultButton As MsgBoxStyle = MsgBoxStyle.DefaultButton1 |
Dim iResult As Integer = MsgBox ( textBox1.Text , MsgIcon + MsgButton + DefaultButton , textBox2.Text ) '显示定制的信息对话框 Select Case iResult Case 1 TextBox3.Text = "选择""确定""按钮" Case 2 TextBox3.Text = "选择""取消""按钮" Case 3 TextBox3.Text = "选择""终止""按钮" Case 4 TextBox3.Text = "选择""重试""按钮" Case 5 TextBox3.Text = "选择""忽略""按钮" Case 6 TextBox3.Text = "选择""是""按钮" Case 7 TextBox3.Text = "选择""否""按钮" End Select '处理返回值 |
Public Sub Icon_Click ( ByVal sender As Object , ByVal e As System.EventArgs ) Select Case sender.Name Case "RadioButton1" MsgIcon = MsgBoxStyle.Critical '选择提示框图标为"警告" Case "RadioButton2" MsgIcon = MsgBoxStyle.Exclamation '选择提示框图标为"惊叹号" Case "RadioButton3" MsgIcon = MsgBoxStyle.Information '选择提示框图标为信息提示图标" Case "RadioButton4" MsgIcon = MsgBoxStyle.Question '选择提示框图标为"问号" End Select End Sub |
Public Sub Button_Click ( ByVal sender As Object , ByVal e As System.EventArgs ) Select Case sender.Name Case "RadioButton5" MsgButton = MsgBoxStyle.AbortRetryIgnore '设定信息对话框中的按钮数目为三个:退出、重试和忽略 Case "RadioButton6" MsgButton = MsgBoxStyle.YesNoCancel '设定信息对话框中的按钮数目为三个:是、否和取消 Case "RadioButton7" MsgButton = MsgBoxStyle.YesNo '设定信息对话框中的按钮数目为二个:是、否 Case "RadioButton8" MsgButton = MsgBoxStyle.RetryCancel '设定信息对话框中的按钮数目为二个:重试、取消 Case "RadioButton9" MsgButton = MsgBoxStyle.OKCancel '设定信息对话框中的按钮数目为二个:确认、取消 Case "RadioButton10" MsgButton = MsgBoxStyle.OKOnly '设定信息对话框中的按钮数目为一个:确认 End Select End Sub |
Public Sub Default_Click ( ByVal sender As Object , ByVal e As System.EventArgs ) Select Case sender.Name Case "RadioButton14" DefaultButton = MsgBoxStyle.DefaultButton1 '信息对话框中的第一个按钮为缺省焦点按钮 Case "RadioButton13" DefaultButton = MsgBoxStyle.DefaultButton2 '信息对话框中的第二个按钮为缺省焦点按钮 Case "RadioButton12" DefaultButton = MsgBoxStyle.DefaultButton3 '信息对话框中的第三个按钮为缺省焦点按钮 End Select End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者