PROPDLG Sample: Demonstrates Property Sheet Support
The PROPDLG sample illustrates MFC support for property sheets or tabbed dialog boxes. PROPDLG also illustrates a modeless miniframe window.
PROPDLG is a simple object drawing program that uses property sheets for entering the shape and color attributes of a currently selected object. For an example of a more fully featured object drawing program, see the DRAWCLI sample.
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.
To build and run the PROPDLG sample
Open the solution propdlg.sln.
On the Build menu, click Build.
On the Debug menu, click Start Without Debugging.
When you run the sample, click anywhere in the view to add a new shape, which is initially a fixed-size rectangle. Click elsewhere to add more shapes. To select a shape, click that shape. The Object menu offers three types of property sheets for updating the attributes of the currently selected object. A real application would typically only offer one of these types of property sheets:
This sample demonstrates the following keywords:
AfxGetMainWnd; CCmdUI::Enable; CDC::GetClipBox; CDialog::DoModal; CDocument::OnNewDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::Create; CFrameWnd::GetActiveFrame; CFrameWnd::GetActiveView; CFrameWnd::LoadFrame; CMDIFrameWnd::MDIGetActive; CObject::AssertValid; CObject::Dump; CObject::Serialize; CPen::CreatePen; CRect::Height; CRect::IntersectRect; CRect::IsRectNull; CRect::PtInRect; CRect::Width; CStatusBar::Create; CStatusBar::SetIndicators; CString::LoadString; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::CenterWindow; CWnd::Create; CWnd::DoDataExchange; CWnd::FromHandle; CWnd::GetClientRect; CWnd::GetParent; CWnd::InvalidateRect; CWnd::IsWindowVisible; CWnd::OnCreate; CWnd::OnEraseBkgnd; CWnd::OnKeyDown; CWnd::OnLButtonDblClk; CWnd::OnLButtonDown; CWnd::OnPaint; CWnd::SendMessage; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; Ellipse; FillRect; GetParent; GetWindowRect; RGB; Rectangle; RoundRect; SelectObject; SendMessage; SetFocus; SetWindowPos; UpdateWindow
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.