Aide:GUICtrlCreatePic.txt
De Wiki AutoIt Français
Document original V3.3.6.1 :
###Function###
GUICtrlCreatePic
###Description###
Creates a Picture control for the GUI.
###Syntax###
GUICtrlCreatePic ( filename, left, top [, width [, height [, style [, exStyle]]]] )
###Parameters###
@@ParamTable@@
filename
filename of the picture to be loaded : supported types BMP, JPG, GIF(but not animated).
left
The left side of the control. If -1 is used then left will be computed according to <a href="AutoItSetOption.htm#GUICoordMode">GUICoordMode.
top
The top of the control. If -1 is used then top will be computed according to <a href="AutoItSetOption.htm#GUICoordMode">GUICoordMode.
width
[optional] The width of the control (default is the previously used width).
height
[optional] The height of the control (default is the previously used height).
style
[optional] Defines the style of the control. See <a href="../appendix/GUIStyles.htm#Label">GUI Control Styles Appendix</a>.
default (-1) : $SS_NOTIFY
forced style : $SS_BITMAP
exStyle
[optional] Defines the extended style of the control. See <a href="../appendix/GUIStyles.htm#Extended">Extended Style Table</a>.
@@End@@
###ReturnValue###
@@ReturnTable@@
Success: Returns the identifier (controlID) of the new control.
Failure: Returns 0 if picture cannot be created.
@@End@@
###Remarks###
To set or change information in the control see <a href="GUICtrlUpdate Management.htm">GUICtrlUpdate...</a>.
To update the picture after the dialog box is displayed just use <a href="GUICtrlSetImage.htm">GUICtrlSetImage</a>
If you want to have a picture having the same size as the file content just use width=height=0.
To have a transparent picture it is needed to create the GUI window with WS_EX_LAYERED extended style. The left-top pixel will be used as the transparency color. If several pictures are created the last picture is defining the transparent color. See example 2.
To combine styles with the default style use <b>BitOr</b>($GUI_SS_DEFAULT_PIC, newstyle,...).
To use the values specified above you must #include <StaticConstants.au3> in your script.
Default resizing is $GUI_DOCKSIZE.
If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls: GuiCtrlSetState(-1,$GUI_DISABLE). This is not enough for Tab or Listview control which behave differently. In this case you need to create the picture with the $WS_CLIPSIBLINGS style, GuiCtrlSetState(-1,$GUI_ONTOP) is necessary for the Tab, TreeView or Listview control.
The extended style $GUI_WS_EX_PARENTDRAG can be used to allow the dragging of the parent window for windows that don't have a titlebar (no $WS_CAPTION style in GUICreate).
The background is always set to transparent. GUICtrlSetBkColor() has not effect on pic control.
PNG can be used with GDI+. See example 3.
###Related###
GUICoordMode (Option), GUICtrlSetImage, GUICtrlUpdate..., GUIGetMsg
###Example###
@@IncludeExample@@
Document traduit V3.3.6.1 :
###Function###
GUICtrlCreatePic
###Description###
Crée un contrôle d'image pour une GUI.
###Syntax###
GUICtrlCreatePic ( filename, left, top [, width [, height [, style [, exStyle]]]] )
###Parameters###
@@ParamTable@@
filename
Adresse de l'image à charger: types pris en charge BMP, JPG, GIF (mais sans d'animation).
left
La position en partant de la gauche de la fenêtre. Si vous utilisez -1, la position sera calculé en fonction de <a href="AutoItSetOption.htm#GUICoordMode">GUICoordMode</a>.
top
La position en partant du sommet de la fenêtre. Si vous utilisez -1, la position sera calculé en fonction de <a href="AutoItSetOption.htm#GUICoordMode">GUICoordMode</a>.
width
[optionnel] La largeur du contrôle (par défaut est la largeur utilisée précédemment).
height
[optionnel] La hauteur du contrôle (par défaut est la hauteur utilisée précédemment).
style
[optionnel] Définit le style du contrôle. Voir l'<a href="../appendix/GUIStyles.htm#Label">annexe de styles de contrôle GUI</a>.
défaut (-1) : $SS_NOTIFY
style forcé : $SS_BITMAP
exStyle
[optionnel] Définit le style étendu du contrôle. Voir la <a href="../appendix/GUIStyles.htm#Extended">Table des styles étendus</a>.
@@End@@
###ReturnValue###
@@ReturnTable@@
Succès: Retourne l'identifiant (ID du contrôle) du nouveau contrôle.
Échec: Retourne 0 si l'image ne peut pas être créée.
@@End@@
###Remarks###
Pour définir ou modifier des informations dans le contrôle, voir <a href="GUICtrlUpdate Management.htm">GUICtrlUpdate...</a>.
Pour mettre à jour l'image lorsque le contrôle est affichée il suffit d'utiliser <a href="GUICtrlSetImage.htm">GUICtrlSetImage</a>
Si vous voulez avoir une image ayant la même taille que le contenu du fichier il suffit d'utiliser width=height=0.
Pour avoir une image transparente, il est nécessaire pour créer la fenêtre GUI avec le style étendu WS_EX_LAYERED. Le pixel supérieur gauche est utilisé en tant que couleur de transparence. Si plusieurs photos sont créés la dernière photo définit la couleur de transparence. Voir l'exemple 2.
Pour combiner des styles avec le style par défaut, utilisez <b>BitOr</b> ($GUI_SS_DEFAULT_PIC, nouveau style,...).
Pour utiliser les valeurs indiquées ci-dessus, vous devez inclure <StaticConstants.au3> dans votre script.
Le redimensionnement par défaut est $GUI_DOCKSIZE.
Si une image est définie comme une image de fond, comme les autres contrôles se chevauchent, il est important de désactiver le contrôle d'image et de le créer après les autres contrôles: GuiCtrlSetState(-1, $GUI_DISABLE). Ce n'est pas suffisant pour l'onglet ou le contrôle ListView qui se comportent différemment. Dans ce cas, vous avez besoin de créer l'image avec le style $WS_CLIPSIBLINGS, GuiCtrlSetState(-1, $GUI_ONTOP) est nécessaire pour l'onglet, TreeView ou contrôle ListView.
Le style étendu $GUI_WS_EX_PARENTDRAG peut être utilisé pour permettre le glissement de la fenêtre parent pour les fenêtres qui n'ont pas de barre de titre (pas de style $WS_CAPTION dans GUICreate).
Le fond est toujours mis à transparent. GUICtrlSetBkColor() n'a pas d'effet sur le contrôle d'image.
Les images PNG peuvent être utilisés avec GDI +. Voir l'exemple 3.
###Related###
GUICoordMode (Option), GUICtrlSetImage, GUICtrlUpdate..., GUIGetMsg
###Example###
@@IncludeExample@@
Traducteur : TT22
Contributeurs (pour les modifications avant le Wiki) :