大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Dim toolTip1 As New ToolTip()
网站建设哪家好,找创新互联!专注于网页设计、网站建设、微信开发、微信小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了大邑县免费建站欢迎大家使用!
toolTip1.AutoPopDelay = 5000 '显示停留5秒
toolTip1.InitialDelay = 1000 '1秒后显示
toolTip1.ReshowDelay = 500 '从一个控件移到另一个控件0.5秒后显示
toolTip1.ShowAlways = True '在窗口不活动时也显示
ToolTip1.SetToolTip(TextBox1, "提示内容")
详见:
可以建立一个方向向量用来存储气泡运动的方向(方向值每到一定时间随机产生),再定义一个表示速度的变量(如果要的是均速运动速度值就不变,否则也可以随机产生)。再用速度和方向值改变气泡位置。
我可以做个例子(qq:359394386),但分不能太低。
这不是框,这是用
NotifyIcon 做的一个提示。就是一般常说的气泡提示。
它能使用程序最小化后在任务栏的右下角显示。
Option Explicit Const MAX_TOOLTIP As Integer = 64 Const NIF_ICON = H2 '删除图标 Const NIF_MESSAGE = H1 Const NIF_TIP = H4 Const NIM_ADD = H0 '添加图标到任务栏提示区 Const NIM_DELETE = H2 Const WM_MOUSEMOVE = H200 Const WM_LBUTTONDOWN = H201 Const WM_LBUTTONUP = H202 Const WM_LBUTTONDBLCLK = H203 Const WM_RBUTTONDOWN = H204 Const WM_RBUTTONUP = H205 Const WM_RBUTTONDBLCLK = H206 Const SW_RESTORE = 9 Const SW_HIDE = 0 Private 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 就是了
首先,你要找一个手型的图标文件(就是扩展名为ico的文件),然后用VB创建一个窗体,在窗体的属性MouseIcon里面添加你准备的ico文件,然后把属性MousePoint的属性值改成99-ccCustom,就可以了
这个……好像不是windows气泡,是程序窗体。需要后台进程触发该窗体的发生。
如果要做windows气泡,那比较简单。windows气泡比如说插入新硬件的提醒等。
我记得VB里有一个控件可以做进程,就是托盘显示图标的那个控件可以做,但我不会用那个控件。
若是windows气泡,我查得一个方案,你自己看看吧【注意,代码中有行数标号】
01 VERSION 5.00
02 Begin VB.Form Form1
03 Caption = "Form1"
04 ClientHeight = 3120
05 ClientLeft = 60
06 ClientTop = 420
07 ClientWidth = 4680
08 LinkTopic = "Form1"
09 ScaleHeight = 3120
10 ScaleWidth = 4680
11 StartUpPosition = 3 '窗口缺省
12 End
13 Attribute VB_Name = "Form1"
14 Attribute VB_GlobalNameSpace = False
15 Attribute VB_Creatable = False
16 Attribute VB_PredeclaredId = True
17 Attribute VB_Exposed = False
18 Option Explicit
19 '置前
20 Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X AsLong, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
21 '获取鼠标坐标
22 Private Declare Function GetCursorPos Lib "User32" (lpPoint As POINTAPI) As Long
23 Private Type POINTAPI
24 X As Long
25 Y As Long
26 End Type
27 '添加托盘图标
28 Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
29 Const NIM_ADD = H0
30 Const NIM_MODIFY = H1
31 Const NIM_DELETE = H2
32 Const NIIF_GUID = H4
33 Const WM_MOUSEMOVE = H200
34 Const WM_RBUTTONUP = H205
35 Private Type NOTIFYICONDATA
36 cbSize As Long
37 hWnd As Long
38 uID As Long
39 uFlags As Long
40 uCallbackMessage As Long
41 hIcon As Long
42 szTip As String * 128
43 dwState As Long
44 dwStateMask As Long
45 szInfo As String * 256
46 Timeout As Long
47 szInfoTitle As String * 64
48 dwInfoFlags As Long
49 End Type
50 Private TuoPan As NOTIFYICONDATA
51 Private Sub Form_Load()
52 SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, H10 Or H40 Or H2 Or H1 '置前
53 '添加托盘图标
54 With TuoPan
55 .cbSize = Len(TuoPan)
56 .hWnd = Me.hWnd
57 .uID = 0
58 .uCallbackMessage = WM_MOUSEMOVE
59 .uFlags = H2 Or H10 Or H1 Or H4
60 .hIcon = Me.Icon
61 .szTip = "小眼软件" vbNullChar
62 End With
63 Shell_NotifyIcon NIM_ADD, TuoPan
64 DoEvents
65 '气泡弹窗
66 TuoPan.szInfoTitle = "小眼软件" Chr(0) '标题
67 TuoPan.szInfo = "右击这里可以弹出菜单!!!" Chr(0) '内容
68 TuoPan.dwInfoFlags = NIIF_GUID '气泡图标
69 Shell_NotifyIcon NIM_MODIFY, TuoPan
70
71 '让菜单窗体监听系统消息
72 PreWinProc = GetWindowLong(MenuForm.hWnd, GWL_WNDPROC)
73 SetWindowLong MenuForm.hWnd, GWL_WNDPROC, AddressOf WndProc
74 End Sub
75 Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
76 Dim lMsg As Single
77 lMsg = X / Screen.TwipsPerPixelX
78 If lMsg = WM_RBUTTONUP Then
79 Dim MenuLT As POINTAPI
80 GetCursorPos MenuLT
81 MenuForm.Move MenuLT.X * 15 - MenuForm.Width, MenuLT.Y * 15 - MenuForm.Height
82 MenuForm.Show , Me
83 End If
84 End Sub
85 Private Sub Form_Unload(Cancel As Integer)
86 Shell_NotifyIcon NIM_DELETE, TuoPan '删除托盘图标
87 SetWindowLong Me.hWnd, GWL_WNDPROC, PreWinProc '卸载监听
88 End
89 End Sub
原文地址:
msgbox ““