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

Using the CStatic control

Rate me:
Please Sign up or sign in to vote.
4.83/5 (28 votes)
23 Mar 2001 526.7K   6.3K   92  
An entry level tutorial on using the CStatic control
// StaticCtrlTutorialDlg.h : header file
//

#if !defined(AFX_STATICCTRLTUTORIALDLG_H__2DF162FE_B030_11D4_BBCF_0000B44EED3A__INCLUDED_)
#define AFX_STATICCTRLTUTORIALDLG_H__2DF162FE_B030_11D4_BBCF_0000B44EED3A__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CStaticCtrlTutorialDlg dialog

class CStaticCtrlTutorialDlg : public CDialog
{
// Construction
public:
	CStaticCtrlTutorialDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CStaticCtrlTutorialDlg)
	enum { IDD = IDD_STATICCTRLTUTORIAL_DIALOG };
	CStatic	m_Report;
	CButton	m_Group;
	CStatic	m_EMF;
	CStatic	m_Prefix;
	CStatic	m_Var;
	CStatic	m_Icon;
	CStatic	m_Bitmap;
	CString	m_strVar;
	BOOL	m_bPrefix;
	BOOL	m_bToggleIcon;
	int		m_Radio;
	BOOL	m_bEnableBitmap;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CStaticCtrlTutorialDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;
	BOOL m_bCentered;

	// Generated message map functions
	//{{AFX_MSG(CStaticCtrlTutorialDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnStaticicon();
	afx_msg void OnCheckBox1();
	afx_msg void OnPrefix();
	afx_msg void OnToggleicon();
	afx_msg void OnEnableBitmap();
	//}}AFX_MSG
	afx_msg void OnStaticbitmap();
	afx_msg void OnBitmapDisabled();
	afx_msg void OnBitmapDblClk();
	afx_msg void OnBitmapEnabled();
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STATICCTRLTUTORIALDLG_H__2DF162FE_B030_11D4_BBCF_0000B44EED3A__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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Engineer Retired
Australia Australia
Started working with computers when I/O was with punched paper tape, using Algol. Then learned Fortran, Basic, various Assemblers, Forth and Postscript. Built a robot in the early '80s. When I finally got a PC I learned C, C++ and more recently worked on a variety of .NET and PHP projects. Senior Software Engineer at MedTech Global in Melbourne, Australia.

Comments and Discussions