Gets the bounding rectangle for the container.
#include "ltwrappr.h"
L_INT LImageViewer::GetBounds (lpRect, uFlags);
A pointer to a RECT structure to be updated with the bounding rectangle of the container.
Reserved for future use. Pass 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The coordinates of lpRect are relative to the parent window coordinates. If the container window has no parent, the coordinates will be relative to the screen coordinates.
To set the bounding rectangle for the container, call LImageViewer::SetBounds.
This function determines whether the container's client area is different from its parent's.
#define RECT_HEIGHT(lpRect) ((lpRect)->bottom - (lpRect)->top)
#define RECT_WIDTH(lpRect) ((lpRect)->right - (lpRect)->left)
L_INT LImageViewer_GetBoundsExample(LImageViewer& ImageViewer)
{
RECT rcRect;
RECT rcParentRect;
CWnd* pwndParent;
CWnd wndContainer ;
L_INT nRet = 0 ;
// Get the container's bonding rectangle.
nRet = ImageViewer.GetBounds(&rcRect, 0);
if(nRet != SUCCESS)
return nRet;
nRet = wndContainer.Attach(ImageViewer.GetWindowHandle(0)) ;
// Get the container window's parent
pwndParent = wndContainer.GetParent();
// if the container has no parent then abort.
if (pwndParent == NULL)
return FAILURE;
pwndParent->GetClientRect(&rcParentRect);
// check if the container's client area is different from the parent's client area.
if ((RECT_WIDTH(&rcRect) != RECT_WIDTH(&rcParentRect)) || (RECT_HEIGHT(&rcRect) != RECT_HEIGHT(&rcParentRect)))
{
nRet = ImageViewer.SetBounds(&rcParentRect, 0);
if(nRet != SUCCESS)
return nRet;
}
wndContainer.Detach() ;
return SUCCESS;
}