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

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:

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 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. (12 and 16-bit grayscale support are Document/Medical only. Window leveling support is Medical only):

WindowLevel method

LevelLUT property

LevelLUTLength property

LEADTOOLS provides several properties to let the user display OCR data from the OCR engine in an ILEADRasterView control. To do this:

  1. Start the OCR engine for a specific ILEADRasterDocument object.

  2. Set the ActivePageIndex property (ILEADRasterDocument) to the page to be drawn.

  3. Set the RasterDocument property (ILEADRasterView) to the valid ILEADRasterDocument object for which the OCR engine was started in step 1.

  4. Set the EnableOCRDrawing property to TRUE to allow the OCR engine data to be drawn in the ILEADRasterView control.

To display the selected zone on the active page, set the SelectedZoneIndex property (ILEADRasterView).