Building the Right Environment to Support AI, Machine Learning and Deep Learning
Environment: Compiled using VC6.0 Sp3 and tested using Win95/98 WinNT4.0 and Win 2000
This article introduces a simple "cylinder" type of compass control based from CStatic. This will allow the control to be used within a dialog using the MFC Class Wizard Dialog or as a static control within a window.
The compass control is easy to use and has two member functions to control the compass.
From a Dialog
Before you begin, make sure that the compass control class is registered in the Class Wizard database.
- In a dialog, inset a picture control.
- Set the picture ID.
- Create a member variable using the Class Wizard Dialog. Make sure that the category is Control and that Variable Type is CCompass.
UINT SetPos( int nPos )
Returns the previous heading.
Heading to set compass to. Any values are valid. If the position is less than 0 or greater than 360, then compass will reflect their reference angles.
Use the SetPos method to set the compass heading. Normal compass headings range form 0 to 360 degrees. Other values greater than 360 or less than 0 degrees may be used. The compass control will reflect the reference angle.
void SetTicAlign( WORD wAlign )
Sets the tic alignment. Where:
COMPASS_TIC_TOP - Aligns tics along top of compass
COMPASS_TIC_BOTTOM - Aligns tics along the bottom of compass
COMPASS_TIC_BOTH - Aligns tics on top and bottom of compass
Use SetTicAlign to setup the alignment of degree tics on the compass.
DownloadsDownload demo project - 41 Kb
Download source - 2 Kb