如何在DELPHI程序中顯示Balloon工具提示﹖ zz
2005-03-25 02:08
489 查看
如何在DELPHI程序中顯示Balloon工具提示﹖ |
Autor: Kingron |
uses
Commctrl;
procedure ShowBalloonTip(Control: TWinControl; Icon: integer; Title: pchar; Text: PWideChar;
BackCL, TextCL: TColor);
const
TOOLTIPS_CLASS = 'tooltips_class32';
TTS_ALWAYSTIP = $01;
TTS_NOPREFIX = $02;
TTS_BALLOON = $40;
TTF_SUBCLASS = $0010;
TTF_TRANSPARENT = $0100;
TTF_CENTERTIP = $0002;
TTM_ADDTOOL = $0400 + 50;
TTM_SETTITLE = (WM_USER + 32);
ICC_WIN95_CLASSES = $000000FF;
type
TOOLINFO = packed record
cbSize: Integer;
uFlags: Integer;
hwnd: THandle;
uId: Integer;
rect: TRect;
hinst: THandle;
lpszText: PWideChar;
lParam: Integer;
end;
var
hWndTip: THandle;
ti: TOOLINFO;
hWnd: THandle;
begin
hWnd := Control.Handle;
hWndTip := CreateWindow(TOOLTIPS_CLASS, nil,
WS_POPUP or TTS_NOPREFIX or TTS_BALLOON or TTS_ALWAYSTIP,
0, 0, 0, 0, hWnd, 0, HInstance, nil);
if hWndTip <> 0 then
begin
SetWindowPos(hWndTip, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
ti.cbSize := SizeOf(ti);
ti.uFlags := TTF_CENTERTIP or TTF_TRANSPARENT or TTF_SUBCLASS;
ti.hwnd := hWnd;
ti.lpszText := Text;
Windows.GetClientRect(hWnd, ti.rect);
SendMessage(hWndTip, TTM_SETTIPBKCOLOR, BackCL, 0);
SendMessage(hWndTip, TTM_SETTIPTEXTCOLOR, TextCL, 0);
SendMessage(hWndTip, TTM_ADDTOOL, 1, Integer(@ti));
SendMessage(hWndTip, TTM_SETTITLE, Icon mod 4, Integer(Title));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowBalloonTip(Button1, 1, 'Title',
'Balloon tooltip,http://kingron.myetang.com; updated by Calin', clBlue, clNavy);
end;
相关文章推荐
- Delphi XE7的安卓程序如何调用JAVA的JAR,使用JAVA的类?
- 服务程序中如何得到当前登陆用户名(ZZ)
- Delphi下如何使程序在Win7/Vista上用管理员权限运行
- android工程中引入第三方JAR包后安装APK时老是提示找不到库文件 || Android如何将程序打成jar包 || 运行java.lang.noclassdeffounderror错误
- 如何将C/C++程序转译成Delphi(八)
- 如何让eclipse 集成java开发环境在编辑程序的时候自动给出关键字提示
- 如何在程序中执行动态生成的Delphi代码
- 如何使用IE浏览器自带开发人员工具调试JS程序?
- Spring配置文件applicationContext.xml在myEclipse工具中编写时如何显示标签提示
- Delphi安装NT服务程序时,不出现提示信息
- 如何检查程序内存泄露?如果不用工具,不用code review,如何检查?
- android工程中引入第三方JAR包后安装APK时老是提示找不到库文件 || Android如何将程序打成jar包 || 运行java.lang.noclassdeffounderror错误
- Delphi下如何使程序在Win7/Vista上用管理员权限运行
- java中如何制作可双击执行的程序--jar打包工具的使用
- Delphi-- 如何设置程序开机运行(写注册表)
- Delphi开发工具中如何访问数据库结构 中国教程在线,http://www.5istudy.cn
- FusionCharts简单教程(六)-----如何自定义图表上的工具提示
- 如何让Delphi调用外部程序并等待其运行信息(如结束)
- [delphi]如何为Delphi程序添加事件和事件处理器
- delphi 多线程定时执行程序如何写