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 intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.
To get samples and instructions for installing them:
To access samples from Visual Studio
On the Help menu, click Samples.
By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.
For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.
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.