You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/mfc/walkthrough-updating-the-mfc-scribble-application-part-2.md
+6-18Lines changed: 6 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,8 +69,6 @@ These steps show how to add a **View** panel that contains two check boxes that
69
69
70
70
1. Save the changes, and then build and run the application. The **View** and **Window** panels should be displayed. Click the buttons to confirm that they function correctly.
71
71
72
-
[[Sections](#top)]
73
-
74
72
## <aname="addhelppanel"></a> Adding a Help Panel to the Ribbon
75
73
76
74
Now, you can assign two menu items that are defined in the Scribble application to ribbon buttons that are named **Help Topics** and **About Scribble**. The buttons are added to a new panel named **Help**.
@@ -90,8 +88,6 @@ Now, you can assign two menu items that are defined in the Scribble application
90
88
> [!IMPORTANT]
91
89
> When you click the **Help Topics** button, the Scribble application opens a compressed HTML (.chm) help file named *your_project_name*.chm. Consequently, if your project is not named Scribble, you must rename the help file to your project name.
92
90
93
-
[[Sections](#top)]
94
-
95
91
## <aname="addpenpanel"></a> Adding a Pen Panel to the Ribbon
96
92
97
93
Now, add a panel to display buttons that control the thickness and the color of the pen. This panel contains a check box that toggles between thick and thin pens. Its functionality resembles that of the **Thick Line** menu item in the Scribble application.
@@ -106,15 +102,15 @@ The original Scribble application lets the user select pen widths from a dialog
106
102
107
103
1. Click the check box. Change **Caption** to `Use Thick`, and **ID** to `ID_PEN_THICK_OR_THIN`.
108
104
109
-
1. Click the first combo box. Change **Caption** to `Thin Pen`, **ID** to `ID_PEN_THIN_WIDTH`, **Text** to `2`, **Type** to `Drop List`, and **Data** to `1;2;3;4;5;6;7;8;9;`.
105
+
1. Click the first combo box. Change **Caption** to `Thin Pen`, **ID** to `ID_PEN_THIN_WIDTH`, **Type** to `Drop List`, **Data** to `1;2;3;4;5;6;7;8;9;`, and **Text** to `2`.
110
106
111
-
1. Click the second combo box. Change **Caption** to `Thick Pen`, **ID** to `ID_PEN_THICK_WIDTH`, **Text** to `5`, **Type** to `Drop List`, and **Data** to `5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;`.
107
+
1. Click the second combo box. Change **Caption** to `Thick Pen`, **ID** to `ID_PEN_THICK_WIDTH`, **Type** to `Drop List`, **Data** to `5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;`, and **Text** to `5`.
112
108
113
109
1. The new combo boxes do not correspond to any existing menu items. Therefore, you must create a menu item for every pen option.
114
110
115
111
1. In the **Resource View** window, open the **IDR_SCRIBBTYPE** menu resource.
116
112
117
-
1. Click **Pen** to open the p**en** menu. Then click **Type Here** and type `Thi&n Pen`.
113
+
1. Click **Pen** to open the pen menu. Then click **Type Here** and type `Thi&n Pen`.
118
114
119
115
1. Right-click the text that you just typed to open the **Properties** window, and then change the ID property to `ID_PEN_THIN_WIDTH`.
120
116
@@ -137,7 +133,7 @@ The original Scribble application lets the user select pen widths from a dialog
@@ -178,8 +174,6 @@ The original Scribble application lets the user select pen widths from a dialog
178
174
179
175
1. Save the changes, and then build and run the application. New buttons and combo boxes should be displayed. Try using different pen widths to scribble.
180
176
181
-
[[Sections](#top)]
182
-
183
177
## <aname="addcolorbutton"></a> Adding a Color Button to the Pen Panel
184
178
185
179
Next, add a [CMFCRibbonColorButton](../mfc/reference/cmfcribboncolorbutton-class.md) object that lets the user scribble in color.
@@ -190,12 +184,10 @@ Next, add a [CMFCRibbonColorButton](../mfc/reference/cmfcribboncolorbutton-class
190
184
191
185
1. Now add the color button. From the **Toolbox**, drag a **Color Button** to the **Pen** panel.
192
186
193
-
1. Click the color button. Change **Caption** to `Color`, **ID** to `ID_PEN_COLOR`, **SimpleLook** to `True`, **Large Image Index** to `1`, and **Split Mode** to `False`.
187
+
1. Click the color button. Change **Caption** to `Color`, **ID** to `ID_PEN_COLOR`, **Simple Look** to `True`, **Large Image Index** to `1`, and **Split Mode** to `False`.
194
188
195
189
1. Save the changes, and then build and run the application. The new color button should be displayed on the **Pen** panel. However, it cannot be used because it does not yet have an event handler. The next steps show how to add an event handler for the color button.
196
190
197
-
[[Sections](#top)]
198
-
199
191
## <aname="addcolormember"></a> Adding a Color Member to the Document Class
200
192
201
193
Because the original Scribble application does not have color pens, you must write an implementation for them. To store the pen color of the document, add a new member to the document class, `CscribbleDoc`.
@@ -287,8 +279,6 @@ Because the original Scribble application does not have color pens, you must wri
287
279
288
280
1. Save the changes and then build and run the application. You should be able to press the color button and change the pen's color.
289
281
290
-
[[Sections](#top)]
291
-
292
282
## <a name="initpensave"></a> Initializing Pens and Saving Preferences
293
283
294
284
Next, initialize the color and width of the pens. Finally, save and load a color drawing from a file.
@@ -341,8 +331,6 @@ Next, initialize the color and width of the pens. Finally, save and load a color
341
331
342
332
1. Now scribble in color and save your drawing to a file.
343
333
344
-
[[Sections](#top)]
345
-
346
334
## Conclusion
347
335
348
336
You have updated the MFC Scribble application. Use this walkthrough as a guide when you modify your existing applications.
Copy file name to clipboardExpand all lines: docs/mfc/walkthrough-using-the-new-mfc-shell-controls.md
+10-16Lines changed: 10 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,23 +23,21 @@ This walkthrough assumes that you have set up Visual Studio to use **General Dev
23
23
24
24
1. Use the **MFC Application Wizard** to create a new MFC application. To run the wizard, from the **File** menu select **New**, and then select **Project**. The **New Project** dialog box will be displayed.
25
25
26
-
1. In the **New Project** dialog box, expand the **Visual C++** node in the **Project types** pane and select **MFC**. Then, in the **Templates** pane, select **MFC Application**. Type a name for the project, such as `MFCShellControls` and click **OK**. The**MFC Application Wizard**will be displayed.
26
+
1. In the **New Project** dialog box, expand the **Visual C++** node in the **Project types** pane and select **MFC**. Then, in the **Templates** pane, select **MFC Application**. Type a name for the project, such as `MFCShellControls` and click **OK**. After**MFC Application Wizard**displays, use the following options:
27
27
28
-
1.In the **MFC Application Wizard**dialog box, click **Next**. The**Application Type** pane will be displayed.
28
+
1.On the **Application Type**pane, under **Application type**, clear the **Tabbed documents** option. Next, select **Single document** and select **Document/View architecture support**. Under**Project style**, select **Visual Studio**, and from the **Visual style and colors** drop down list select **Office 2007 (Blue theme)**.
29
29
30
-
1. On the **Application Type** pane, under **Application type**, clear the **Tabbed documents** option. Next, select **Single document** and select **Document/View architecture support**. Under **Project style**, select **Visual Studio**, and from the **Visual style and colors** drop down list select **Office 2007 (Blue theme)**. Leave all other options as they are. Click **Next** to display the **Compound Document Support** pane.
30
+
1. On the **Compound Document Support** pane, select **None**.
31
31
32
-
1. On the **Compound Document Support** pane, select **None**. Click **Next** to display the **Document Template Strings** pane.
32
+
1. Do not make any changes to the **Document Template Strings** pane.
33
33
34
-
1. Do not make any changes to the **Document Template Strings** pane. Click **Next**to display the **Database Support** pane.
34
+
1. On the **Database Support** pane (Visual Studio 2015 and older), select **None**because this application does not use a database.
35
35
36
-
1. On the **Database Support** pane, select **None** because this application does not use a database. Click **Next** to display the **User Interface Features** pane.
36
+
1. On the **User Interface Features** pane, make sure that the **Use a menu bar and toolbar** option is selected. Leave all other options as they are.
37
37
38
-
1. On the **User Interface Features** pane, make sure that the **Use a menu bar and toolbar** option is selected. Leave all other options as they are. Click **Next**to display the **Advanced Features**pane.
38
+
1. On the **Advanced Features** pane, under **Advanced features**, select only **ActiveX controls**and **Common Control Manifest**. Under **Advanced frame panes**, select only the **Navigation pane**option. This will cause the wizard to create the pane to the left of the window with a `CMFCShellTreeCtrl` already embedded.
39
39
40
-
1. On the **Advanced Features** pane, under **Advanced features**, select only **ActiveX controls** and **Common Control Manifest**. Under **Advanced frame panes**, select only the **Navigation pane** option. This will cause the wizard to create the pane to the left of the window with a `CMFCShellTreeCtrl` already embedded. Click **Next** to display the **Generated Classes** pane.
41
-
42
-
1. We are not going to make any changes to the **Generated Classes** pane. Therefore, click **Finish** to create your new MFC project.
40
+
1. We are not going to make any changes to the **Generated Classes** pane. Therefore, click **Finish** to create your new MFC project.
43
41
44
42
1. Verify that the application was created successfully by building and running it. To build the application, from the **Build** menu select **Build Solution**. If the application builds successfully, run the application by selecting **Start Debugging** from the **Debug** menu.
45
43
@@ -90,13 +88,9 @@ This walkthrough assumes that you have set up Visual Studio to use **General Dev
90
88
}
91
89
```
92
90
93
-
1. Now we update the `CMFCShellControlsView` class to handle the `WM_CREATE` windows message. Open the MFCShellControlsView.h header file and click on this line of code:
94
-
95
-
```cpp
96
-
class CMFCShellControlsView : public CView
97
-
```
91
+
1. Now we update the `CMFCShellControlsView` class to handle the `WM_CREATE` windows message. Open the **Class View** window and select the `CMFCShellControlsView` class. Right-click and select **Properties**.
98
92
99
-
Next, in the **Properties** window, click the **Messages** icon. Scroll down until you find the `WM_CREATE` message. From the drop down list next to `WM_CREATE`, select **\<Add> OnCreate**. This creates a message handler for us and automatically updates the MFC message map.
93
+
Next, in the **Properties** window, click the **Messages** icon. Scroll down until you find the `WM_CREATE` message. From the drop down list next to `WM_CREATE`, select **\<Add> OnCreate**. This creates a message handler for us and automatically updates the MFC message map.
100
94
101
95
In the `OnCreate` method we will now create our `CMFCShellListCtrl` object. Find the `OnCreate` method definition in the MFCShellControlsView.cpp source file, and replace its implementation with the following code:
0 commit comments