imulsion
imulsion

Reputation: 9040

C++ rectangle() parameters

I am learning to code windows forms, and am starting to use basic graphics. I am able to draw rectangles onto the screen quite easily. The problem is, I have been experimenting with changing the arguments to the constructor, and I have absolutely no idea what they do. I have googled for quite a while trying to find out, and I am completely stuck. Can someone tell me what the arguments do to the dimensions of the rectangle and its coordinates?

Say we are drawing the rectangle like this:

Rectangle(hdc,5,5,50,50);

Upvotes: 0

Views: 2286

Answers (1)

dunc123
dunc123

Reputation: 2713

You can find the documentation here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162898(v=vs.85).aspx

BOOL Rectangle(
  _In_  HDC hdc,
  _In_  int nLeftRect,
  _In_  int nTopRect,
  _In_  int nRightRect,
  _In_  int nBottomRect
);

Parameters

hdc [in]
    A handle to the device context.

nLeftRect [in]
    The x-coordinate, in logical coordinates, of the upper-left 
    corner of the rectangle.

nTopRect [in]
    The y-coordinate, in logical coordinates, of the upper-left 
    corner of the rectangle.

nRightRect [in]
    The x-coordinate, in logical coordinates, of the lower-right 
    corner of the rectangle.

nBottomRect [in]
    The y-coordinate, in logical coordinates, of the lower-right 
    corner of the rectangle.

By the way, this is the first result on Google when searching for "c++ Rectangle"

Upvotes: 3

Related Questions