ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage properties / Properties associated with windows, pages and controls
  • Finding out the display mode and the alignment mode of an image (syntax 1)
  • Limits
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The ImageMode property is used to get and change:
  • the display mode of an image,
  • the alignment of image,
  • the HQ mode of image.
This property can be used:
  • for an Image control,
  • for an Image table column,
  • for the background of a Chart control found in a window,
  • for a Button control.
Remark: The display mode of an image is defined in the window editor or in the page editor in the control description ("General" tab).
For example:
Normal image
Normal image
Centered image
Centered image
Stretched image
Stretched image
Homothetic centered image
Homothetic centered image
Tiled image
Tiled image
Example
// Modification du mode d'affichage de l'image du champ "IMG_ImageVoiture"
IMG_ImageVoiture.ImageMode = imgTiled
// Modification du mode d'affichage et d'alignement de l'image du champ "IMG_ImageVoiture"
IMG_ImageVoiture.ImageMode = imgNormal + imgAlignVBottom
// Gestion des grandes polices : l'image n'est pas agrandie car un dessin va être effectué
IMG_ImageVoiture.ImageMode = IMG_ImageVoiture.ImageMode + imgNoScale
Syntax

Finding out the display mode and the alignment mode of an image Hide the details

<Current mode> = <Control used>.ImageMode
<Current mode>: Integer constant (or combination of constants)
  • Current image display mode:
    imgCenteredCentered: Image centered in the control.
    imgHHomothetic: The image stretches or shrinks while maintaining its aspect ratio to fit the control.
    imgHCHomothetic centered: The image stretches or shrinks while maintaining its aspect ratio to be centered and fit the control.
    imgHCEHomothetic centered extended: Image enlarged or reduced (while respecting the proportions of the initial image) in order for the smaller side of the image to be entirely displayed in the control and in order for the image to be centered in the control.
    imgHCWISHomothetic without enlargement: If the full image fits the control, it is displayed at its original size (100%) and centered in the control. Otherwise, it is downsized, while maintaining its aspect ratio to fit and appear centered in the control.
    Android This constant is not available.
    imgHEHomothetic extended: The image stretches or shrinks while maintaining its aspect ratio so that the smaller side of the image fits the control.
    imgHWISHomothetic without enlargement: If the full image fits the control, it is displayed at its original size (100%). Otherwise, it is downsized, while maintaining its aspect ratio to fit the control.
    Android This constant is not available.
    imgNormal100%: The image is displayed at its original size (100%) in the upper-left corner of the control.
    imgStretchedStretched: The image stretches to fill the control.
    imgTiledTiled: The image is repeated while maintaining its original size (100%) to fit the control (tile design).
  • Alignment mode of the image:
    imgAlignHCenteredHorizontally centered.
    WEBDEV - Server codeAndroidJava This constant is not available.
    imgAlignHRightHorizontal alignment to right.
    WEBDEV - Server codeAndroidJava This constant is not available.
    imgAlignVBottomBottom vertical alignment.
    WEBDEV - Server codeAndroidJava This constant is not available.
    imgAlignVCenteredVertically centered.
    WEBDEV - Server codeAndroidJava This constant is not available.
  • Management of image quality:
    imgHQIn homothetic mode, used to improve the quality of image when this one is reduced in relation to its initial size.
    WEBDEV - Server codeAndroidJava This constant is not available.
  • Management of large fonts:
    imgNoScaleIn "Large fonts" mode of Windows, the image displayed in an Image control is automatically zoomed.
    The imgNoScale constant allows you not to zoom the image in "Large fonts" mode. This constant is useful for drawing in controls that contain a bitmap screenshot.
    This constant must be combined with one of the constants used to define the display mode of image.
    WEBDEV - Server codeAndroidJava This constant is not available.
<Control used>: Control name
Name of the control to be used.

Modifying the display mode and the alignment mode of an image Hide the details

<Control used>.ImageMode = <New mode>
<Control used>: Control name
Name of the control to be used.
<New mode>: Integer constant
  • New display mode for the image:
    imgCenteredCentered: Image centered in the control.
    imgHHomothetic: The image stretches or shrinks while maintaining its aspect ratio to fit the control.
    imgHCHomothetic centered: The image stretches or shrinks while maintaining its aspect ratio to be centered and fit the control.
    imgHCEHomothetic centered extended: Image enlarged or reduced (while respecting the proportions of the initial image) in order for the smaller side of the image to be entirely displayed in the control and in order for the image to be centered in the control.
    imgHCWISHomothetic without enlargement: If the full image fits the control, it is displayed at its original size (100%) and centered in the control. Otherwise, it is downsized, while maintaining its aspect ratio to fit and appear centered in the control.
    Android This constant is not available.
    imgHEHomothetic extended: The image stretches or shrinks while maintaining its aspect ratio so that the smaller side of the image fits the control.
    imgHWISHomothetic without enlargement: If the full image fits the control, it is displayed at its original size (100%). Otherwise, it is downsized, while maintaining its aspect ratio to fit the control.
    Android This constant is not available.
    imgNormal100%: The image is displayed at its original size (100%) in the upper-left corner of the control.
    imgStretchedStretched: The image stretches to fill the control.
    imgTiledTiled: The image is repeated while maintaining its original size (100%) to fit the control (tile design).
  • Alignment mode of the image:
    imgAlignHCenteredHorizontally centered.
    WEBDEV - Server codeAndroidJava This constant is not available.
    imgAlignHRightHorizontal alignment to right.
    WEBDEV - Server codeAndroidJava This constant is not available.
    imgAlignVBottomBottom vertical alignment.
    WEBDEV - Server codeAndroidJava This constant is not available.
    imgAlignVCenteredVertically centered.
    WEBDEV - Server codeAndroidJava This constant is not available.
  • Management of image quality:
    imgHQIn homothetic mode, used to improve the quality of image when this one is reduced in relation to its initial size.
    WEBDEV - Server codeAndroidJava This constant is not available.
  • Management of large fonts:
    imgNoScaleIn "Large fonts" mode of Windows, the image displayed in an Image control is automatically zoomed.
    The imgNoScale constant allows you not to zoom the image in "Large fonts" mode. This constant is useful for drawing in controls that contain a bitmap screenshot.
    This constant must be combined with one of the constants used to define the display mode of image.
    WEBDEV - Server codeAndroidJava This constant is not available.
Remarks

Finding out the display mode and the alignment mode of an image (syntax 1)

The ImageMode property returns a single value representing both the image display and alignment mode.
To separate the alignment information from the display information, a binary filter must be applied in order to subtract the display mask or the alignment mask from the result (BitwiseAND).
Tip: To only retrieve the value corresponding to the alignment mode, apply a binary mask whose value is the reunion of all alignment constants. The remaining constant will be the alignment constant used in the image. For example:
ModeActuel is int
MasqueModeAlignement is int
ModeAlignement is int

ModeActuel = IMG_Photo.ImageMode

MasqueModeAlignement = imgAlignHCentered + imgAlignHRight + imgAlignVBottom + imgAlignVCentered

ModeAlignement = BitwiseAND(ModeActuel, MasqueModeAlignement)
Info(ModeAlignement)

Limits

The ImageMode property applies only to:
  • the Image controls,
  • the Image columns found in the Table controls,
  • Chart controls in windows,
  • the Button controls.
Java The ImageMode property applies only to Image controls.
AndroidJava If the display mode is modified through programming, the content of the image must be re-assigned to view the changes.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/04/2024

Send a report | Local help