Getting and Setting Container Properties

Container Metrics

The container possesses many properties that can be modified. These include pen characteristics, brush characteristics, owner window, offset values, scalar values, etc. The ability to modify these characteristics allows the user to fine-tune the container to better meet application specific requirements.

Many characteristics maintained in the CONTAINERMETRICS structure can be changed using the L_ContainerSetMetrics function. These include:

To determine the current settings for the characteristics described in the CONTAINERMETRICS structure, use the L_ContainerGetMetrics function.

The following example shows how to use the container metrics to change the container behavior and appearance:

/*Container metrics structure */ 
CONTAINERMETRICS Metrics; 
/* Initiate the container metrics */ 
Metrics.nSize = sizeof(CONTAINERMETRICS); 
Metrics.dwMask = CMF_BORDERCOLOR | 
CMF_HANDLEWIDTH | 
CMF_HANDLEHEIGHT | 
CMF_LIMITS; 
/* Set the border and the handle to the desired values */ 
Metrics.crBorder = RGB(255, 255, 0); 
Metrics.nHandleWidth = 10; 
Metrics.nHandleHeight = 15; 
/* Set the container limits to some value */ 
SetRect(&Metrics.rcLimits, 0, 0, 500, 500); 
/* Set the container metrics */ 
L_ContainerSetMetrics(g_pLeadContainer, &Metrics); 

Owner window

When a container is created using L_ContainerCreate, the container is attached to a window. This window becomes the owner of the container. This owner can be changed using the L_ContainerSetOwner function. To determine the current owner, use the L_ContainerGetOwner function.

Owner Draw Mode

One of the benefits to using the container is the automatic drawing capabilities it provides. However, this capability can be disabled using the L_ContainerSetOwnerDraw function. If the owner draw mode is set to FALSE (default), the container automatically handles drawing in the container. If the owner draw mode is set to TRUE, then the user is responsible for handling all aspects of object drawing within the container. To determine the current state of the owner draw mode for a container, call L_ContainerIsOwnerDraw.

Enabled

A container must be enabled in order to edit objects within that container. To determine whether a container is enabled, call L_ContainerIsEnabled. To change the current enable status, call L_ContainerSetEnabled.

For information on the scaling values, refer to Container Scaling Values.

For more information on the offsets, refer to Container Offsets.

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Container and Automation C API Help