Click here to Skip to main content
15,886,110 members
Articles / Desktop Programming / MFC

Static Control with ToolTip

Rate me:
Please Sign up or sign in to vote.
2.95/5 (10 votes)
13 Sep 2007CPOL 41.4K   2.1K   13  
The Tool Tip shows the Text of Static Control when the Text is clipped in Static Control.
//�y FileName �zTlTipStc.h
//
//�y Outline �z CToolTipStatic 
//
//�y History �z [new] 2006/10/31 Sandesh
///////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_TLTIPSTC_H__36F47BA3_E904_4C12_9549_5D9F7E5CF483__INCLUDED_)
#define AFX_TLTIPSTC_H__36F47BA3_E904_4C12_9549_5D9F7E5CF483__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define TOOLTIP_ID		1		//ToolTip ID 

/////////////////////////////////////////////////////////////////////////////
// CToolTipStatic 

class CToolTipStatic : public CStatic
{
// Constructor
public:
	CToolTipStatic();

public:

	//{{AFX_VIRTUAL(CToolTipStatic)
	public:
	virtual void PreSubclassWindow();
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	//}}AFX_VIRTUAL

public:
	virtual ~CToolTipStatic();

protected:
	//{{AFX_MSG(CToolTipStatic)
	afx_msg void OnPaint();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

protected:
	//����֐�
	BOOL _SetText();		//Used when the window is active to set the text.

	//�֐�
public:
	//--- �������Ǘ�����@�\ ---//
	BOOL SetText(LPCTSTR pszText);										// �������w��
	BOOL GetText(CString& strText);										// �������擾

	BOOL SetFGColor(BYTE btRed, BYTE btGreen, BYTE btBlue);				//�e�L�X�g�̐F��w��
	BOOL GetFGColor(BYTE& btRed, BYTE& btGreen, BYTE& btBlue);			//�e�L�X�g�̐F��擾
	
	BOOL SetBGColor(BYTE btRed, BYTE btGreen, BYTE btBlue);				//�w�i�̐F��w��
	BOOL GetBGColor(BYTE& btRed, BYTE& btGreen, BYTE& btBlue);			//�w�i�̐F��擾
	
	//--- ToolTip��Ǘ�����@�\ ---//
	BOOL SetToolTipFGColor(BYTE btRed, BYTE btGreen, BYTE btBlue);		//ToolTip�e�L�X�g�̐F��w��
	BOOL GetToolTipFGColor(BYTE& btRed, BYTE& btGreen, BYTE& btBlue);	//ToolTip�e�L�X�g�̐F��擾

	BOOL SetToolTipBGColor(BYTE btRed, BYTE btGreen, BYTE btBlue);		//Tool-Tip�̔w�i�̐F��ݒ�
	BOOL GetToolTipBGColor(BYTE& btRed, BYTE& btGreen, BYTE& btBlue);	//Tool-Tip�̔w�i�̐F��擾

protected:
	CString			m_strText;			//�@Dialog������
	COLORREF		m_clrFont;			//�@�e�L�X�g�̐F
	COLORREF		m_clrBckGnd;		//	�w�i�̐F
	CToolTipCtrl	m_ToolTip;			//  ToolTip object

	COLORREF		m_clrTTFont;		//�@ToolTip�̃e�L�X�g�̐F
	COLORREF		m_clrTTBckGnd;		//	Tool-Tip�̔w�i�̐F

	BOOL			m_bToolTipCreated;	// Indicates Tool Tip is created.
	CFont			m_font;				// Static control's font
	BOOL			m_bFontInit;		// Indicates m_font is created
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ �͑O�s�̒��O�ɒlj��̐錾��}�����܂��B

#endif // !defined(AFX_TLTIPSTC_H__36F47BA3_E904_4C12_9549_5D9F7E5CF483__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
me a VC++ programmer

Comments and Discussions