Cita:
Empezado por Alejo15x
Hola.
Pues eso, como hago para que los Hints delos componentes se vean como Balloons?.
Osea algo asì.
Tal cual?. Selos agradecere un monton!
Un Saludote!
|
Pues por supuesto que se puede hacer:
Mira este Procedure>
Código Delphi
[-]procedure TForm1.ShowBalloonTip(Control: TWinControl; Icon: integer; Titulo: PChar;
Texto: 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 := Texto;
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(Titulo));
end;
end;
Ese Procedimiento lo puedes llamar desde el evento
OnCreate del formulario y poner al Control(Botones,edits,etc) con el ballon repectivo, mas o menos asi:
Código Delphi
[-]procedure TForm1.FormCreate(Sender: TObject);
begin
ShowBalloonTip(Button1,1,'My Título','My Hint',clAqua,clBlack);
end;
.
Y puedes usarlo para cualquier otro control;y si te fijas puedes ponerle cualquier color al Ballon(Globo) y al texto, también puedes cambiar el pequeño iconito que sale.
.
Espero te sea de utilidad.
.
Saludos...