CGXGridCore::SetGridRect

void SetGridRect(BOOL bSet, LPRECT rect = NULL);

bSet

Specifies if the area should be set (TRUE) or reset (FALSE).

rect

Points to the rectangle with the display area.

Remarks

Sets the grid rectangle for the window.

Normally, the grid computes its drawing area with GetClientRect. If you call this method to set the drawing area, this area will be used in subsequent calls to GetGridRect.

Please note that you have to take care of calling this method when the user changes the window size.

Calling this method is useful if you want to display a grid title. (See the example.)

Example

This example illustrates how to reserve an extra 1-inch margin at the top of the window.

BOOL CSampleView::OnSize(UINT nType, int cx, int cy)
{
   if (nType == SIZE_RESTORED)
   {
      CRect rect(0, 72, cx, cy);   // 72 Pixels compares to one inch
      SetGridRect(TRUE, rect);
   }
   return CGXGridView::OnSize(nType, cx, cy);
}

You can draw this reserved area in the OnGridDraw method of your derived view class.

See Also

 CGXGridCore::GetGridRect

CGXGridCore

 Class Overview |  Class Members