📄 tooltipex.h
字号:
#if !defined(AFX_TOOLTIPEX_H__7A17148C_4718_4173_8653_8A196E76F87B__INCLUDED_)
#define AFX_TOOLTIPEX_H__7A17148C_4718_4173_8653_8A196E76F87B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ToolTipEx.h : header file
//
// default tooltip colors
#define IVORY RGB(255, 255, 220)
#define BLACK RGB(0, 0, 0)
#define TIP_IVORY ::GetSysColor(COLOR_INFOTEXT)
#define TIP_BACK ::GetSysColor(COLOR_INFOBK)
// this structure holds all the tooltip information
class ToolTipInfo : public CObject
{
public:
ToolTipInfo();
virtual ~ToolTipInfo();
public:
UINT nControlID; // ID of the control
UINT nInfoSize; // number of lines in the info
CStringArray nControlInfo; // container of the information
COLORREF nTextColor; // text color
COLORREF nBackColor; // background color
};
// this structure holds all the Celltooltip information
class CellTipInfo : public CObject
{
public:
CellTipInfo();
virtual ~CellTipInfo();
public:
BOOL m_bShowing;
UINT m_iCellID; // ID of the cell
CStringArray m_ayCellInfo; // container of the information
COLORREF m_crTextColor; // text color
COLORREF m_crBackColor; // background color
CRect m_rectShow; // TipInfo rect
};
/////////////////////////////////////////////////////////////////////////////
// CToolTipEx window
class CToolTipEx : public CWnd
{
// Construction
public:
CToolTipEx();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CToolTipEx)
//}}AFX_VIRTUAL
// Implementation
public:
BOOL AddCellInfo(UINT uCellID, LPCTSTR strInfo, COLORREF crBack = TIP_BACK, COLORREF crText = TIP_IVORY);
void ShowCellTip(UINT uCellID,CPoint &pt);
BOOL RemoveCellInfo(UINT uCellID);
void ErasePreviousCellTipDisplay(UINT uCellID);
BOOL AddCellInfo(UINT nCellID, CStringArray &strayInfo, COLORREF crBack = TIP_BACK, COLORREF crText = TIP_IVORY);
BOOL RemoveControlInfo( UINT );
BOOL AddControlInfo( UINT, CStringArray&, COLORREF back=IVORY, COLORREF text=BLACK );
void ShowToolTip( CPoint& ); // called only during Mousemovement
void ShowToolTip( UINT ); // explicitly shown the tooltip given the control ID
void ErasePreviousToolTipDisplay( UINT );
void SetFontSize( int size );
void Create(CWnd* pWnd);
virtual ~CToolTipEx();
// Generated message map functions
protected:
void CalculateCellInfoBoxRect(CellTipInfo *pTipInfo,CPoint &pt);
virtual void CalculateHeightAndWidth(CStringArray& straInfos);
virtual void CalculateInfoBoxRect(UINT nControlID, CRect* pInfoRect);
CWnd *m_pParentWnd;
int m_nHeight;
int m_nWidth;
int m_nFontSize;
int m_nTotalLine;
int m_maxCharInLine;
//{{AFX_MSG(CToolTipEx)
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CellTipInfo* IsCellIDExisting(UINT uCellID);
void DisplayCellInfo(CellTipInfo *pTipInfo,CPoint &pt);
UINT m_currentControlID;
UINT m_currentCellID;
CObArray m_aControlInfo;
CObArray m_ayCellInfo;
ToolTipInfo* IsControlIDExisting( UINT );
void DisplayInfo( ToolTipInfo* );
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TOOLTIPEX_H__7A17148C_4718_4173_8653_8A196E76F87B__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -