Displaying an Image

Set the following properties (possibly at design time) to control the style of display:

AutoRepaint property

BackColor property

BackErase property

BitonalScaling property

PaintDither property

PaintPalette property

PaintRgnOnly property

PaintROP3 property

PaintGamma property

PaintIntensity property

PaintContrast property

Transparent property

PaintScaling property

For additional settings, refer to Using Special Effects When Painting. and Adding a Frame to the Control.

Use the following properties to implement automated scaling, positioning and scrolling of an image.

AutoScroll property

AutoSetRects property

AutoSize property

CenterImage property

EnableKeyboard property

EnableScroll property

PaintSizeMode property

PaintSizeUseDPI property

PaintZoomFactor property

ZoomToRect method

If you do not use the automated scaling properties, other properties and methods let you specify exactly which part of an image to paint and how big to make it.

When painting an image, LEADTOOLS uses the following four rectangles that determine how the image is scaled, positioned, and cropped:

image\sqrblit.gif The source rectangle determines which part of the bitmap LEADTOOLS treats as the source image. By default, it is the whole bitmap. (In fact, by default, all four rectangles are initialized to the size of the bitmap.)

image\sqrblit.gif The destination rectangle positions the displayed image relative to the LEAD control and determines the displayed size. If the destination rectangle is larger or smaller than the source rectangle, LEADTOOLS scales the image to fit the destination rectangle. You can view the following illustrations in a separate window:

 

Specifying Only the Destination Rectangles

 

Specifying Both the Source and Destination Rectangles

image\sqrblit.gif The source clipping rectangle limits the part of the source rectangle that LEADTOOLS paints. This rectangle does not affect scaling. You can view the following illustration in a separate window:

 

Specifying the Source Clipping Rectangle

image\sqrblit.gif The destination clipping rectangle limits the part of the destination rectangle that LEADTOOLS paints. This rectangle does not affect scaling, but if the image is scaled, you should set it to match the destination rectangle. You can view the following illustration in a separate window:

 

Specifying the Destination Clipping Rectangle

If you set the AutoSetRects property to true, when a bitmap is loaded or resized, LEADTOOLS initializes all four rectangles to a 0, 0 position and to the same width and height as the bitmap. If you set the AutoScroll property, LEADTOOLS automatically adjusts the origin of the destination rectangles when the user scrolls the image.

The size of the LEAD control also can limit how much of the image is displayed. The way you size and position the LEAD control depends on your programming environment, but you can set the destination rectangle to fit the size of the control.

Use the following properties to get the current client area of the LEAD control. Typically, you would use these properties to fit the destination rectangle to the size of the control. These are basic properties which are not documented.

Height property

Left property

Top property

Width property

Use the following methods to set the rectangle specifications:

SetDstClipRect method

SetDstRect method

SetSrcClipRect method

SetSrcRect method

Alternatively, you can read or write the following properties that define the rectangles:

DstClipHeight property

DstClipLeft property

DstClipTop property

DstClipWidth property

DstHeight property

DstLeft property

DstTop property

DstWidth property

SrcClipHeight property

SrcClipLeft property

SrcClipTop property

SrcClipWidth property

SrcHeight property

SrcLeft property

SrcTop property

SrcWidth property

Occasionally, it is necessary to convert between bitmap coordinates and client area coordinates. LEADTOOLS provides the BitmapToClient and ClientToBitmap methods for converting coordinates. Each of these methods takes as parameters the X and Y coordinates to be converted, and updates the ConvertX and ConvertY properties with the newly converted coordinates.

Use the following method to force repainting of the image. (If the AutoRepaint property is set to TRUE, you do not have to force a repaint.)

ForceRepaint method

Use the following method to force repainting of a specified rectangle in the LEAD control's client area.

RepaintRect method

Use the following properties and methods to apply window leveling to a 12 or 16-bit grayscale image. (Support for 12 and 16-bit grayscale images is available in Document/Medical toolkits only. Support for window leveling is available in Medical toolkits only.):

WindowLevel method

WindowLevelFillLUT method

LevelLUT property

LevelLUTLength property