Drop-in MFC class to display temperature
I had the need to display temperature readings from sensors.
After taking apart a couple of very nice controls written by
Davide Calabro I decided to try and show off.
This project was built and tested on Windows XP using Visual Studio 2003 SP1
Using the code
- Add GDI+ support to your application: Starting with GDI+
- Add TempCtrl.h and TempCtrl.cpp to your project.
- Include TempCtrl.h in your main window/form view class.
- Create a member variable of type
- In the window initialization, subclass the thermometer:
BOOL int CMainDlg::OnInitDialog()
Very special thanks to Davide Calabro for his knob and cylinder progress controls:
The control's size currently has to be within a certain range
to be look right. In the future I will dynamically set line
widths, font sizes, etc from the control size.
Jan 31st 2007 - Original Article.