ToolStripItemImageScaling Výčet

Definice

Určuje, jestli se velikost obrázku na ToolStripItem automaticky upraví tak, aby se vešla na ToolStrip při zachování původních poměrů obrazu.

public enum class ToolStripItemImageScaling
public enum ToolStripItemImageScaling
type ToolStripItemImageScaling = 
Public Enum ToolStripItemImageScaling
Dědičnost
ToolStripItemImageScaling

Pole

Name Hodnota Description
None 0

Určuje, že velikost obrázku na obrázku ToolStripItem není automaticky upravena tak, aby se vešla na .ToolStrip

SizeToFit 1

Určuje, že velikost obrázku na obrázku ToolStripItem je automaticky upravena tak, aby se vešla na .ToolStrip

Příklady

Následující příklad nastaví ToolStripItem.ImageScaling vlastnost na 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

Poznámky

Vlastnosti Image, ImageAlign, ImageIndexa ImageKeyImageScaling se vztahují k různým aspektům zpracování obrázků. Obrázky můžete použít v ToolStrip ovládacích prvcích nastavením těchto vlastností přímo nebo nastavením vlastnosti jen ImageList za běhu.

Měřítko obrázku je určeno interakcí vlastností v obou ToolStrip a ToolStripItemnásledujícím způsobem:

  • ImageScalingSize je měřítko konečné image určené kombinací nastavení image ImageScaling a nastavení kontejneru AutoSize .

    • Pokud AutoSize je true (výchozí) a ToolStripItemImageScaling je SizeToFit, nedojde k žádnému škálování obrázku a ToolStrip velikost je největší položka nebo předepsané minimální velikosti.

    • Pokud AutoSize je a ToolStripItemImageScalingfalse neníNone, nedojde k obrázku ani ToolStrip ke škálování.

K řízení velikosti obrázku ImageScalingSize použijte vlastnost.

Platí pro