Share via


TRACKER Sample: Illustrates Various CRectTracker Styles and Options

The TRACKER sample is a test application that provides an exhaustive illustration of CRectTracker member functions, styles, and options. For a real-world example that uses CRectTracker, see DRAWCLI, the object-oriented drawing sample application.

Security noteSecurity Note:

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To get samples and instructions for installing them:

  • On the Visual Studio Help menu, click Samples.

    For more information, see Visual Studio Samples.

  • The most recent version and complete list of samples is available online from the Visual Studio 2008 Samples page.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied into a folder under \Program Files\Visual Studio 9.0\Samples\. For Express editions of Visual Studio, all samples are located online.

Building and Running the Sample

To build and run the TRACKER sample

  1. Open the solution tracker.sln.

  2. On the Build menu, click Build.

  3. On the Debug menu, click Start Without Debugging.

TRACKER initially displays a square with four colored and numbered quadrants. The quadrants are displayed to help you see when the square is inverted horizontally and/or vertically. Initially, the square has no CRectTracker adornments. Try the various toolbar commands, or Edit menu commands, to turn on and off CRectTracker styles, including dotted or solid lines; hatched border, inside or outside the rectangle; and resize handles, inside or outside the rectangle.

Note how the cursor changes shape over parts of the rectangle to indicate what happens if you drag the mouse. Try moving and resizing the rectangle.

Keywords

This sample demonstrates the following keywords:

CBrush::CreateSolidBrush; CDialog::DoModal; CDocument::OnNewDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::Create; CFrameWnd::LoadFrame; CGdiObject::DeleteObject; CObject::AssertValid; CObject::Dump; CObject::Serialize; CRect::Height; CRect::IntersectRect; CRect::Width; CRectTracker::Draw; CRectTracker::GetTrueRect; CRectTracker::HitTest; CRectTracker::SetCursor; CRectTracker::Track; CRectTracker::TrackRubberBand; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnSetCursor; CWnd::ShowWindow; CWnd::UpdateWindow; ExtTextOut; GetTextMetrics; LoadBitmap; MessageBeep; PatBlt; RGB; SelectObject; SetBkMode; SetTextAlign; abs

Note

Some samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.

See Also

Other Resources

MFC Samples