Delphi 修改hint的颜色,不用黄地黑字的那种,可不可以更换颜色,在哪儿换呀
可以在如下方法里做到吗?望有高人指点……
限于篇幅暂且放一方法,如有必要再贴全了它。还望有高人赐教呀!!!
小弟先在此谢过!!
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,0,Integer(@ToolInfo));
SendMessage(hWndTip,TTM_SETTITLE,1,Integer(Title));
end;
InitCommonControls();
end;
可以在如下方法里做到吗?望有高人指点……
限于篇幅暂且放一方法,如有必要再贴全了它。还望有高人赐教呀!!!
小弟先在此谢过!!
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,0,Integer(@ToolInfo));
SendMessage(hWndTip,TTM_SETTITLE,1,Integer(Title));
end;
InitCommonControls();
end;
解决方案 »
- HooK反汇编里的语句
- 如何让一个程窗口化运行,如劲舞
- 一个TIdTcpClient控件的使用问题
- 在DBGrid直接修改数据,想在数据写入数据库前进行有效性验证,应该在哪个控件的哪个事件里面写代码。。我不太熟悉delphi。。都快被这个事
- 请教一下隐藏MENU阴影的问题,谢谢了.
- 关于的Delphi 7.0 中带的 ModelMaker,你有在开发中应用吗?
- 大家帮忙看看,这个是干什么用的?菜鸟我不会~不懂
- 关于类的申明!!!
- 关于网络程序调试时的疑惑:
- 我和我的女友刚认识半个月,为了我的理想,但我又决定要去深圳发展,她很喜欢我,我也喜欢她
- showmodal窗体时出现错误
- 用delphi写 阴历转阳历的函数
添加一个
Graphics然后
Application.HintColor:= clYellow;
THintWindow = class(TCustomControl)
private
FActivating: Boolean;
FLastActive: Cardinal;
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure NCPaint(DC: HDC); virtual;
procedure Paint; override;
procedure WMPrint(var Message: TMessage); message WM_PRINT;
public
constructor Create(AOwner: TComponent); override;
procedure ActivateHint(Rect: TRect; const AHint: string); virtual;
procedure ActivateHintData(Rect: TRect; const AHint: string; AData: Pointer); virtual;
function CalcHintRect(MaxWidth: Integer; const AHint: string;
AData: Pointer): TRect; virtual;
function IsHintMsg(var Msg: TMsg): Boolean; virtual;
procedure ReleaseHandle;
property BiDiMode;
property Caption;
property Color;
property Canvas;
property Font;
end;
SendMessage(hWndTip,TTM_ADDTOOL,0,Integer(@ToolInfo));
SendMessage(hWndTip, TTM_SETTIPBKCOLOR, $ebebeb, 0); //设置背景色
SendMessage(hWndTip, TTM_SETTIPTEXTCOLOR, $808080 , 0); //设置字体颜色
SendMessage(hWndTip,TTM_SETTITLE,1,Integer(Title));我把那个完整的单元传到我的资源了。感兴去的朋友可以下下来看看……