Using LBitmapWindow as a Control

To use the LBitmapWindow (or any derived) class as a windowed control in your application, you must create an LBitmapWindow object as a child window of some parent window, such as a dialog box, using LBitmapWindow::CreateWnd. After that, the parent window will receive control notification messages that you can process if you like.

This example was done using MFC, so your code may look different if you use some other foundation class library.

// First, you should create a button control in your dialog box (IDC_BUTTON)   
// Next, in your View class, declare an LBitmapWindow (or derived) class object   
LBitmapWindow m_Image; 
// Finally, in your application's initialization code, you can add the following to use   
// the LBitmapWindow (or derived) object as a windowed control: 
// NOTE: Do not forget to load the libraries in application's initialization code:   
// LBase::LoadLibraries(LT_ALL_LEADLIB);   
CRect rcRect;   
COLORREF rgb;   
CWnd *pWnd;   
// Get the window for the created button   
pWnd = GetDlgItem(IDC_BUTTON);   
// Get the rectangle of the button   
// Create the LBitmapWindow control, make it visible, and make it center the image   
m_Image.CreateWnd(pWnd->m_hWnd, 901, WS_VISIBLE|L_BS_CENTER,   
rcRect.TopLeft().x, rcRect.TopLeft().y, rcRect.BottomRight().x,   
// Load the file   
// Get the background of the button   
rgb = GetSysColor(COLOR_BTNFACE);   
// Set the window background color   
// Fit the image in the window   
m_Image.SetZoomMode(ZOOM_FIT, TRUE); 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help