Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

3D Thermometer Control

, 2 Feb 2007
3D Thermometer Control Drawn with GDI Plus
thermometerctrltest_app.zip
ThermometerCtrlTest.exe
thermometerctrltest_src.zip
ThermometerCtrlTest
ThermometerCtrlTest.aps
ThermometerCtrlTest.ico
ThermometerCtrlTest.manifest
ThermometerCtrlTest.ncb
ThermometerCtrlTest.suo
//==============================================================================
// TempCtrl.h : Thermometer Control (GDI+)
//==============================================================================
#ifndef ___TEMPCTRL_H___
#define ___TEMPCTRL_H___
#pragma once


class CTempCtrl : public CStatic
{
public:
	DECLARE_DYNAMIC(CTempCtrl)

	// Construction / Destruction
	CTempCtrl();
	virtual ~CTempCtrl();

protected:
	// Properties
	double		m_dRangeMin;
	double		m_dRangeMax;
	double		m_dVal;
	BOOL		m_bDrawTics;
	int			m_iSmallTicFreq;
	int			m_iLargeTicFreq;
	BOOL		m_bDisplayF;
	COLORREF	m_clrFore;

public:
	// Implementation
	void GetRange(double& dMin, double& dMax);
	void SetRange(double dMin, double dMax, BOOL bRedraw = TRUE);
	double GetRangeMin(){return m_dRangeMin;}
	void SetRangeMin(double dMin, BOOL bRedraw = TRUE);
	double GetRangeMax(){return m_dRangeMax;}
	void SetRangeMax(double dMax, BOOL bRedraw = TRUE);
	double GetPos(){return m_dVal;}
	void SetPos(double dPos, BOOL bRedraw = TRUE);
	BOOL GetDisplayFahrenheit(){return m_bDisplayF;}
	void SetDisplayFahrenheit(BOOL b){m_bDisplayF = b;}
	COLORREF GetForeColor(){return m_clrFore;}
	void SetForeColor(COLORREF clr){m_clrFore = clr;}

	// Overrides
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void PreSubclassWindow();
	virtual void DrawItem(LPDRAWITEMSTRUCT pDI);

protected:
	// Helper Functions
	Color OffsetColor(Color clr, short sOffset);
	void FillCylinder(Graphics* pGfx, RectF rCtrl, 
		Brush* pFillBrush, Color cOutlineColor);

	// Message Handlers
	DECLARE_MESSAGE_MAP()
	afx_msg void OnPaint();
};


#endif // ___TEMPCTRL_H___

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

Share

About the Author

JJMatthews
Software Developer
United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 2 Feb 2007
Article Copyright 2007 by JJMatthews
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid