关于VB,帮我写段代码
追问:有人在吗,你还是把源码发给我吧 961510545@qq.com
追问:有人在吗,你还是把源码发给我吧 961510545@qq.com
答案:气泡事件比较全的一个
Form代码:
Option Explicit
Private WithEvents Fm1 As Frame
Private WithEvents O1 As OptionButton
Private WithEvents O2 As OptionButton
Private WithEvents C1 As CommandButton
Private WithEvents C2 As CommandButton
Private Sub C1_Click()
If O1.Value = True Then
End
ElseIf O2.Value = True Then
qipao 气泡_添加, "托盘图标标题", "气泡标题", "气泡内容", 气泡_信息图标, Me.Icon, , Me.hWnd
Hide
Else
MsgBox "没有任何操作"
End If
End Sub
Private Sub C2_Click()
If MsgBox("取消什么意思?Unload Me?", vbQuestion + vbYesNo, "是不是?") = vbYes Then Unload Me
End Sub
Private Sub Form_Load()
Set Fm1 = Me.Controls.Add("VB.Frame", "Fm1")
Set O1 = Me.Controls.Add("VB.OptionButton", "O1", Fm1)
Set O2 = Me.Controls.Add("VB.OptionButton", "O2", Fm1)
Set C1 = Me.Controls.Add("VB.CommandButton", "C1", Fm1)
Set C2 = Me.Controls.Add("VB.CommandButton", "C2", Fm1)
O1.Move 300, 300, 1500, 750
O2.Move 300, 1200, 1500, 750
C1.Move 6000, 300, 1500, 825
C2.Move 6000, 1200, 1500, 825
Me.Width = 9600
Me.Height = 3600
Fm1.Caption = "请选择操作"
O1.Caption = "退出"
O2.Caption = "最小化到通知区域"
C1.Caption = "确定"
C2.Caption = "取消"
Fm1.Visible = True
O1.Visible = True
O2.Visible = True
C1.Visible = True
C2.Visible = True
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) '考虑到有写程序有用到mousemove事件所以集中到这里来了
If Button = 2 Then
Dim msg As Long
Dim sFilter As String
msg = X / Screen.TwipsPerPixelX'鼠标按下时的按钮信息
Select Case msg
Case 512'图标 鼠标移过
Case 513'图标 鼠标左键按下
Case 514'图标 鼠标左键弹起
Show
Case 515'图标 鼠标左键双击
Case 516'图标 鼠标右键按下
Case 517'图标 鼠标右键弹起
Case 518'图标 右键双击
Case 519'图标 中键按下
Case 520'图标 中键弹起
Case 521'图标 中键双击
Case 1026 '气泡 被创建
Case 1027 '气泡 气泡未消失时图标被卸载
Case 1028 '气泡 关闭按钮
Case 1029 '气泡 被左击事件
Case Else: Debug.Print "一个未知的气泡事件:" & msg '如果发现新的气泡事件告诉我~~~
End Select
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
qipao 气泡_删除
End Sub
Private Sub Form_Resize()
Fm1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
End Sub'你再添加一个类模块,把下面的代码粘贴进去(写不完分2次)关于你的这个程序,请你看看这个网页学习一下。 http://www.upschool.com.cn/edu/1299/2007/28/10du272052_1.shtml
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如果平常的任务栏化自己的软件图标,没必要这么复杂!两个API,加一个SetMeICON,MoveM<eiCO的自制函数就OK!
上一个:求VB数据中的一维至二维习题?
下一个:VB怎样让MDI窗体禁用最大化按钮