CRect Class


Overview

Note

The CRect class handles rectangles

The structure used for this class is CRect


Quick Reference

Quick Ref

void CRect::CRect(RECT* lpSrcRect)

int CRect::PtInRect(POINT point)

int CRect::IntersectRect(RECT* lpRect1, RECT* lpRect2)

int CRect::IsRectEmpty()

void CRect::DeflateRect(int l, int t, int r, int b)

void CRect::InflateRect(int l, int t, int r, int b)

void CRect::NormalizeRect()


Constructors

Name

Description

CRect::CRect

Constructs a CRect object

CRect::CRect

Constructs a CRect object

void CRect::CRect(RECT* lpSrcRect);

Parameters

Remarks

Constructs a CRect object


Methods

Name

Description

CRect::PtInRect

Determines whether the specified point lies within the rectangle

CRect::IntersectRect

Intersects two source rectangles into the rectangle

CRect::IsRectEmpty

Determines whether the rectangle is empty

CRect::DeflateRect

Decreases the width and height of the rectangle

CRect::InflateRect

Increases the width and height of the rectangle

CRect::NormalizeRect


CRect::PtInRect

Determines whether the specified point lies within the rectangle

int CRect::PtInRect(POINT point);

Parameters

  • POINT point - x and y coordinates used to determine if within rectangle

Return Value

Returns an int value representing 1 true, or 0 false

Remarks


CRect::IntersectRect

Calculates the intersection of two source rectangles and places the coordinates of the intersection source rectangles into the rectangle

int CRect::IntersectRect(
   RECT* lpRect1,
   RECT* lpRect2);

Parameters

  • RECT* lpRect1 - pointer to source rectangle 1

  • RECT* lpRect2 - pointer to source rectangle 2

Return Value

Returns an int value representing 1 true, or 0 false

Remarks


CRect::IsRectEmpty

Determines whether the rectangle is empty

int CRect::IsRectEmpty();

Return Value

Returns an int value representing 1 true, or 0 false

Remarks


CRect::DeflateRect

Decreases the width and height of the rectangle

void CRect::DeflateRect(
   int l,
   int t,
   int r,
   int b);

Parameters

  • int l - amount to decrease left side of rectangle

  • int t - amount to decrease top side of rectangle

  • int r - amount to decrease right side of rectangle

  • int b - amount to decrease bottom side of rectangle

Remarks

The rectangle is adjusted by the amounts specified


CRect::InflateRect

Increases the width and height of the rectangle

void CRect::InflateRect(
   int l,
   int t,
   int r,
   int b);

Parameters

  • int l - amount to increase left side of rectangle

  • int t - amount to increase top side of rectangle

  • int r - amount to increase right side of rectangle

  • int b - amount to increase bottom side of rectangle

Remarks

The rectangle is adjusted by the amounts specified


CRect::NormalizeRect

void CRect::NormalizeRect();

Remarks