vb.net最小化到托盘 vb窗体最小化按钮不可用怎么设置
vb.net怎么把其它程序最小化到托盘
如果用vb.net程序打开可以用如下代码:
创新互联专注于纳雍网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供纳雍营销型网站建设,纳雍网站制作、纳雍网页设计、纳雍网站官网定制、重庆小程序开发服务,打造纳雍网络公司原创品牌,更为您提供纳雍网站排名全网营销落地服务。
Shell("C:\文件", AppWinStyle.Hide)'打开C:\文件,并在其打开时将其隐藏
如不懂可以追问
望采纳
vb.net 利用NotifyIcon实现最小化到系统托盘,但是收缩到轨迹到开始菜单
添加托盘图标控件,并设置好其Icon属性,然后添加如下代码:
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
Me.Hide()
End Sub
这样实现了点关闭,进入托盘,如果点最小化进入托盘:
'窗体最小化时候隐藏窗体,
Private Sub MainForm_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
Me.ShowInTaskbar = False
End If
End Sub
vb中怎么最小化系统托盘
首先添加一个模块,写入代码,代码我已经准备好了
然再给Form窗体添加代码
模块
Option Explicit
Public Const MAX_TOOLTIP As Integer = 64
Public Const NIF_ICON = H2
Public Const NIF_MESSAGE = H1
Public Const NIF_TIP = H4
Public Const NIM_ADD = H0
Public Const NIM_DELETE = H2
Public Const WM_MOUSEMOVE = H200
Public Const WM_LBUTTONDOWN = H201
Public Const WM_LBUTTONUP = H202
Public Const WM_LBUTTONDBLCLK = H203
Public Const WM_RBUTTONDOWN = H204
Public Const WM_RBUTTONUP = H205
Public Const WM_RBUTTONDBLCLK = H206
Public Const SW_RESTORE = 9
Public Const SW_HIDE = 0
Public nfIconData As NOTIFYICONDATA
Public Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * MAX_TOOLTIP
End Type
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Public Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
From窗体Private Sub Command1_Click()
With nfIconData
.hWnd = Me.hWnd
.uID = Me.Icon
.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon.Handle
.szTip = App.Title + "(版本 " App.Major "." App.Minor "." App.Revision ")" vbNullChar
.cbSize = Len(nfIconData)
End With
Call Shell_NotifyIcon(NIM_ADD, nfIconData)
Me.Hide
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lMsg As Single
lMsg = X / Screen.TwipsPerPixelX
Select Case lMsg
Case WM_LBUTTONUP
ShowWindow Me.hWnd, SW_RESTORE
End Select
End Sub
vb.net点关闭 最小化到托盘
添加托盘图标控件,并设置好其Icon属性,然后添加如下代码:
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
Me.Hide()
End Sub
文章名称:vb.net最小化到托盘 vb窗体最小化按钮不可用怎么设置
分享网址:http://pwwzsj.com/article/dddidsi.html