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.
Building and Running the Sample
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:
- Simple Property Sheet
- A pop-up dialog box with tabs for Style and Shape. Click OK to apply the properties to the currently selected object and exit the dialog box. Click Cancel to exit the dialog box without applying the properties. The Apply Now and Help buttons are always disabled in these illustrations.
- Property Sheet with Preview
- Also a pop-up dialog box with two tabs. This dialog box also has a preview child window. The preview window shows you what the object would look like if the current values in the property sheet were applied. This illustrates how you can customize the layout of a property sheet. This example also implements the Apply Now button, which is enabled whenever you change any property.
- Miniframe Property Sheet
- A modeless property sheet dialog box within a mini-frame window. The properties in this modeless dialog box always reflect the currently selected object. Changes to values in the property sheet are applied immediately to the currently selected object.
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
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.