Displaying an Image

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

Appearance property

AutoRepaint property

BackColor property

BackErase property

BitonalScaling property

BorderStyle property

ForePalette property

PaintDither property

PaintPalette property

PaintRgnOnly property

PaintROP3 property

PaintGamma property

PaintIntensity property

PaintContrast property

PaintScaling property

Transparent 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 and positioning of an image.

AutoSetRects property

CenterImage property

EnableKeyboard property

EnableScroll property

PaintSizeUseDPI property

PaintSizeMode property

PaintZoomFactor property

ZoomToRect method

AutoScroll property

AutoSize property

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:

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 property to specify the unit of measure for the LEAD control:

ScaleMode property

Use the following properties to get the current client area of the LEAD control or to implement a custom coordinate system. Typically, you would use these properties to fit the destination rectangle to the size of the control.

ScaleHeight property

ScaleLeft property

ScaleTop property

ScaleWidth 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

The following property enables or disables painting of the control's window:

EnablePaint property

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

RepaintRect method

When repainting invalidated areas of a bitmap, flickering may occur. To avoid this flicker, enable double buffer image display by setting the DoubleBuffer property to TRUE. This may be particularly helpful when displaying annotations on a bitmap.

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 only in the Document/Medical toolkits. Window leveling is available only in the Medical toolkits.):

WindowLevel method

LevelLUT property

LevelLUTLength property