如图
图
双击刚才添加的label属性text:(天极网开发频道)中输入以下代码
Private Sub Label _Click(ByVal sender As System Object
ByVal e As System EventArgs) Handles Label ClickShellExecute( open CStr( ) CStr( ) )
End SubEnd Class
OK!全部搞定 按F 键运行如图 所示 选择相应选项后点击(关闭计算机启动定时器按钮)就可以了 现在程序将按照你所设定的时间而启动关闭计算机选项
lishixinzhi/Article/program/net/201311/12366
用vb.net编写程序系统托盘里显示图标的话用NotifyIcon组件,建立一个ContextMenuStrip控件与之关联 。关联的位置在NotifyIcon.ContextMenuStrip 。关机直接shell 命令列:rundll32.exe user.exe,exitwindows就可以,声音提示用My.Compurer.Audio.Play ("路径"),提示消息用Msgbox函数……通过判断返回值在确定是否关机……手头没有VB.Net……大概思路就是这样,不知道能不能对你有帮助……如果要代码的话,不忙的时候可以给你写
请问VB.NET的关机语句是?这是点击Option 你可以
用个msgbox函数 点击YES时候运行关机代码即可
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
Const EWX_FORCE As Short = 4
Const EWX_LOGOFF As Short = 0
Const EWX_REBOOT As Short = 2
Const EWX_SHUTDOWN As Short = 1
Dim retval As Integer
' 定义Esc按键
Const VK_ESCAPE As Short = H1Bs
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
If Option1.Checked Then
' 注销当前用户
retval = ExitWindowsEx(EWX_FORCE, 0) bitsCN.Com
ElseIf Option2.Checked Then
' 关闭计算机
retval = ExitWindowsEx(EWX_SHUTDOWN, 0)
ElseIf Option3.Checked Then
' 重新启动
retval = ExitWindowsEx(EWX_REBOOT, 0)
End If
End Sub
Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
Me.Close()
End Sub
' 按Esc键时 , 结束应用程序
Private Sub Form1_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
If KeyAscii = VK_ESCAPE Then BBS.bitsCN.com网管论坛
Me.Close()
End If
If KeyAscii = 0 Then
eventArgs.Handled = True
End If
End Sub
VB.net如何设置msgbox可以定时自动关闭?MessageBox里的Show里没有自动关闭的方法,但是你可以自定义一个MessageBox,MessageBox就是一个窗体,你新建一个窗体Form2 , 添加一个public属性message和一个定时器timer1,timer1的interval设置成你想要的时间,在Form2的Load事件启动timer1,Timer1_Tick事件里关闭窗口Me.Close(),然后在需要显示Messagebox的时候,在主窗口Form1里设置messge属性,然后用show方法弹出窗口就可以了 。
Form1程序:(添加了一个Button1)
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim f2 As Form2 = New Form2
f2.Message = "提示"
f2.ShowDialog()
End Sub
End Class
Form2程序:(添加了一个Label1显示信息和一个Timer1用于计时,Form2可以自定义成你想要的样式 , 标题,按钮,窗体样式等)
Public Class Form2
'自定义属性 显示提示信息
Public WriteOnly Property Message As String
Set(value As String)
Label1.Text = value
End Set
End Property
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Me.Close()
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
推荐阅读
- 要下载什么才能录屏直播,什么软件能录直播视频
- 25kvgis开关柜,10kvgis开关柜
- 如何做新媒体文章,如何做新媒体文章赚钱
- js写入sqlserver,js写入文件
- god语言 god语言 go语言
- 如何操作电商审单,如何操作电商审单业务
- java链接oracle查询,java连接oracle数据库实现增删改查
- 不是主播可以直播电视剧吗,不是主播可以直播电视剧吗
- linux新建根目录命令 linux在根目录