Skip to content

Commit e4f1f8b

Browse files
author
mtx48109
committed
additional scribble changes, vs2015 update
1 parent 6ba60d6 commit e4f1f8b

File tree

2 files changed

+16
-34
lines changed

2 files changed

+16
-34
lines changed

docs/mfc/walkthrough-updating-the-mfc-scribble-application-part-2.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ These steps show how to add a **View** panel that contains two check boxes that
6969

7070
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.
7171

72-
[[Sections](#top)]
73-
7472
## <a name="addhelppanel"></a> Adding a Help Panel to the Ribbon
7573

7674
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
9088
> [!IMPORTANT]
9189
> 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.
9290
93-
[[Sections](#top)]
94-
9591
## <a name="addpenpanel"></a> Adding a Pen Panel to the Ribbon
9692

9793
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
106102

107103
1. Click the check box. Change **Caption** to `Use Thick`, and **ID** to `ID_PEN_THICK_OR_THIN`.
108104

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`.
110106

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`.
112108

113109
1. The new combo boxes do not correspond to any existing menu items. Therefore, you must create a menu item for every pen option.
114110

115111
1. In the **Resource View** window, open the **IDR_SCRIBBTYPE** menu resource.
116112

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`.
118114

119115
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`.
120116

@@ -137,7 +133,7 @@ The original Scribble application lets the user select pen widths from a dialog
137133
int nCurSel = pThinComboBox->GetCurSel();
138134
if (nCurSel>= 0)
139135
{
140-
m_nThinWidth = atoi(pThinComboBox->GetItem(nCurSel));
136+
m_nThinWidth = atoi(CStringA(pThinComboBox->GetItem(nCurSel)));
141137
}
142138

143139
// Create a new pen using the selected width
@@ -169,7 +165,7 @@ The original Scribble application lets the user select pen widths from a dialog
169165
int nCurSel = pThickComboBox->GetCurSel();
170166
if (nCurSel>= 0)
171167
{
172-
m_nThickWidth = atoi(pThickComboBox->GetItem(nCurSel));
168+
m_nThickWidth = atoi(CStringA(pThickComboBox->GetItem(nCurSel)));
173169
}
174170

175171
// Create a new pen using the selected width
@@ -178,8 +174,6 @@ The original Scribble application lets the user select pen widths from a dialog
178174

179175
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.
180176

181-
[[Sections](#top)]
182-
183177
## <a name="addcolorbutton"></a> Adding a Color Button to the Pen Panel
184178

185179
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
190184

191185
1. Now add the color button. From the **Toolbox**, drag a **Color Button** to the **Pen** panel.
192186

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`.
194188

195189
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.
196190

197-
[[Sections](#top)]
198-
199191
## <a name="addcolormember"></a> Adding a Color Member to the Document Class
200192

201193
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
287279
288280
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.
289281
290-
[[Sections](#top)]
291-
292282
## <a name="initpensave"></a> Initializing Pens and Saving Preferences
293283
294284
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
341331

342332
1. Now scribble in color and save your drawing to a file.
343333

344-
[[Sections](#top)]
345-
346334
## Conclusion
347335

348336
You have updated the MFC Scribble application. Use this walkthrough as a guide when you modify your existing applications.

docs/mfc/walkthrough-using-the-new-mfc-shell-controls.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,21 @@ This walkthrough assumes that you have set up Visual Studio to use **General Dev
2323

2424
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.
2525

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:
2727

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)**.
2929

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**.
3131

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

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

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

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

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

4442
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.
4543

@@ -90,13 +88,9 @@ This walkthrough assumes that you have set up Visual Studio to use **General Dev
9088
}
9189
```
9290
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**.
9892
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.
10094
10195
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:
10296

0 commit comments

Comments
 (0)