Skip to content

Commit a080f80

Browse files
US1907300 - add md code escapes to code elements - PR12 (MicrosoftDocs#4103)
* US1907300 - add md code escapes to code elements - PR12 * changes afteer review * changes afteer review * changes afteer review * changes afteer review
1 parent b6987c0 commit a080f80

File tree

6 files changed

+1073
-1077
lines changed

6 files changed

+1073
-1077
lines changed

docs/atl-mfc-shared/reference/cpoint-class.md

Lines changed: 78 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ title: "CPoint Class"
44
ms.date: "11/04/2016"
55
f1_keywords: ["CPoint", "ATLTYPES/ATL::CPoint", "ATLTYPES/ATL::CPoint::CPoint", "ATLTYPES/ATL::CPoint::Offset"]
66
helpviewer_keywords: ["LPPOINT structure", "POINT structure", "CPoint class"]
7-
ms.assetid: a6d4db93-35cc-444d-9221-c3e160f6edaa
87
---
9-
# CPoint Class
8+
# `CPoint` Class
109

1110
Similar to the Windows `POINT` structure.
1211

@@ -22,30 +21,30 @@ class CPoint : public tagPOINT
2221

2322
|Name|Description|
2423
|----------|-----------------|
25-
|[CPoint::CPoint](#cpoint)|Constructs a `CPoint`.|
24+
|[`CPoint::CPoint`](#cpoint)|Constructs a `CPoint`.|
2625

2726
### Public Methods
2827

2928
|Name|Description|
3029
|----------|-----------------|
31-
|[CPoint::Offset](#offset)|Adds values to the `x` and `y` members of the `CPoint`.|
30+
|[`CPoint::Offset`](#offset)|Adds values to the `x` and `y` members of the `CPoint`.|
3231

3332
### Public Operators
3433

3534
|Name|Description|
3635
|----------|-----------------|
37-
|[CPoint::operator -](#operator_-)|Returns the difference of a `CPoint` and a size, or the negation of a point, or the size difference between two points, or the offset by a negative size.|
38-
|[CPoint::operator !=](#operator_neq)|Checks for inequality between two points.|
39-
|[CPoint::operator +](#operator_add)|Returns the sum of a `CPoint` and a size or point, or a `CRect` offset by a size.|
40-
|[CPoint::operator +=](#operator_add_eq)|Offsets `CPoint` by adding a size or point.|
41-
|[CPoint::operator -=](#operator_-_eq)|Offsets `CPoint` by subtracting a size or point.|
42-
|[CPoint::operator ==](#operator_eq_eq)|Checks for equality between two points.|
36+
|[`CPoint::operator -`](#operator_-)|Returns the difference of a `CPoint` and a `SIZE`, or the negation of a `POINT`, or the `CSize` difference between two `POINT`s, or the offset by a negative `SIZE`.|
37+
|[`CPoint::operator !=`](#operator_neq)|Checks for inequality between two `POINT`s.|
38+
|[`CPoint::operator +`](#operator_add)|Returns the sum of a `CPoint` and a `SIZE` or `POINT`, or a `CRect` offset by a `SIZE`.|
39+
|[`CPoint::operator +=`](#operator_add_eq)|Offsets `CPoint` by adding a `SIZE` or `POINT`.|
40+
|[`CPoint::operator -=`](#operator_-_eq)|Offsets `CPoint` by subtracting a `SIZE` or `POINT`.|
41+
|[`CPoint::operator ==`](#operator_eq_eq)|Checks for equality between two `POINT`s.|
4342

4443
## Remarks
4544

46-
It also includes member functions to manipulate `CPoint` and [POINT](/windows/win32/api/windef/ns-windef-point) structures.
45+
It also includes member functions to manipulate `CPoint` and [`POINT`](/windows/win32/api/windef/ns-windef-point) structures.
4746

48-
A `CPoint` object can be used wherever a `POINT` structure is used. The operators of this class that interact with a "size" accept either [CSize](../../atl-mfc-shared/reference/csize-class.md) objects or [SIZE](/windows/win32/api/windef/ns-windef-size) structures, since the two are interchangeable.
47+
A `CPoint` object can be used wherever a `POINT` structure is used. The operators of this class that interact with a `SIZE` accept either [`CSize`](../../atl-mfc-shared/reference/csize-class.md) objects or [`SIZE`](/windows/win32/api/windef/ns-windef-size) structures, since the two are interchangeable.
4948

5049
> [!NOTE]
5150
> This class is derived from the `tagPOINT` structure. (The name `tagPOINT` is a less commonly used name for the `POINT` structure.) This means that the data members of the `POINT` structure, `x` and `y`, are accessible data members of `CPoint`.
@@ -61,9 +60,9 @@ A `CPoint` object can be used wherever a `POINT` structure is used. The operator
6160

6261
## Requirements
6362

64-
**Header:** atltypes.h
63+
**Header:** `atltypes.h`
6564

66-
## <a name="cpoint"></a> CPoint::CPoint
65+
## <a name="cpoint"></a> `CPoint::CPoint`
6766

6867
Constructs a `CPoint` object.
6968

@@ -77,20 +76,20 @@ CPoint(LPARAM dwPoint) throw();
7776

7877
### Parameters
7978

80-
*initX*<br/>
79+
*`initX`*\
8180
Specifies the value of the `x` member of `CPoint`.
8281

83-
*initY*<br/>
82+
*`initY`*\
8483
Specifies the value of the `y` member of `CPoint`.
8584

86-
*initPt*<br/>
87-
[POINT](/windows/win32/api/windef/ns-windef-point) structure or `CPoint` that specifies the values used to initialize `CPoint`.
85+
*`initPt`*\
86+
[`POINT`](/windows/win32/api/windef/ns-windef-point) structure or `CPoint` that specifies the values used to initialize `CPoint`.
8887

89-
*initSize*<br/>
90-
[SIZE](/windows/win32/api/windef/ns-windef-size) structure or [CSize](../../atl-mfc-shared/reference/csize-class.md) that specifies the values used to initialize `CPoint`.
88+
*`initSize`*\
89+
[`SIZE`](/windows/win32/api/windef/ns-windef-size) structure or [`CSize`](../../atl-mfc-shared/reference/csize-class.md) that specifies the values used to initialize `CPoint`.
9190

92-
*dwPoint*<br/>
93-
Sets the `x` member to the low-order word of *dwPoint* and the `y` member to the high-order word of *dwPoint*.
91+
*`dwPoint`*\
92+
Sets the `x` member to the low-order word of *`dwPoint`* and the `y` member to the high-order word of *`dwPoint`*.
9493

9594
### Remarks
9695

@@ -123,7 +122,7 @@ CPoint ptFromDouble(dwSize);
123122
ASSERT(ptFromDouble == ptMFCHere);
124123
```
125124
126-
## <a name="offset"></a> CPoint::Offset
125+
## <a name="offset"></a> `CPoint::Offset`
127126
128127
Adds values to the `x` and `y` members of the `CPoint`.
129128
@@ -135,67 +134,67 @@ void Offset(SIZE size) throw();
135134

136135
### Parameters
137136

138-
*xOffset*<br/>
137+
*`xOffset`*\
139138
Specifies the amount to offset the `x` member of the `CPoint`.
140139

141-
*yOffset*<br/>
140+
*`yOffset`*\
142141
Specifies the amount to offset the `y` member of the `CPoint`.
143142

144-
*point*<br/>
145-
Specifies the amount ( [POINT](/windows/win32/api/windef/ns-windef-point) or `CPoint`) to offset the `CPoint`.
143+
*`point`*\
144+
Specifies the amount ([`POINT`](/windows/win32/api/windef/ns-windef-point) or `CPoint`) to offset the `CPoint`.
146145

147-
*size*<br/>
148-
Specifies the amount ( [SIZE](/windows/win32/api/windef/ns-windef-size) or [CSize](../../atl-mfc-shared/reference/csize-class.md)) to offset the `CPoint`.
146+
*`size`*\
147+
Specifies the amount ([`SIZE`](/windows/win32/api/windef/ns-windef-size) or [`CSize`](../../atl-mfc-shared/reference/csize-class.md)) to offset the `CPoint`.
149148

150149
### Example
151150

152151
[!code-cpp[NVC_ATLMFC_Utilities#28](../../atl-mfc-shared/codesnippet/cpp/cpoint-class_1.cpp)]
153152

154-
## <a name="operator_eq_eq"></a> CPoint::operator ==
153+
## <a name="operator_eq_eq"></a> `CPoint::operator ==`
155154

156-
Checks for equality between two points.
155+
Checks for equality between two `POINT`s.
157156

158157
```
159158
BOOL operator==(POINT point) const throw();
160159
```
161160

162161
### Parameters
163162

164-
*point*<br/>
165-
Contains a [POINT](/windows/win32/api/windef/ns-windef-point) structure or `CPoint` object.
163+
*`point`*\
164+
Contains a [`POINT`](/windows/win32/api/windef/ns-windef-point) structure or `CPoint` object.
166165

167166
### Return Value
168167

169-
Nonzero if the points are equal; otherwise 0.
168+
Nonzero if the `POINT`s are equal; otherwise 0.
170169

171170
### Example
172171

173172
[!code-cpp[NVC_ATLMFC_Utilities#29](../../atl-mfc-shared/codesnippet/cpp/cpoint-class_2.cpp)]
174173

175-
## <a name="operator_neq"></a> CPoint::operator !=
174+
## <a name="operator_neq"></a> `CPoint::operator !=`
176175

177-
Checks for inequality between two points.
176+
Checks for inequality between two `POINT`s.
178177

179178
```
180179
BOOL operator!=(POINT point) const throw();
181180
```
182181

183182
### Parameters
184183

185-
*point*<br/>
186-
Contains a [POINT](/windows/win32/api/windef/ns-windef-point) structure or `CPoint` object.
184+
*`point`*\
185+
Contains a [`POINT`](/windows/win32/api/windef/ns-windef-point) structure or `CPoint` object.
187186

188187
### Return Value
189188

190-
Nonzero if the points are not equal; otherwise 0.
189+
Nonzero if the `POINT`s aren't equal; otherwise 0.
191190

192191
### Example
193192

194193
[!code-cpp[NVC_ATLMFC_Utilities#30](../../atl-mfc-shared/codesnippet/cpp/cpoint-class_3.cpp)]
195194

196-
## <a name="operator_add_eq"></a> CPoint::operator +=
195+
## <a name="operator_add_eq"></a> `CPoint::operator +=`
197196

198-
The first overload adds a size to the `CPoint`.
197+
The first overload adds a `SIZE` to the `CPoint`.
199198

200199
```cpp
201200
void operator+=(SIZE size) throw();
@@ -204,27 +203,27 @@ void operator+=(POINT point) throw();
204203

205204
### Parameters
206205

207-
*size*<br/>
208-
Contains a [SIZE](/windows/win32/api/windef/ns-windef-size) structure or [CSize](../../atl-mfc-shared/reference/csize-class.md) object.
206+
*`size`*\
207+
Contains a [`SIZE`](/windows/win32/api/windef/ns-windef-size) structure or [`CSize`](../../atl-mfc-shared/reference/csize-class.md) object.
209208

210-
*point*<br/>
211-
Contains a [POINT](/windows/win32/api/windef/ns-windef-point) structure or [CPoint](../../atl-mfc-shared/reference/cpoint-class.md) object.
209+
*`point`*\
210+
Contains a [`POINT`](/windows/win32/api/windef/ns-windef-point) structure or [`CPoint`](../../atl-mfc-shared/reference/cpoint-class.md) object.
212211

213212
### Remarks
214213

215-
The second overload adds a point to the `CPoint`.
214+
The second overload adds a `POINT` to the `CPoint`.
216215

217216
In both cases, addition is done by adding the `x` (or `cx`) member of the right-hand operand to the `x` member of the `CPoint` and adding the `y` (or `cy`) member of the right-hand operand to the `y` member of the `CPoint`.
218217

219-
For example, adding `CPoint(5, -7)` to a variable which contains `CPoint(30, 40)` changes the variable to `CPoint(35, 33)`.
218+
For example, adding `CPoint(5, -7)` to a variable that contains `CPoint(30, 40)` changes the variable to `CPoint(35, 33)`.
220219

221220
### Example
222221

223222
[!code-cpp[NVC_ATLMFC_Utilities#31](../../atl-mfc-shared/codesnippet/cpp/cpoint-class_4.cpp)]
224223

225-
## <a name="operator_-_eq"></a> CPoint::operator -=
224+
## <a name="operator_-_eq"></a> `CPoint::operator -=`
226225

227-
The first overload subtracts a size from the `CPoint`.
226+
The first overload subtracts a `SIZE` from the `CPoint`.
228227

229228
```cpp
230229
void operator-=(SIZE size) throw();
@@ -233,25 +232,25 @@ void operator-=(POINT point) throw();
233232

234233
### Parameters
235234

236-
*size*<br/>
237-
Contains a [SIZE](/windows/win32/api/windef/ns-windef-size) structure or [CSize](../../atl-mfc-shared/reference/csize-class.md) object.
235+
*`size`*\
236+
Contains a [`SIZE`](/windows/win32/api/windef/ns-windef-size) structure or [`CSize`](../../atl-mfc-shared/reference/csize-class.md) object.
238237

239-
*point*<br/>
240-
Contains a [POINT](/windows/win32/api/windef/ns-windef-point) structure or [CPoint](../../atl-mfc-shared/reference/cpoint-class.md) object.
238+
*`point`*\
239+
Contains a [`POINT`](/windows/win32/api/windef/ns-windef-point) structure or [`CPoint`](../../atl-mfc-shared/reference/cpoint-class.md) object.
241240

242241
### Remarks
243242

244-
The second overload subtracts a point from the `CPoint`.
243+
The second overload subtracts a `POINT` from the `CPoint`.
245244

246245
In both cases, subtraction is done by subtracting the `x` (or `cx`) member of the right-hand operand from the `x` member of the `CPoint` and subtracting the `y` (or `cy`) member of the right-hand operand from the `y` member of the `CPoint`.
247246

248-
For example, subtracting `CPoint(5, -7)` from a variable which contains `CPoint(30, 40)` changes the variable to `CPoint(25, 47)`.
247+
For example, subtracting `CPoint(5, -7)` from a variable that contains `CPoint(30, 40)` changes the variable to `CPoint(25, 47)`.
249248

250249
### Example
251250

252251
[!code-cpp[NVC_ATLMFC_Utilities#32](../../atl-mfc-shared/codesnippet/cpp/cpoint-class_5.cpp)]
253252

254-
## <a name="operator_add"></a> CPoint::operator +
253+
## <a name="operator_add"></a> `CPoint::operator +`
255254

256255
Use this operator to offset `CPoint` by a `CPoint` or `CSize` object, or to offset a `CRect` by a `CPoint`.
257256

@@ -263,30 +262,30 @@ CRect operator+(const RECT* lpRect) const throw();
263262

264263
### Parameters
265264

266-
*size*<br/>
267-
Contains a [SIZE](/windows/win32/api/windef/ns-windef-size) structure or [CSize](../../atl-mfc-shared/reference/csize-class.md) object.
265+
*`size`*\
266+
Contains a [`SIZE`](/windows/win32/api/windef/ns-windef-size) structure or [`CSize`](../../atl-mfc-shared/reference/csize-class.md) object.
268267

269-
*point*<br/>
270-
Contains a [POINT](/windows/win32/api/windef/ns-windef-point) structure or [CPoint](../../atl-mfc-shared/reference/cpoint-class.md) object.
268+
*`point`*\
269+
Contains a [`POINT`](/windows/win32/api/windef/ns-windef-point) structure or [`CPoint`](../../atl-mfc-shared/reference/cpoint-class.md) object.
271270

272-
*lpRect*<br/>
273-
Contains a pointer to a [RECT](/windows/win32/api/windef/ns-windef-rect) structure or [CRect](../../atl-mfc-shared/reference/crect-class.md) object.
271+
*`lpRect`*\
272+
Contains a pointer to a [`RECT`](/windows/win32/api/windef/ns-windef-rect) structure or [`CRect`](../../atl-mfc-shared/reference/crect-class.md) object.
274273

275274
### Return Value
276275

277-
A `CPoint` that is offset by a size, a `CPoint` that is offset by a point, or a `CRect` offset by a point.
276+
A `CPoint` that is offset by a `SIZE`, a `CPoint` that is offset by a `POINT`, or a `CRect` offset by a `POINT`.
278277

279278
### Remarks
280279

281280
For example, using one of the first two overloads to offset the point `CPoint(25, -19)` by a point `CPoint(15, 5)` or size `CSize(15, 5)` returns the value `CPoint(40, -14)`.
282281

283-
Adding a rectangle to a point returns the rectangle after being offset by the `x` and `y` values specified in the point. For example, using the last overload to offset a rectangle `CRect(125, 219, 325, 419)` by a point `CPoint(25, -19)` returns `CRect(150, 200, 350, 400)`.
282+
Adding a `CRect` to a `POINT` returns the `CRect` after being offset by the `x` and `y` values specified in the `POINT`. For example, using the last overload to offset a rectangle `CRect(125, 219, 325, 419)` by a point `CPoint(25, -19)` returns `CRect(150, 200, 350, 400)`.
284283

285284
### Example
286285

287286
[!code-cpp[NVC_ATLMFC_Utilities#33](../../atl-mfc-shared/codesnippet/cpp/cpoint-class_6.cpp)]
288287

289-
## <a name="operator_-"></a> CPoint::operator -
288+
## <a name="operator_-"></a> `CPoint::operator -`
290289

291290
Use one of the first two overloads to subtract a `CPoint` or `CSize` object from `CPoint`.
292291

@@ -299,18 +298,18 @@ CPoint operator-() const throw();
299298

300299
### Parameters
301300

302-
*point*<br/>
303-
A [POINT](/windows/win32/api/windef/ns-windef-point) structure or [CPoint](../../atl-mfc-shared/reference/cpoint-class.md) object.
301+
*`point`*\
302+
A [`POINT`](/windows/win32/api/windef/ns-windef-point) structure or [`CPoint`](../../atl-mfc-shared/reference/cpoint-class.md) object.
304303

305-
*size*<br/>
306-
A [SIZE](/windows/win32/api/windef/ns-windef-size) structure or [CSize](../../atl-mfc-shared/reference/csize-class.md) object.
304+
*`size`*\
305+
A [`SIZE`](/windows/win32/api/windef/ns-windef-size) structure or [`CSize`](../../atl-mfc-shared/reference/csize-class.md) object.
307306

308-
*lpRect*<br/>
309-
A pointer to a [RECT](/windows/win32/api/windef/ns-windef-rect) structure or a [CRect](../../atl-mfc-shared/reference/crect-class.md) object.
307+
*`lpRect`*\
308+
A pointer to a [`RECT`](/windows/win32/api/windef/ns-windef-rect) structure or a [`CRect`](../../atl-mfc-shared/reference/crect-class.md) object.
310309

311310
### Return Value
312311

313-
A `CSize` that is the difference between two points, a `CPoint` that is offset by the negation of a size, a `CRect` that is offset by the negation of a point, or a `CPoint` that is the negation of a point.
312+
A `CSize` that is the difference between two `POINT`s, a `CPoint` that is offset by the negation of a `SIZE`, a `CRect` that is offset by the negation of a `POINT`, or a `CPoint` that is the negation of a `POINT`.
314313

315314
### Remarks
316315

@@ -320,18 +319,18 @@ For example, using the first overload to find the difference between two points
320319

321320
Subtracting a `CSize` from `CPoint` does the same calculation as above but returns a `CPoint` object, not a `CSize` object. For example, using the second overload to find the difference between the point `CPoint(25, -19)` and the size `CSize(15, 5)` returns `CPoint(10, -24)`.
322321

323-
Subtracting a rectangle from a point returns the rectangle offset by the negatives of the `x` and `y` values specified in the point. For example, using the last overload to offset the rectangle `CRect(125, 200, 325, 400)` by the point `CPoint(25, -19)` returns `CRect(100, 219, 300, 419)`.
322+
Subtracting a rectangle from a `POINT` returns the rectangle offset by the negatives of the `x` and `y` values specified in the `POINT`. For example, using the last overload to offset the rectangle `CRect(125, 200, 325, 400)` by the point `CPoint(25, -19)` returns `CRect(100, 219, 300, 419)`.
324323

325-
Use the unary operator to negate a point. For example, using the unary operator with the point `CPoint(25, -19)` returns `CPoint(-25, 19)`.
324+
Use the unary operator to negate a `POINT`. For example, using the unary operator with the point `CPoint(25, -19)` returns `CPoint(-25, 19)`.
326325

327326
### Example
328327

329328
[!code-cpp[NVC_ATLMFC_Utilities#34](../../atl-mfc-shared/codesnippet/cpp/cpoint-class_7.cpp)]
330329

331330
## See also
332331

333-
[MFC Sample MDI](../../overview/visual-cpp-samples.md)<br/>
334-
[Hierarchy Chart](../../mfc/hierarchy-chart.md)<br/>
335-
[POINT Structure](/windows/win32/api/windef/ns-windef-point)<br/>
336-
[CRect Class](../../atl-mfc-shared/reference/crect-class.md)<br/>
337-
[CSize Class](../../atl-mfc-shared/reference/csize-class.md)
332+
[MFC Sample MDI](../../overview/visual-cpp-samples.md)\
333+
[Hierarchy Chart](../../mfc/hierarchy-chart.md)\
334+
[`POINT` Structure](/windows/win32/api/windef/ns-windef-point)\
335+
[`CRect` Class](../../atl-mfc-shared/reference/crect-class.md)\
336+
[`CSize` Class](../../atl-mfc-shared/reference/csize-class.md)

0 commit comments

Comments
 (0)