Delphi 7下Edit控件的气泡提示
来源:互联网 发布:编程入门书籍 知乎 编辑:程序博客网 时间:2024/04/29 19:45
在Windows XP以及以上版本,基本控件Edit都有一个好看的气泡提示框,可惜Delphi 7还不支持这种效果,但是因为Edit是基本控件,只要在XP及以上版本,发送气泡显示消息,也就可以让其显示气泡提示。
MSDN介绍EDITBALLOONTIP结构体如下:
1
2
3
4
5
6
typedef struct tagEDITBALLOONTIP {
DWORD cbStruct;
LPCWSTR pszTitle;
LPCWSTR pszText;
INT ttiIcon;
} EDITBALLOONTIP, *PEDITBALLOONTIP;
2
3
4
5
6
typedef struct tagEDITBALLOONTIP {
DWORD cbStruct;
LPCWSTR pszTitle;
LPCWSTR pszText;
INT ttiIcon;
} EDITBALLOONTIP, *PEDITBALLOONTIP;
Delphi 7下必须要放置XPMan控件,才能显示出XP风格的气泡提示框。具体实现示例源码:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan;
//---------------------开始:Delphi 7 添加此声明消息----------------------------
const
ECM_FIRST = $1500; // Edit control messages
EM_SHOWBALLOONTIP = ECM_FIRST + 3; // Show a balloon tip associated to the edit control
EM_HIDEBALLOONTIP = ECM_FIRST + 4; // Hide any balloon tip associated with the edit control
type
_tagEDITBALLOONTIP = packed record
cbStruct: DWORD;
pszTitle,
pszText : PWideChar;
ttiIcon : integer;
end;
TEditBalloonTip = _tagEDITBALLOONTIP;
//---------------------结束:Delphi 7 添加此声明消息----------------------------
type
TForm1 = class(TForm)
edt1: TEdit;
btn1: TButton;
xpmnfst1: TXPManifest;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
var
ebt: TEditBalloonTip;
begin
with ebt do
begin
cbStruct := SizeOf(ebt);
pszTitle := '提示';
pszText := '请输入内容';
ttiIcon := 1; {NONE:0;INFO:1;WARNING:2;ERROR:3}
end;
SendMessage(edt1.Handle,EM_SHOWBALLOONTIP,0,Longint(@ebt));
end;
end.
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan;
//---------------------开始:Delphi 7 添加此声明消息----------------------------
const
ECM_FIRST = $1500; // Edit control messages
EM_SHOWBALLOONTIP = ECM_FIRST + 3; // Show a balloon tip associated to the edit control
EM_HIDEBALLOONTIP = ECM_FIRST + 4; // Hide any balloon tip associated with the edit control
type
_tagEDITBALLOONTIP = packed record
cbStruct: DWORD;
pszTitle,
pszText : PWideChar;
ttiIcon : integer;
end;
TEditBalloonTip = _tagEDITBALLOONTIP;
//---------------------结束:Delphi 7 添加此声明消息----------------------------
type
TForm1 = class(TForm)
edt1: TEdit;
btn1: TButton;
xpmnfst1: TXPManifest;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
var
ebt: TEditBalloonTip;
begin
with ebt do
begin
cbStruct := SizeOf(ebt);
pszTitle := '提示';
pszText := '请输入内容';
ttiIcon := 1; {NONE:0;INFO:1;WARNING:2;ERROR:3}
end;
SendMessage(edt1.Handle,EM_SHOWBALLOONTIP,0,Longint(@ebt));
end;
end.
运行结果如下图所示:
- Delphi 7下Edit控件的气泡提示
- 为Edit加气泡提示
- delphi 气泡提示
- 有关delphi气泡提示问题
- grumble.js 气泡形状的提示(Tooltip)控件
- Grumble.js气泡形状的提示(Tooltip)控件
- grumble.js--气泡形状的提示(Tooltip)控件
- Delphi 三种气泡提示效果
- Delphi调用IUserNotification2显示气泡提示
- Delphi 三种气泡提示效果
- Delphi 三种气泡提示效果
- Delphi标准控件-编辑框(Edit)
- Delphi 让Edit控件只能输入数字
- Delphi在Listview中加入Edit控件
- 解决VC2008下气泡提示问题
- EDIT控件的用法
- EDIT控件的用法
- MFC的EDIT控件
- 今天天气好晴朗
- FETCH cursor bulk collect INTO,游标批量获取
- 删除主数据问题
- 图像形态学 漫水填充算法
- ACE 输出日志
- Delphi 7下Edit控件的气泡提示
- c++设计模式(3)-Builder
- 关于字节对齐的总结
- 利用 STAF 实现程序更新包的自动部署测试
- Oracle查询优化4大方面的主要途径(1)
- Rebar:Erlang构建工具
- seo必须知道的技巧
- Oracle查询优化4大方面的主要途径(2)
- 让log4net保存自定义对象信息到数据库中