提示控制項的使用

2021-06-11 09:18:04 字數 2012 閱讀 5715

//我們知道,當我們在使用乙個軟體時,我們移動滑鼠,當游標移到乙個按鈕或其他控制項上時,一般會出現乙個矩形的提示框,列出相關資訊,下面我們利用提示控制項實現這一功能。

下面的**我是參考其他資料完善的。

#include "stdafx.h"

#include "resource.h"

#include "windows.h"

#include "tchar.h"

#include "commctrl.h"

#pragma comment(lib,"comctl32.lib")

tchar tooltipsclassname = _t("tooltips_class32");

tchar maindialogtext1 = _t("this is the upper left area of the dialog");

tchar maindialogtext2 = _t("this is the upper right area of the dialog");

tchar maindialogtext3 = _t("this is the lower left area of the dialog");

tchar maindialogtext4 = _t("this is the lower right area of the dialog");

hinstance g_hinstance;

hwnd hwndtool;

void setdlgtoolarea(hwnd hdlg,lptoolinfo pti,lpstr lptext,dword id,rect *lprect)

else if(id == 1)

else if(id == 2)

else

pti->lpsztext = lptext;

sendmessage(hwndtool,ttm_addtool,null,(lparam)pti);

}bool callback enumchild( hwnd hwnd,

lparam lparam);

lptoolinfo pti = (lptoolinfo)lparam;

pti->uid = (uint)hwnd;

pti->uflags |= ttf_idishwnd;

getwindowtext(hwnd,buffer,255);

pti->lpsztext = buffer;

sendmessage(hwndtool,ttm_addtool,null,(lparam)pti);

return true;

}int_ptr callback dialogproc(

hwnd hwnddlg,

uint umsg,

wparam wparam,

lparam lparam

)return true;

}int winapi winmain(     hinstance hinstance,

hinstance hprevinstance,

lpstr lpcmdline,

int ncmdshow

)ps:msdn上是這樣寫的,已經除錯過,可以直接使用:

void createtooltipforrect(hwnd hctrl,tchar *sztext)//hctrl是控制項的控制代碼,sztext是滑鼠滑動到該控制項上顯示的文字

;ti.cbsize = sizeof(toolinfo);

ti.uflags = ttf_subclass;

ti.hwnd = hctrl;

ti.hinst = hinst;

ti.lpsztext = sztext;

getclientrect (hctrl, &ti.rect);

// associate the tooltip with the "tool" window.

sendmessage(hwndtt, ttm_addtool, 0, (lparam) (lptoolinfo) &ti);    }

tooltip提示控制項

這些天忙於公司專案的改版就很少來這裡發表文章了,今天趁著週末休息給大家分享乙個jquery提示控制項。可用於顯示載入提示 錯誤提示 操作提示等。先上張預覽圖 提示條樣式可以自己定義,支援關閉 和鎖屏,自適應居中,採用fixed定位 暫未考慮相容ie6 下面是原始碼 注 引入該js時放在body內,不...

DEV提示控制項ToolTipControl

1 設定邊框的顏色和顯示箭頭圖示 在建構函式裡面設定 public frmlogin initializecomponent 2 針對某一控制項設定提示 呼叫tooltip控制項的showhint屬性,常用有4個引數的過載 引數1 要設定的提示內容 引數2 標題 引數3 要設定顯示提示的控制項 引數...

使用WebView控制項時執行出現錯誤提示

在使用webview控制項時,執行過程中單擊沒有效果,並提示以下錯誤 qsslsocket cannot call unresolved function sslv23 client method qsslsocket cannot call unresolved function ssl ctx ...