Можно попробовать сделать через THintWindow.
Код |
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Edit1: TEdit; procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; HintWindow: THintWindow; implementation
{$R *.dfm}
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); const MsgText = 'Показываем не то что надо'; var Rect: TRect; begin if not (Key in [#13, #8, 'à'..'ÿ', 'À'..'ß']) then begin Key := #0; if not (Sender is TControl) then if TControl(Sender).Parent = Nil then Exit; Rect := HintWindow.CalcHintRect(Screen.Width, MsgText, nil); with TControl(Sender).Parent.ClientToScreen(TControl(Sender).BoundsRect.BottomRight) do OffsetRect(Rect, X, Y); HintWindow.ActivateHint(Rect, MsgText); end else if HintWindow.Showing then HintWindow.Hide; end;
procedure TForm1.FormCreate(Sender: TObject); begin HintWindow := THintWindow.Create(Self); end;
end.
|
Вообще тема больше подходит для Delphi раздела нежели для центра помощи, ИМХО. |