⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sherryhint.pas

📁 Delphi气泡提示的实现
💻 PAS
字号:
unit SherryHint;

interface

uses
  Windows, Messages, Classes, Controls, Forms, CommCtrl;

type
  THintWin=class(THintWindow)
  private
    FLastActive: THandle;
  public
    procedure ActivateHint(Rect:TRect;Const AHint:string);override;
  end;

implementation

procedure AddTipTool(hWnd: DWORD; IconType: Integer; Title, Text: PChar);
const
  TTS_BALLOON =$0040;
  TTM_SETTITLE=WM_USER + 32;
var
  hWndTip: DWORD;
  ToolInfo: TToolInfo;
begin
  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
    ToolInfo.cbSize:=SizeOf(ToolInfo);
    ToolInfo.uFlags:=TTF_IDISHWND or TTF_SUBCLASS or TTF_TRANSPARENT;
    ToolInfo.uId:=hWnd;
    ToolInfo.lpszText:=Text;
    SendMessage(hWndTip,TTM_ADDTOOL,1,Integer(@ToolInfo));
    SendMessage(hWndTip,TTM_SETTITLE,IconType,Integer(Title));
  end;
  InitCommonControls();
end;

procedure THintWin.ActivateHint(Rect:TRect;const AHint:string);
begin
  if FLastActive<>WindowFromPoint(Mouse.CursorPos) then
  AddTipTool(WindowFromPoint(Mouse.CursorPos),1,'Sherry SoftWare', PChar(AHint));//Application.Hint));
  FLastActive:=WindowFromPoint(Mouse.CursorPos);
end;

initialization
 Application.HintPause:=0;
 Application.ShowHint:=False;
 HintWindowClass:=THintWin; 
 Application.ShowHint:=True;
end. 


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -