delphi实现起泡提示效果
2020-12-28 03:27
标签:char 内容 dialog tle size $1 text classes api unit Unit1; delphi实现起泡提示效果 标签:char 内容 dialog tle size $1 text classes api 原文地址:https://www.cnblogs.com/zyb2016/p/13330053.html
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
const
ECM_FIRST = $1500;
EM_SHOWBALLOONTIP = ECM_FIRST + 3;
EM_HIDEBALLOONTIP = ECM_FIRST + 4;
type
_tagEDITBALLOONTIP = packed record
cbStruct: DWORD;
pszTitle,
pszText : PWideChar;
ttiIcon : integer;
end;
TEditBalloonTip = _tagEDITBALLOONTIP;
type
TForm1 = class(TForm)
edit1: TEdit;
button1: TButton;
Memo1: TMemo;
procedure button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.button1Click(Sender: TObject);
var
ebt: TEditBalloonTip;
begin
with ebt do
begin
cbStruct := SizeOf(ebt);
pszTitle := ‘提示‘;
pszText := ‘请输入内容‘;
ttiIcon := 3; {NONE:0;INFO:1;WARNING:2;ERROR:3 不同状态}
end;
SendMessage(memo1.Handle,EM_SHOWBALLOONTIP,0,Longint(@ebt));
end;
end.