LBitmapWindow::SetAutoRgnToFloater

#include "ltwrappr.h"

L_BOOL LBitmapWindow::SetAutoRgnToFloater(bAutoRgnToFloater)

L_BOOL bAutoRgnToFloater;

/* flag that indicates whether to create the floater */

Enables or disables the automatic creation of a floater from a region.

Parameter

Description

bAutoRgnToFloater

Flag that indicates whether to enable or disable the automatic creation of a floater from a region. Possible values are:

 

Value

Meaning

 

TRUE

[1] Enable the automatic creation of a floater from the region. This is the default value.

 

FALSE

[0] Disable the automatic creation of a floater from the region.

Returns

The previous setting.

TRUE

The previous setting was TRUE.

FALSE

The previous setting was FALSE.

Comments

The view perspective is always TOP_LEFT.

If you move the floater, the original region remains unchanged.

This member function does not affect the creation of floaters using the TOOL_REGION tool. This function only affects the behavior of the Lregion functions on the LbitmapWindow().

To create a floater programmatically with no region, do the following:

RECT Rect={10,20,50,100};
m_ BitmapWindow.SetAutoRgnToFloater(TRUE);
LBitmapRgn Region(&m_ BitmapWindow);   
Region.SetRgnRect(&Rect);

To create a region programmatically with no floater, do the following:

RECT Rect={10,20,50,100};
m_ BitmapWindow.SetAutoRgnToFloater(FALSE);
LBitmapRgn Region(&m_ BitmapWindow);   
Region.SetRgnRect(&Rect);

Required DLLs and Libraries

LTDIS
LTDLG
LTEFX
LTFIL
LTIMG
LTSCR
LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LBitmapWindow::GetFloater, LBitmapWindow::GetFloaterRgn, LBitmapWindow::HasFloater, LBitmapWindow::GetAutoRgnToFloater, Class Members, Floaters and Regions in the LbitmapWindow Class

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmapWindow__SetAutoRgnToFloaterExample(HWND m_hWnd)
{
   L_INT nRet;
   LBitmapWindow *pBitmapWindow = new(LBitmapWindow);
   LBitmapRgn *pBitmapRgn = new(LBitmapRgn);
   RECT rRgnBounds, myRect;
   L_BOOL bIsValid;
   L_BOOL bAutoRgnToFloater;
   L_BOOL bBitmapHasRgn;
   L_BOOL bHasRgn;
   L_BOOL bHasFloater;
   L_TCHAR szTemp[300], szOutput[300];
   HRGN hRgn; 
   pBitmapWindow->EnableAutoPaint(TRUE);
   pBitmapWindow->SetWndHandle(m_hWnd);
   
   nRet =pBitmapWindow->Load(MAKE_IMAGE_PATH(TEXT("ULAY1.BMP")));
   if(nRet !=SUCCESS)
      return nRet;
   pBitmapWindow->SetAutoRgnToFloater (TRUE); 
   pBitmapRgn->SetBitmap(pBitmapWindow);
   RECT Rect={10,20,50,100};
   //set the rect as a region 
   nRet =pBitmapRgn->SetRgnRect(&Rect);
   if(nRet !=SUCCESS)
      return nRet;
   bIsValid = pBitmapRgn->IsValid();
   bAutoRgnToFloater = pBitmapWindow->GetAutoRgnToFloater();
   bBitmapHasRgn = pBitmapRgn->BitmapHasRgn();
   bHasRgn = pBitmapWindow->HasRgn();
   bHasFloater = pBitmapWindow->HasFloater();
   pBitmapRgn->GetRgnBounds(&rRgnBounds);
   wsprintf( szOutput,
            TEXT("[%d]pBitmapRgn->IsValid()\n[%d]pBitmapWindow->GetAutoRgnToFloater()\n[%d]pBitmapRgn->BitmapHasRgn()\n[%d]pBitmapWindow->HasRgn()\n[%d]pBitmapWindow->HasFloater()\npBitmapRgn->GetRgnBounds(%d, %d, %d, %d)\n\n"),
            bIsValid,
            bAutoRgnToFloater,
            bBitmapHasRgn, 
            bHasRgn, 
            bHasFloater, 
            rRgnBounds.left, 
            rRgnBounds.top, 
            rRgnBounds.right, 
            rRgnBounds.bottom 
            ); 
   hRgn = pBitmapWindow->GetFloaterRgn(FLOAT_RGN_TRANS_NONE);
   GetRgnBox(hRgn, &myRect);
   wsprintf(szTemp, TEXT("%spBitmapWindow->GetFloaterRgn(FLOAT_RGN_TRANS_NONE) (%d, %d, %d, %d)\n"), 
      szOutput,
      myRect.left,
      myRect.top,
      myRect.right,
      myRect.bottom);
   lstrcpy(szOutput, szTemp); 
   hRgn = pBitmapWindow->GetFloaterRgn (FLOAT_RGN_TRANS_FROM_WINDOW); //bombs
   GetRgnBox(hRgn, &myRect);
   wsprintf(szTemp, TEXT("%spBitmapWindow->GetFloaterRgn(FLOAT_RGN_TRANS_FROM_WINDOW) (%d, %d, %d, %d)\n"), 
      szOutput,
      myRect.left,
      myRect.top,
      myRect.right,
      myRect.bottom);
   lstrcpy(szOutput, szTemp);
   AfxMessageBox(szOutput); 
   return SUCCESS;
}