Click here to Skip to main content
15,881,027 members
Articles / Desktop Programming / MFC

An Interactive Periodic Table of the Elements

Rate me:
Please Sign up or sign in to vote.
4.81/5 (22 votes)
4 Oct 20032 min read 120.4K   2.5K   34  
An article using GDI to create a scalable periodic table of the elements
// PeriodicTableDlg.h : header file
//

#if !defined(AFX_PERIODICTABLEDLG_H__D1C76008_ED2B_11D7_9F06_0010B53AA77E__INCLUDED_)
#define AFX_PERIODICTABLEDLG_H__D1C76008_ED2B_11D7_9F06_0010B53AA77E__INCLUDED_

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

#include "cAbout.h"
#include "cElementDetails.h"
#include "pteTable.h"

/////////////////////////////////////////////////////////////////////////////
// CPeriodicTableDlg dialog

class CPeriodicTableDlg : public CDialog
{
// Construction
public:
	CPeriodicTableDlg(CWnd* pParent = NULL);	// standard constructor
	void CPeriodicTableDlg::SetSliderPositions();
	void CPeriodicTableDlg::SetSliderValueText();
    void CPeriodicTableDlg::PositionListControls(int, int);
    void CPeriodicTableDlg::PositionSettingsControls(int, int);
	pteTable Table;
	int      OldGroup;

// Dialog Data
	//{{AFX_DATA(CPeriodicTableDlg)
	enum { IDD = IDD_PERIODICTABLE_DIALOG };
	CButton		m_SettingsFrame;
	CStatic		m_SelectGroup;
	CStatic		m_DragSliders;
	CStatic		m_RValue;
	CStatic		m_GValue;
	CStatic		m_BValue;
	CStatic		m_R;
	CStatic		m_G;
	CStatic	    m_B;
	CSliderCtrl	m_SliderRed;
	CSliderCtrl	m_SliderGreen;
	CSliderCtrl	m_SliderBlue;
	CComboBox	m_GroupList;
	CButton	    m_SetFont;
	CListBox	m_ElementList;
	CButton	    m_ClearButton;
	//}}AFX_DATA

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

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CPeriodicTableDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSelchangeGroupList();
	afx_msg void OnClearList();
	afx_msg void OnSetFont();
	afx_msg void OnPaint();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnHelpAbout();
	afx_msg void OnFileExit();
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnSizing( UINT nSide, LPRECT lpRect );
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

#endif // !defined(AFX_PERIODICTABLEDLG_H__D1C76008_ED2B_11D7_9F06_0010B53AA77E__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
Web Developer
United States United States
I'm an ENTP personality type, Ex Army Ranger, former software design engineer for Hewlett-Packard's TV network and now self employed.

Best job: Golf caddy in high school
Worst job: Tele-marketer

Countries Lived in, or visited: USA, Mexico, South Korea, Canada, Japan, North Korea (for 10 seconds), Spain, Germany, Bahrain, Iraq, Saudi Arabia & Panama

Hobbies: Classical Guitar, Video Games, Golf, Pool, Beer, 1/48 scale WWII airplane models, Reading & B-Movies

Comments and Discussions