ToolStripItemImageScaling Enum
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Anger om storleken på bilden på en ToolStripItem justeras automatiskt så att den får plats på en ToolStrip samtidigt som den ursprungliga bildens proportioner bevaras.
public enum class ToolStripItemImageScaling
public enum ToolStripItemImageScaling
type ToolStripItemImageScaling =
Public Enum ToolStripItemImageScaling
- Arv
Fält
| Name | Värde | Description |
|---|---|---|
| None | 0 | Anger att storleken på bilden på en ToolStripItem inte justeras automatiskt för att passa på en ToolStrip. |
| SizeToFit | 1 | Anger att storleken på bilden på en ToolStripItem justeras automatiskt så att den får plats på en ToolStrip. |
Exempel
I följande exempel anges egenskapen ToolStripItem.ImageScaling till 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
Kommentarer
Egenskaperna Image, ImageAlign, ImageIndex, ImageKeyoch ImageScaling gäller olika aspekter av bildhantering. Använd avbildningar i ToolStrip kontroller genom att ange dessa egenskaper direkt eller genom att ange egenskapen körtid.ImageList
Bildskalning bestäms av interaktionen mellan egenskaper i både ToolStrip och ToolStripItemenligt följande:
ImageScalingSize är skalan för den slutliga avbildningen enligt kombinationen av avbildningens ImageScaling inställning och containerns AutoSize inställning.
Använd egenskapen om du vill styra bildstorleken ImageScalingSize .