ToolStripItemImageScaling Énumération
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Spécifie si la taille de l’image sur un ToolStripItem est automatiquement ajustée pour s’adapter à un ToolStrip tout en conservant les proportions d’image d’origine.
public enum class ToolStripItemImageScaling
public enum ToolStripItemImageScaling
type ToolStripItemImageScaling =
Public Enum ToolStripItemImageScaling
- Héritage
Champs
| Nom | Valeur | Description |
|---|---|---|
| None | 0 | Spécifie que la taille de l’image sur une image ToolStripItem n’est pas automatiquement ajustée pour s’adapter à un ToolStrip. |
| SizeToFit | 1 | Spécifie que la taille de l’image sur une image ToolStripItem est automatiquement ajustée pour s’ajuster à un ToolStrip. |
Exemples
L’exemple suivant définit la ToolStripItem.ImageScaling propriété sur SizeToFit.
ToolStripButton^ imageButton;
void InitializeImageButtonWithToolTip()
{
// Construct the button and set the image-related properties.
imageButton = gcnew ToolStripButton;
imageButton->Image =
gcnew Bitmap(Timer::typeid,"Timer.bmp");
imageButton->ImageScaling =
ToolStripItemImageScaling::SizeToFit;
// Set the background color of the image to be transparent.
imageButton->ImageTransparentColor =
Color::FromArgb(0, 255, 0);
// Show ToolTip text, set custom ToolTip text, and turn
// off the automatic ToolTips.
toolStrip1->ShowItemToolTips = true;
imageButton->ToolTipText = "Click for the current time";
imageButton->AutoToolTip = false;
// Add the button to the ToolStrip.
toolStrip1->Items->Add(imageButton);
}
// internal:
internal ToolStripButton imageButton;
private void InitializeImageButtonWithToolTip()
{
// Construct the button and set the image-related properties.
imageButton = new ToolStripButton();
imageButton.Image = new Bitmap(typeof(Timer), "Timer.bmp");
imageButton.ImageScaling = ToolStripItemImageScaling.SizeToFit;
// Set the background color of the image to be transparent.
imageButton.ImageTransparentColor = Color.FromArgb(0, 255, 0);
// Show ToolTip text, set custom ToolTip text, and turn
// off the automatic ToolTips.
toolStrip1.ShowItemToolTips = true;
imageButton.ToolTipText = "Click for the current time";
imageButton.AutoToolTip = false;
// Add the button to the ToolStrip.
toolStrip1.Items.Add(imageButton);
}
Friend WithEvents imageButton As ToolStripButton
Private Sub InitializeImageButtonWithToolTip()
' Construct the button and set the image-related properties.
imageButton = New ToolStripButton()
imageButton.Image = New Bitmap(GetType(Timer), "Timer.bmp")
imageButton.ImageScaling = ToolStripItemImageScaling.SizeToFit
' Set the background color of the image to be transparent.
imageButton.ImageTransparentColor = Color.FromArgb(0, 255, 0)
' Show ToolTip text, set custom ToolTip text, and turn
' off the automatic ToolTips.
toolStrip1.ShowItemToolTips = True
imageButton.ToolTipText = "Click for the current time"
imageButton.AutoToolTip = False
' Add the button to the ToolStrip.
toolStrip1.Items.Add(imageButton)
End Sub
Remarques
Les propriétés Image, ImageAlign, ImageIndex, ImageKey et ImageScaling concernent différents aspects de la gestion des images. Utilisez des images dans les contrôles en ToolStrip définissant ces propriétés directement ou en définissant la propriété runtime uniquement ImageList .
La mise à l’échelle des images est déterminée par l’interaction des propriétés dans les deux ToolStrip et ToolStripItem, comme suit :
ImageScalingSize est l’échelle de l’image finale, telle que déterminée par la combinaison du paramètre de ImageScaling l’image et du paramètre du AutoSize conteneur.
Si AutoSize est
true(valeur par défaut) etToolStripItemImageScalingestSizeToFit, aucune mise à l'échelle d'image ne se produit, et la ToolStrip taille est celle du plus grand élément ou d’une taille minimale prescrite.Si AutoSize est
falseetToolStripItemImageScalingestNone, ni l'image ni la mise à l'échelle de ToolStrip ne se produisent.
Pour contrôler la taille de l’image, utilisez la ImageScalingSize propriété.