Click here to Skip to main content
15,894,825 members
Articles / Desktop Programming / MFC

A Better Bitmap Button Class

Rate me:
Please Sign up or sign in to vote.
3.46/5 (14 votes)
14 Oct 2001 398.4K   9.2K   80  
An improvement on the CBitmapButton class.
// buttonDlg.h : header file
//

#if !defined(AFX_BUTTONDLG_H__A87BCD77_AB36_11D3_9FE1_006067718D04__INCLUDED_)
#define AFX_BUTTONDLG_H__A87BCD77_AB36_11D3_9FE1_006067718D04__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CButtonDlg dialog

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

// Dialog Data
	//{{AFX_DATA(CButtonDlg)
	enum { IDD = IDD_BUTTON_DIALOG };
	CToggleButton	c_Toggle;
	CButton	c_DownUp;
	CButton	c_Autogray;
	CButton	c_Fill;
	CButton	c_Picture;
	CButton	c_Smiley;
	CStatic	c_Limit;
	CButton c_Left;
	CButton c_Center;
	CButton c_Right;
	CButton c_Top;
	CButton c_VCenter;
	CButton c_Bottom;
	CSpinButtonCtrl	c_SpinWidth;
	CSpinButtonCtrl	c_SpinHeight;
	CButton	c_Enabled;
	CImageToggleButton	c_Button;
	CImageToggleButton	c_Button2;
	//}}AFX_DATA

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

// Implementation
protected:
	HICON m_hIcon;
	void setButtonPos(int width, int height);
	void setImage(CImageToggleButton &button);
	void setImage();
	void updateControls();

	// Generated message map functions
	//{{AFX_MSG(CButtonDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	virtual void OnCancel();
	virtual void OnOK();
	afx_msg void OnBottom();
	afx_msg void OnEnable();
	afx_msg void OnHcenter();
	afx_msg void OnLeft();
	afx_msg void OnRight();
	afx_msg void OnTop();
	afx_msg void OnVcenter();
	afx_msg void OnChangeHeight();
	afx_msg void OnChangeWidth();
	afx_msg void OnSmiley();
	afx_msg void OnPicture();
	afx_msg void OnFill();
	afx_msg void OnAutogray();
	afx_msg void OnDownup();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

#endif // !defined(AFX_BUTTONDLG_H__A87BCD77_AB36_11D3_9FE1_006067718D04__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.


Written By
Retired
United States United States
PhD, Computer Science, Carnegie Mellon University, 1975
Certificate in Forensic Science and the Law, Duquesne University, 2008

Co-Author, [i]Win32 Programming[/i]

Comments and Discussions