LImageListControl::CreateControl
#include "ltwrappr.h"
HWND LImageListControl::CreateControl(hWndParent, nID=0, dwStyle=WS_CHILD|WS_TABSTOP|WS_VISIBLE|WS_BORDER, x=0, y=0, nCx=200, nCy=200, crBackground=RGB(128,128,128))
HWND hWndParent; |
/* handle of the parent window */ |
L_INT nID; |
/* control’s ID */ |
L_UINT32 dwStyle; |
/* control’s style */ |
L_INT x; |
/* x coordinate for the window origin */ |
L_INT y; |
/* y coordinate for the window origin */ |
L_INT nCx; |
/* window width */ |
L_INT nCy; |
/* window height */ |
COLORREF crBack; |
/* background color of control */ |
Creates the image list control using the specified parameters.
Parameter |
Description |
hWndParent |
Window handle of the parent window for the ImageList Control. |
nID |
ID for the ImageList Control. You can use this to identify the control when you process WM_COMMAND notification messages that the control will send to it's parent window. |
dwStyle |
Specifies the control's style, for example WS_VISIBLE, WS_BORDER, or WS_CHILD. For more information on Windows styles, refer to your compiler’s help file. |
x |
X coordinate for the origin of the ImageList Control window. |
y |
Y coordinate for the origin for the ImageList Control window. |
nCx |
The width of the ImageList Control window. |
nCy |
The height for the ImageList Control window. |
crBackground |
The background color for the ImageList Control window. |
Returns
!= NULL |
The function was successful and the return value is the window handle for the created control. |
NULL |
An error occurred, and the control could not be created. Refer to Return Codes. |
Comments
This function causes the class object to create the control window using the specified parameters.
This will fill in the m_hWnd data member with the handle to the new window.
If you call this function for a class object that already has a created window, the function will simply return m_hWnd.
You can destroy the ImageListControl window using the Windows function DestroyWindow.
NOTE: The window is created with the WS_EX_CLIENTEDGE style by default. To change this, you can use the Windows function SetWindowLong. For a list of available styles, refer to LTIMAGELISTCLASS Registered Class: Styles.
The ImageListControl window will send command notification messages to its parent window. For a table of the available command notifications, refer to ImageList Control Command Notifications.
The ImageList Control's parent window will receive these notifications in the form of a WM_COMMAND message.
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: |
|
Topics: |
ImageList Control Command Notifications, Using the ImageList Control |
|
Example
LImageListControl m_ImgList;
void CreateImgListControl(HWND hParent)
{
HWND hCtl = NULL;
hCtl = m_ImgList.CreateControl(hParent,
0);
if(!::IsWindow(hCtl))
AfxMessageBox(TEXT("Failed to
create control!"));
}