ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Graphic string functions
  • Inserting images
  • Image height (List Box or Combo Box control)
  • Image in the title of a column in a Table control
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Builds a sequence of characters containing an image.
WINDEVAndroidiPhone/iPadIOS WidgetMac Catalyst In a window, this sequence of characters is used to insert an image:
  • in an element of a List Box or Combo Box control.
  • WINDEV in the title bar and/or status bar of a window.
  • in a Static Text control.
  • in a Text column found in a Table control.
The inserted image can be:
  • a standard image,
  • an image made of several drawings. This image will have been divided beforehand (by LoadImage or by LoadImageSheet).
Example
WINDEVUser code (UMC)
// Add the "C:\MyImages\Image.BMP" image to the "LIST_Customer" control
ListAdd(LIST_Customer, gImage("C:\MyImages\Image.BMP"))
// Add an image made of several drawings
// Split into 10 rows and 2 columns
// Load the "C:\MyImages\DecImage.BMP" image in memory
LoadImage(IDImage, "C:\MyImages\DecImage.BMP", 10, 2)
FOR DrawingRank = 1 TO 10*2
ListAdd(LIST_Customer, gImage(IDImage, DrawingRank))
END
// Add an image to the title of a column in a Table control
TABLE_MyTable.COL_MyColumn.Title = gImage("MyImage.BMP") + "My title"
Syntax

Inserting a standard image Hide the details

<Result> = gImage(<Image name>)
<Result>: Character string
Sequence of characters in the following format: <Image identifier>, <Drawing rank>.
WINDEV This sequence of characters can be:
  • used in ListAdd, ListInsert or ListModify.
  • assigned to a Static Text control.
  • used in the title bar or status bar of a window.
  • used in a Text column found in a Table control.
WEBDEV - Server code This sequence of characters is not interpreted by the controls in WEBDEV. This function can be used to format the string returned by a WEBDEV web service consumed by a WINDEV or WINDEV Mobile application.
<Image name>: Character string
  • Name and full (or relative) path of the image to insert. A UNC path can be used.
  • Name of Image control containing the image to insert.
WINDEVWEBDEV - Server codeUser code (UMC)

Inserting an image made of several drawings Hide the details

<Result> = gImage(<Image identifier> , <Drawing rank>)
<Result>: Character string
Sequence of characters in the following format: <Image identifier>, <Drawing rank>.
WINDEV This sequence of characters can be:
  • used in ListAdd, ListInsert or ListModify.
  • assigned to a Static Text control.
  • used in the title bar or status bar of a window.
  • used in a Text column found in a Table control.
WEBDEV - Server code This sequence of characters is not interpreted by the controls in WEBDEV. This function can be used to format the string returned by a WEBDEV web service consumed by a WINDEV or WINDEV Mobile application.
<Image identifier>: Integer
Identifier of the image (between 1 and 9) corresponding to the identifier of the image divided and loaded in memory by LoadImage or LoadImageSheet.
<Drawing rank>: Integer
Number of the drawing cut. The set of drawings constitutes the image. This number ranges from 1 to the result of the multiplication of <Number of columns> and <Number of rows> used in LoadImage or LoadImageSheet.

Inserting an image contained in an Image variable Hide the details

<Result> = gImage(<Image> [, <Mode>])
<Result>: Character string
Sequence of characters in the following format: <Image identifier>, <Drawing rank>.
WINDEV This sequence of characters can be:
  • used in ListAdd, ListInsert or ListModify.
  • assigned to a Static Text control.
  • used in the title bar or status bar of a window.
  • used in a Text column found in a Table control.
WEBDEV - Server code This sequence of characters is not interpreted by the controls in WEBDEV. This function can be used to format the string returned by a WEBDEV web service consumed by a WINDEV or WINDEV Mobile application.
<Image>: Image variable
Name of the Image variable to insert.
<Mode>: Optional Integer constant
Image display mode:
imgCenteredCentered: Image centered in the control.
imgHCHomothetic centered: Image enlarged or reduced while respecting the proportions of the initial image to be entirely displayed in the control and centered in the control.
imgHCEHomothetic extended centered: Image enlarged or reduced in size, respecting the proportions of the original image, so that the smaller side of the image is displayed entirely in the field and the image is centered in the field..
imgHCWISHomothetic without increasing size: If the image can be entirely displayed in the control, it is displayed at 100% and centered in the control. Otherwise, it is downsized, while maintaining its aspect ratio to fit and appear centered in the control.
imgHEHomothetic extended: Image enlarged or reduced while respecting the proportions of the initial image in order for the smallest side of the image to be entirely displayed in the control.
imgHWISHomothetic without increasing size: If the image can be entirely displayed in the control, it is displayed at 100%. Otherwise, it is downsized, while maintaining its aspect ratio to fit the control.
imgNormal100%: Image displayed at 100% in the upper-left corner of the control.
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 code This constant is not available.
imgStretchedStretched: Image stretched to occupy the entire surface of the control.

Android This parameter is not available.
Remarks

Inserting images

  • gImage can be used to insert an image:
    • into the title and status bars of a window or into a Static Text control.
    • into a Table control. In this case, the image must be inserted into a text column.
  • To display a text over an image:
    • Insert an image with gImage,
    • Describe the background color of the text with gBackground and the Transparent constant,
    • Display the text.
      For example:
      ListAdd(LIST_ListView, gImage(ImagePath) + gBackground(Transparent) + gCoord(0, 0) + ...
      "Text")
  • If a row of a Combo Box control displays an image via gImage, when this row is selected, the image is re-used in the main row.

Image height (List Box or Combo Box control)

The height of the image displayed in an element of a List Box or Combo Box control is truncated to the number of pixels specified when the control was created ("Style" tab of the control description).
WINDEV

Image in the title of a column in a Table control

The TitleImage property is used to add an image to the title of a column in a Table control.
Business / UI classification: Neutral code
Component: wd300mdl.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/30/2024

Send a report | Local help