自定义hint
程序里hint很简单 我现在想做一个稍微复杂一些的
代替原始的hint ,至少能及时显示出更多的信息
问题点数:0、回复次数:9Top
1 楼cczlp(不惑)回复于 2005-04-02 13:46:49 得分 0
用 THintWindowTop
2 楼constantine(飘遥的安吉儿)回复于 2005-04-02 14:47:37 得分 0
对,但是如果要功能跟强大就从THintWindow继承
自己在扩充他的功能
写法可以用
TFlatHintwindow 控件的实现,有delphi的源代码,改起来也不能Top
3 楼CORBABOY(())回复于 2005-04-02 19:50:37 得分 0
THintWindow怎么用?Top
4 楼clong320(clong320)回复于 2005-04-04 14:27:19 得分 0
学习!学习!Top
5 楼songhtao(三十年孤独)回复于 2005-04-04 14:43:29 得分 0
THintWindow implements the small pop-up window that appears over a control at runtime when the control has its ShowHint property set to true.
Unit
Controls
Description
Use THintWindow to display a Help Hint pop-up window directly from an application. Override THintWindow to customize the window that appears automatically for controls with their ShowHint property set to true. After overriding THintWindow to create a new derived type, assign the new type to the global HintWindowClass variable at application startup, so that the new hint window type is used for Help Hints.
The hint window抯 BiDiMode is always set to the BiDiMode of the control that activates it. If the mode is bdRightToLeft, then the hint is left-aligned to the cursor.Top
6 楼MEFULEU(没有作不到,只有想不到)回复于 2005-04-04 15:16:47 得分 0
//在一个句炳上显示提示hint
void ShowBalloonTip(TWinControl *Control, int Icon, char *Title,char * Text)
{
HANDLE hWndTip ;
TOOLINFO ti;
HANDLE hWnd ;
hWnd = Control->Handle;
hWndTip = CreateWindow(TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_BALLOON | TTS_ALWAYSTIP,
0, 0, 0, 0, hWnd, 0, HInstance, NULL);
if (hWndTip != 0)
{
SetWindowPos(hWndTip, HWND_TOPMOST, 0, 0, 0, 0,SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_CENTERTIP | TTF_TRANSPARENT | TTF_SUBCLASS;
ti.hwnd = hWnd;
ti.lpszText = Text;
GetClientRect(hWnd, &ti.rect);
SendMessage(hWndTip, TTM_ADDTOOL, 1, int(&ti));
SendMessage(hWndTip, TTM_SETTITLE, Icon % 4, int(Title)); //4行
}
}
//调用:
ShowBalloonTip(Button1, 1, "Title","显示的Hint内容!");Top
7 楼constantine(飘遥的安吉儿)回复于 2005-04-04 16:21:24 得分 0
上面代码可以做参考,有待改善
还有就我所知有很多控件是显示不了的Top
8 楼icwin(www.cat898.com.cn)回复于 2005-04-16 17:28:45 得分 0
upTop
9 楼tgzhang(张三)回复于 2005-06-23 17:09:20 得分 0
其实有个非常简单的办法:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
...
Application->OnHint = DisplayHint;
...
}
-----------
void __fastcall TForm1::DisplayHint(TObject *Sender)
{
StatusBar1->Panels->Items[1]->Text = GetLongHint(Application->Hint);
}Top




