Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Balloon Tips für Image-Komponenten ??? (https://www.delphipraxis.net/30856-balloon-tips-fuer-image-komponenten.html)

max666 30. Sep 2004 09:42


Balloon Tips für Image-Komponenten ???
 
Hallo!

Ich habe folgendes Problem: Ich wollte ein kleines Programm schreiben, bei dem Balloon Tips (nicht Hints) auch über Image-Komponenten entstehen. Im Internet habe ich nachfolgenden Code gefunden, der aber nur mit Controls funktioniert, aufgrund der Handle-Übergabe. Da Image-Komponenten die Eigenschaft "Iameg1.Handle" nicht besitzen, komme ich mit dem Code so nicht weiter.

Hat jemand eine Idee, wie man Balloon Tips auch für Image-Komponenten erzeugt?

Gruß aus dem Emsland
Max666

Delphi-Quellcode:
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);
    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));
    SetWindowPos(hWndTip, HWND_TOP, 0, 0, 0,0, SWP_NOSIZE);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowBalloonTip(Button1, 1, 'Title',
  'Balloon tooltip,[url]http://kingron.myetang.com;[/url] updated by Calin', clWhite, clBlack);
end;

Alex_ITA01 8. Okt 2004 13:46

Re: Balloon Tips für Image-Komponenten ???
 
am besten mit
Delphi-Quellcode:
//Oder Image1.Parent.Handle -> weiß nicht mehr genau :-)))
ShowBalloonTip(Image1.Parent, 1, 'Title',
  'Balloon tooltip,[url]http://kingron.myetang.com;[/url] updated by Calin', clWhite, clBlack);
MFG Alex


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:23 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz