Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
1 out of 6 rated this helpful - Rate this topic

PROPDLG Sample: Demonstrates Property Sheet Support 

Download sample

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.

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.

Building and Running the Sample

To build and run the PROPDLG sample

  1. Open the solution propdlg.sln.

  2. On the Build menu, click Build.

  3. 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.

Keywords

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

NoteNote

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.