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
{{ message }}
Repository navigation
Commit 3a44742
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/mfc/walkthrough-adding-a-d2d-object-to-an-mfc-project.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,17 +33,17 @@ The walkthrough shows how to accomplish these tasks:
33
33
34
34
To complete this walkthrough, you must have Visual Studio installed with the **Desktop development with C++** workload and the optional **Visual C++ MFC for x86 and x64** component.
35
35
36
-
###To create an MFC application
36
+
## To create an MFC application
37
37
38
-
1. On the **File** menu, point to **New** and then click**Project**.
38
+
1. On the **File** menu, point to **New** and then choose**Project**.
39
39
40
-
2. In the **New Project** dialog box, in the left pane under **Installed Templates**, expand **Visual C++** and then select **MFC**. In the middle pane, select **MFC Application**. In the **Name** box, type `MFCD2DWalkthrough`. Click**OK**.
40
+
2. In the **New Project** dialog box, in the left pane under **Installed Templates**, expand **Visual C++** and then select **MFC**. In the middle pane, select **MFC Application**. In the **Name** box, type `MFCD2DWalkthrough`. Choose**OK**.
41
41
42
-
3. In the **MFC Application Wizard**, click**Finish** without changing any settings.
42
+
3. In the **MFC Application Wizard**, choose**Finish** without changing any settings.
43
43
44
-
###To create a solid-color brush and a linear-gradient brush
44
+
## To create a solid-color brush and a linear-gradient brush
45
45
46
-
1. In **Solution Explorer**, in the **MFCD2DWalkthrough** project, in the **Header Files** folder, open MFCD2DWalkthroughView.h. Add the following code to the `CMFCD2DWalkthroughView` class to create three data variables.
46
+
1. In **Solution Explorer**, in the **MFCD2DWalkthrough** project, in the **Header Files** folder, open MFCD2DWalkthroughView.h. Add this code to the `CMFCD2DWalkthroughView` class to create three data variables:
47
47
48
48
```cpp
49
49
CD2DTextFormat* m_pTextFormat;
@@ -53,7 +53,7 @@ To complete this walkthrough, you must have Visual Studio installed with the **D
53
53
54
54
Save the file and close it.
55
55
56
-
2. In the **Source Files** folder, open MFCD2DWalkthroughView.cpp. In the constructor for the `CMFCD2DWalkthroughView` class, add the following code.
56
+
2. In the **Source Files** folder, open MFCD2DWalkthroughView.cpp. In the constructor for the `CMFCD2DWalkthroughView` class, add this code:
57
57
58
58
```cpp
59
59
// Enable D2D support for this window:
@@ -97,33 +97,33 @@ To complete this walkthrough, you must have Visual Studio installed with the **D
97
97
98
98
Save the file and close it.
99
99
100
-
### To modify the gradient brush so that it will change appropriately when the window is resized
100
+
## To modify the gradient brush so that it will change appropriately when the window is resized
101
101
102
-
1. On the **Project** menu, click **Class Wizard**.
102
+
1. On the **Project** menu, choose **Class Wizard**.
103
103
104
104
2. In the **MFC Class Wizard**, under **Class name**, select `CMFCD2DWalkthroughView`.
105
105
106
-
3. On the **Messages** tab, in the **Messages** box, select `WM_SIZE` and then click **Add Handler**. This action adds the `OnSize` message handler to the `CMFCD2DWalkthroughView` class.
106
+
3. On the **Messages** tab, in the **Messages** box, select `WM_SIZE` and then choose **Add Handler**. This action adds the `OnSize` message handler to the `CMFCD2DWalkthroughView` class.
107
107
108
-
4. In the **Existing handlers** box, select `OnSize`. Click **Edit Code** to display the `CMFCD2DWalkthroughView::OnSize` method. At the end of the method, add the following code.
108
+
4. In the **Existing handlers** box, select `OnSize`. Choose **Edit Code** to display the `CMFCD2DWalkthroughView::OnSize` method. At the end of the method, add the following code.
1. On the **Project** menu, click**Class Wizard**.
118
+
1. On the **Project** menu, choose**Class Wizard**.
119
119
120
120
2. In the **MFC Class Wizard**, under **Class name**, select `CMFCD2DWalkthroughView`.
121
121
122
-
3. On the **Messages** tab, click**Add Custom Message**.
122
+
3. On the **Messages** tab, choose**Add Custom Message**.
123
123
124
-
4. In the **Add Custom Message** dialog box, in the **Custom Windows Message** box, type `AFX_WM_DRAW2D`. In the **Message handler name** box, type `OnDraw2D`. Select the **Registered Message** option and then click**OK**. This action adds a message handler for the `AFX_WM_DRAW2D` message to the `CMFCD2DWalkthroughView` class.
124
+
4. In the **Add Custom Message** dialog box, in the **Custom Windows Message** box, type `AFX_WM_DRAW2D`. In the **Message handler name** box, type `OnDraw2D`. Select the **Registered Message** option and then choose**OK**. This action adds a message handler for the `AFX_WM_DRAW2D` message to the `CMFCD2DWalkthroughView` class.
125
125
126
-
5. In the **Existing handlers** box, select `OnDraw2D`. Click**Edit Code** to display the `CMFCD2DWalkthroughView::OnDraw2D` method. Use the following code for the `CMFCD2DWalkthroughView::OnDrawD2D` method.
126
+
5. In the **Existing handlers** box, select `OnDraw2D`. Choose**Edit Code** to display the `CMFCD2DWalkthroughView::OnDraw2D` method. Use this code for the `CMFCD2DWalkthroughView::OnDrawD2D` method:
127
127
128
128
```cpp
129
129
afx_msg LRESULTCMFCD2DWalkthroughView::OnDraw2D(
@@ -150,9 +150,9 @@ To complete this walkthrough, you must have Visual Studio installed with the **D
150
150
151
151
Save the file and close it.
152
152
153
-
### To verify the results
153
+
## To verify the results
154
154
155
-
1. Build and run the application. It should have a gradient rectangle that changes when you resize the window. “Hello World!” should be displayed in the center of the rectangle.
155
+
- Build and run the application. It should have a gradient rectangle that changes when you resize the window. “Hello World!” should be displayed in the center of the rectangle.
0 commit comments