• 球形提示


    {
     ShowBalloonTip(Memo1, 1, '球形提示',
     'Selonboy:'+#13#10+'Http://www.SelonSoft.com'+#13#10+'QQ:289161766', $00E8FFFF, clred);
    }

    unit BallTip;

    interface

    uses
      SysUtils,Windows,Controls,Graphics,Messages,CommCtrl;

    procedure ShowBalloonTip(Control: TWinControl; Icon: integer; Title: pchar; Text: PWideChar;
    BackCL, TextCL: TColor);

    implementation

    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);
      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 := 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));
      end;
    end;

    end.

  • 相关阅读:
    PHP:__get()、__set()、__isset()、__unset()、__call()、__callStatic()六个魔术方法
    概念:RPG游戏中两个兵种互相攻击的逻辑
    php怎么获取checkbox复选框的内容?
    20150724之问题
    Uploadify 之使用
    oneThink后台添加插件步骤详解
    针对各种浏览器,前端解决方案(持续更新...)
    解决IE8中select下拉列表文字上下不居中的问题
    针对IE6 7 8当独写样式
    document对象详解
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/2940618.html
Copyright © 2020-2023  润新知