CMFCPropertyGridToolTipCtrl 類別

備註

Microsoft 基礎類別(MFC)函式庫持續被支援。 不過,我們不再新增功能或更新文件。

實作 CMFCPropertyGridCtrl 類別用來顯示工具提示的工具提示控制件

語法

class CMFCPropertyGridToolTipCtrl : public CWnd

成員

公用建構函式

名稱 描述
CMFCPropertyGridToolTipCtrl::CMFCPropertyGridToolTipCtrl 建構 CMFCPropertyGridToolTipCtrl 物件。
CMFCPropertyGridToolTipCtrl::~CMFCPropertyGridToolTipCtrl 解構函式。

公用方法

名稱 描述
CMFCPropertyGridToolTipCtrl::Create 建立工具提示控件的視窗。
CMFCPropertyGridToolTipCtrl::D eactivate 停用並隱藏工具提示控件。
CMFCPropertyGridToolTipCtrl::GetLastRect 傳回工具提示控件最後一個位置的座標。
CMFCPropertyGridToolTipCtrl::Hide 隱藏工具提示控制件。
CMFCPropertyGridToolTipCtrl::PreTranslateMessage CWinApp 類別用來轉譯分派至 TranslateMessageDispatchMessage Windows 函式之前的視窗訊息。 (覆寫 CWnd::PreTranslateMessage。)
CMFCPropertyGridToolTipCtrl::SetTextMargin 設定工具提示文字與工具提示視窗框線之間的間距。
CMFCPropertyGridToolTipCtrl::Track 顯示工具提示控制件。

備註

當指標位於屬性名稱上時,會顯示工具提示。 CMFCPropertyGridToolTipCtrl 類別會顯示工具提示,讓用戶輕鬆閱讀。 通常,工具提示的位置取決於指標的位置。 藉由使用這個類別,工具提示會出現在屬性名稱上,類似於自然屬性延伸模組,讓屬性名稱完全可見。

MFC 會自動建立此控件,並在 CMFCPropertyGridCtrl 類別中使用

範例

下列範例示範如何建構 類別的物件 CMFCPropertyGridToolTipCtrl ,以及如何顯示工具提示控件。

CMFCPropertyGridToolTipCtrl *pToolTipCtrl = new CMFCPropertyGridToolTipCtrl();
CRect crect(1, 1, 50, 50);
pToolTipCtrl->Track(crect, _T("this is a tool tip control"));

繼承階層架構

CObject

CCmdTarget

CWnd

CMFCPropertyGridToolTipCtrl

需求

標頭: afxpropertygridtooltipctrl.h

CMFCPropertyGridToolTipCtrl::CMFCPropertyGridToolTipCtrl

建構 CMFCPropertyGridToolTipCtrl 物件。

CMFCPropertyGridToolTipCtrl::CMFCPropertyGridToolTipCtrl();

CMFCPropertyGridToolTipCtrl::Create

建立工具提示控件的視窗。

BOOL Create(CWnd* pWndParent);

參數

pWndParent
[in]父視窗的指標。

傳回值

如果已成功建立視窗,則為TRUE;否則為 FALSE。

CMFCPropertyGridToolTipCtrl::D eactivate

停用並隱藏工具提示控件。

void Deactivate();

備註

這個方法會將最後一個位置和文字設定為空白值,讓未來呼叫 CMFCPropertyGridToolTipCtrl::Track 會顯示工具提示。

CMFCPropertyGridToolTipCtrl::GetLastRect

傳回工具提示控件最後一個位置的座標。

void GetLastRect(CRect& rect) const;

參數

rect
[out]包含工具提示控件的最後一個位置。

CMFCPropertyGridToolTipCtrl::Hide

隱藏工具提示控制件。

void Hide();

CMFCPropertyGridToolTipCtrl::SetTextMargin

設定工具提示文字與工具提示視窗框線之間的間距。

void SetTextMargin(int nTextMargin);

參數

nTextMargin
[in]指定工具提示控件文字與工具提示視窗框線之間的間距。 預設值為10圖元。

CMFCPropertyGridToolTipCtrl::Track

顯示工具提示控制件。

void Track(
    CRect rect,
    const CString& strText);

參數

rect
[in]指定工具提示控制件的位置和大小。

strText
[in]指定要顯示在工具提示中的文字。

備註

這個方法會顯示位於 rect指定位置和大小的工具提示控件。 如果自上次呼叫此方法後的位置、大小和文字尚未變更,這個方法就不會有任何作用。

另請參閱

階層架構圖表
類別