Available in the LEADTOOLS Imaging toolkit. |
Displaying an Image
Set the following properties (possibly at design time) to control the style of display:
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.
AutoScroll 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:
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.)
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
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
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:
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.
Use the following methods to set the rectangle specifications:
Alternatively, you can read or write the following properties that define the rectangles:
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.)
The following property enables or disables painting of the control's window:
Use the following method to force repainting of a specified rectangle in the LEAD control's client area.
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.):