VB最小化到托盘 20
IfMe.WindowState=1Then'如程序为最小化则——sty.intray=True'隐藏到任务栏Me.Visible=False'让程序界面不可见EndIf...
If Me.WindowState = 1 Then '如程序为最小化则——
sty.intray = True '隐藏到任务栏
Me.Visible = False '让程序界面不可见
End If
End Sub '点击托盘图标后,让程序窗体显示出来
Private Sub CsysTray1_MouseDown(Button As Integer, Id As Long)
End Sub
Me.WindowState = 0 '程序回复到Normal状态
Me.Visible = True '从任务栏中清除图标
sty.intray = False '令程序界面可见
Me.SetFocus
End Sub
=================================
以上代码执行后总是最小化到windows的左下角,win7系统和这个没关系吧,网上的代码我都试过了,用户控件的,模块的的都是同样的问题,全部到了左下角去 展开
sty.intray = True '隐藏到任务栏
Me.Visible = False '让程序界面不可见
End If
End Sub '点击托盘图标后,让程序窗体显示出来
Private Sub CsysTray1_MouseDown(Button As Integer, Id As Long)
End Sub
Me.WindowState = 0 '程序回复到Normal状态
Me.Visible = True '从任务栏中清除图标
sty.intray = False '令程序界面可见
Me.SetFocus
End Sub
=================================
以上代码执行后总是最小化到windows的左下角,win7系统和这个没关系吧,网上的代码我都试过了,用户控件的,模块的的都是同样的问题,全部到了左下角去 展开
2个回答
2013-08-23
展开全部
注:单击按钮添加、删除托盘,另带托盘时事件处理。
Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uID As Long
uFlags As LoadPictureColorConstants
uCallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const WM_MOUSEMOVE = &H200
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
'LeftButton:
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
'RightButton:
Private Const WM_RBUTTONDBLCLK = &H206
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_RBUTTONUP = &H205
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Long
Dim nid As NOTIFYICONDATA
Private Sub Command1_Click()
nid.cbSize = Len(nid)
nid.hWnd = Form1.hWnd
nid.uID = vbNull
nid.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
nid.uCallbackMessage = WM_MOUSEMOVE
nid.hIcon = Form1.Icon ' Tip's Icon
nid.szTip = "Independence's Project" & vbNullChar 'Test Over the Tip
Shell_NotifyIcon NIM_ADD, nid
Form1.Hide
End Sub
Private Sub Command2_Click()
Shell_NotifyIcon NIM_DELETE, nid
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub Form_Load()
Command1.Caption = "Add Top"
Command2.Caption = "Delete Top"
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then Form1.PopupMenu File
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Msg As Long, sFilter As String
Msg = X / Screen.TwipsPerPixelX
Select Case Msg
'Case WM_LBUTTONDBLCLK 'Check MouseButton
' CommonDialog1.DialogTitle = "Choose an Icon For Tip"
' sFilter = "Icon Files(*.icon)|*.ico|All Files(*.*)|*.*"
' CommonDialog1.Filter = sFilter
' CommonDialog1.ShowOpen
' If CommonDialog1.FileName <> "" Then
' Form1.Icon = LoadPicture(CommonDialog1.FileName)
' nid.hIcon = Form1.Icon
' Shell_NotifyIcon NIM_MODIFY, nid
' End If
Case WM_LBUTTONDOWN
Form1.Show
Case WM_RBUTTONDBLCLK
Case WM_RBUTTONDOWN
Form1.PopupMenu File
'Dim ToolTipString As String
'ToolTipString = InputBox("Enter New Test:", "Change Tool Tip")
'If ToolTipString <> "" Then
' nid.szTip = ToolTipString & vbNullChar
' Shell_NotifyIcon NIM_MODIFY, nid
'End If
Case WM_RBUTTONUP
'Case WM_LBUTTONUP
End Select
End Sub
Private Sub Form_Terminate()
Shell_NotifyIcon NIM_DELETE, nid
End Sub
Private Sub ShowForm_Click()
Form1.Show
End Sub
江苏力库塑料托盘制造有限公司_
2024-07-03 广告
2024-07-03 广告
塑料托盘哪里买?塑料托盘的型号尺寸非常多,如果您是批量采购的话,可以选择合适的厂家进行批发。如果是量少的情况下,可以去当地的塑料制品市场进行采购。如果没有合适的尺寸,可以在网上搜索厂家,询问是否是常规尺寸,能否买到塑料托盘现货等等。总的来说...
点击进入详情页
本回答由江苏力库塑料托盘制造有限公司_提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询