Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
LBitmapWindow::CreatePanWnd
#include "ltwrappr.h"
HWND LBitmapWindow::CreatePanWnd(ulDisplayFlags, x, y, nCx, nCy, pszClassName, hIcon, hCursor, bSysMenu)
L_UINT32 ulDisplayFlags; |
/* flags that determine how the image is painted in the Pan Window */ |
L_INT x; |
/* x coordinate of the Pan Window */ |
L_INT y; |
/* y coordinate of the Pan Window */ |
L_INT nCx; |
/* width of the Pan Window */ |
L_INT nCy; |
/* height of the Pan Window */ |
L_TCHAR * pszClassName; |
/* registered window class name */ |
HICON hIcon; |
/* icon handle */ |
HCURSOR hCursor; |
/* cursor handle */ |
L_BOOL bSysMenu; |
/* flag that indicates whether the Pan Window will have a system menu */ |
Creates a Pan Window for the bitmap window.
Parameter |
Description |
|
ulDisplayFlags |
Flags that determine how the image is painted in the Pan Window. For values, refer to Flags for the Flags for the LBitmapSettings::SetDisplayMode Function. |
|
x |
X coordinate for the origin of the Pan Window. |
|
y |
Y coordinate for the origin of the Pan Window. |
|
nCx |
Width of the Pan Window. |
|
nCy |
Height of the Pan Window. |
|
pszClassName |
The registered window class name to be used in creating the Pan Window. |
|
hIcon |
The icon handle used for creating Pan Window. |
|
hCursor |
The cursor handle used for creating Pan Window. |
|
bSysMenu |
Flag that indicates whether the Pan Window will have a system menu. Possible values are: |
|
|
Value |
Meaning |
|
TRUE |
The Pan Window will have a system menu. |
|
FALSE |
The Pan Window will not have a system menu. |
Returns
!= NULL |
The function was successful and the returned value is the window handle for the created control. |
NULL |
An error occurred, and the window could not be created. |
Comments
If you call this function for a class object that already has a created Pan Window associated with it, the function will destroy the existing Pan Window and create a new one with the specified settings.
Required DLLs and Libraries
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
Example
class LUserBWndCreatePanWnd : public LBitmapWindow { public: LUserBWndCreatePanWnd() ; virtual ~LUserBWndCreatePanWnd() ; virtual L_VOID PanWndCallBack(L_UINT uFlag,LPRECT rcPan); virtual LRESULT MsgProcCallBack(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); virtual L_BOOL OnFileDropped(L_TCHAR * pszFile,L_UINT uFileNumber,L_UINT uFilesCount); virtual L_VOID OnDraw(HDC hdc,RECT& Rect); virtual L_VOID OnZoom(L_UINT uZoomPercent); virtual L_VOID PaintNotification(L_INT nPass, L_INT uType); }; LUserBWndCreatePanWnd::LUserBWndCreatePanWnd() { } LUserBWndCreatePanWnd::~LUserBWndCreatePanWnd() { } L_VOID LUserBWndCreatePanWnd::PanWndCallBack(L_UINT uFlag,LPRECT rcPan) { UNREFERENCED_PARAMETER(rcPan); // user can set his code for each message switch (uFlag) { case PANWIN_CREATED: // user code return; case PANWIN_UPDATED: // user code return; case PANWIN_DESTROYED: // user code return; case PANWIN_MOVED: // user code return; } } LRESULT LUserBWndCreatePanWnd::MsgProcCallBack(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { switch (uMsg) { case WM_CLOSE: break ; }; return LBitmapWindow::MsgProcCallBack(hWnd,uMsg,wParam,lParam); } L_BOOL LUserBWndCreatePanWnd::OnFileDropped(L_TCHAR * pszFile, L_UINT uFileNumber, L_UINT uFilesCount) { UNREFERENCED_PARAMETER(uFilesCount); UNREFERENCED_PARAMETER(uFileNumber); SetFileName(pszFile); if (Load() == SUCCESS) return FALSE; //if loading the file succeeded then stop enumerating files return TRUE; } L_VOID LUserBWndCreatePanWnd::OnDraw(HDC hdc,RECT& Rect) { UNREFERENCED_PARAMETER(Rect); Rectangle( hdc,10,10, 50,50); } L_VOID LUserBWndCreatePanWnd::OnZoom(L_UINT uZoomPercent) { L_TCHAR szBuffer[50]; wsprintf(szBuffer,TEXT("Zoom Percent = %u\n"),uZoomPercent) ; ::MessageBox( m_hWnd, szBuffer, TEXT("Zoom Percent"), MB_OK) ; } L_VOID LUserBWndCreatePanWnd::PaintNotification(L_INT nPass, L_INT nType) { L_TCHAR szBuffer[50]; wsprintf(szBuffer,TEXT("Pass Number = %d\nType Effect No. = %d\n"), nPass, nType) ; ::MessageBox( m_hWnd, szBuffer, TEXT("Effect Information"), MB_OK) ; } L_INT LBitmapWindow__CreatePanWndExample(HWND hWndParent) { L_INT nRet; LUserBWndCreatePanWnd UserBitmapWindow; HWND hWnd ; UserBitmapWindow.SetFileName(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\image1.cmp")); nRet = UserBitmapWindow.Load(0, ORDER_BGR) ; if (nRet== SUCCESS) { hWnd = UserBitmapWindow.CreateWnd( hWndParent) ; if (hWnd == NULL) return 0 ; UserBitmapWindow.HandlePalette(WM_QUERYNEWPALETTE,0,0); UserBitmapWindow.Repaint(); L_UINT32 ulDisplayFlags = UserBitmapWindow.GetDisplayMode() ; UserBitmapWindow.CreatePanWnd(ulDisplayFlags, 0, 0, 150, 150, TEXT("PAN_WIN"), NULL, NULL, TRUE) ; hWnd = UserBitmapWindow.GetPanWnd() ; if (hWnd != NULL) { nRet =UserBitmapWindow.UpdatePanWnd( ulDisplayFlags, RGB(255,0,0),TEXT("Pan Window ")) ; if(nRet !=SUCCESS) return nRet; } else return FAILURE; //... do any operation on window nRet =UserBitmapWindow.Flip(); if(nRet !=SUCCESS) return nRet; if (UserBitmapWindow.IsPanWndCreated() == TRUE) UserBitmapWindow.UpdatePanWnd( ulDisplayFlags, RGB(255,255,255),TEXT("Pan Window ")) ; MessageBox(hWndParent, TEXT("Pan Window was created successfully.\n press OK to destroy it"), TEXT("BitmapWindowSamples"), MB_OK); hWnd = UserBitmapWindow.GetPanWnd() ; if (hWnd != NULL) { // after you finish, destroy PanWindow nRet =UserBitmapWindow.DestroyPanWnd() ; if(nRet !=SUCCESS) return nRet; } else return FAILURE; hWnd = UserBitmapWindow.GetBitmapWnd() ; if (hWnd != NULL) { L_FLOAT fZoomFactor ; L_UINT uPercent ; UserBitmapWindow.ZoomIn() ; // set zoom factor with initialize value UserBitmapWindow.SetZoomFactor() ; // set zoom percent UserBitmapWindow.SetZoomPercent(100); UserBitmapWindow.ZoomIn() ; // get current zoom factor fZoomFactor = UserBitmapWindow.GetZoomFactor() ; fZoomFactor += 0.50 ; // set new zoom factor UserBitmapWindow.SetZoomFactor(fZoomFactor) ; uPercent = UserBitmapWindow.GetZoomPercent(); uPercent += 50 ; // set new zoom percent UserBitmapWindow.SetZoomPercent(uPercent); UserBitmapWindow.ZoomOut(); // Drag Files ... if (UserBitmapWindow.IsDragAcceptFilesEnabled() == FALSE) UserBitmapWindow.EnableDragAcceptFiles(TRUE) ; } else return FAILURE; } return SUCCESS ; }