ToolStripItem.ImageScaling 속성

정의

컨테이너에 ToolStripItem 맞게 이미지 크기가 자동으로 조정되는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property System::Windows::Forms::ToolStripItemImageScaling ImageScaling { System::Windows::Forms::ToolStripItemImageScaling get(); void set(System::Windows::Forms::ToolStripItemImageScaling value); };
public System.Windows.Forms.ToolStripItemImageScaling ImageScaling { get; set; }
member this.ImageScaling : System.Windows.Forms.ToolStripItemImageScaling with get, set
Public Property ImageScaling As ToolStripItemImageScaling

속성 값

값 중 ToolStripItemImageScaling 하나입니다. 기본값은 SizeToFit입니다.

예제

다음 코드 예제에서는 설정 하는 Image방법에 설명 합니다 . ImageScalingImageTransparentColorToolStripItem 또한 항목에 대한 사용자 지정 도구 설명을 설정하고 표시하는 방법을 보여 줍니다.

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

설명

Image, ImageAlign, ImageIndex, ImageKey, 및 ImageScaling 속성은 다양한 측면의 이미지 처리와 관련이 있습니다. 이러한 속성을 직접 설정하거나 런타임 전용 ToolStrip 속성을 설정하여 컨트롤에서 이미지를 ImageList 사용합니다.

이미지 크기 조정은 ToolStripToolStripItem의 속성 간 상호 작용에 의해 다음과 같이 결정됩니다.

  • ImageScalingSize 는 이미지의 ImageScaling 설정과 컨테이너의 AutoSize 설정의 조합으로 최종 이미지의 크기를 결정합니다.

    • AutoSize가 true(기본값)이고 ToolStripItemImageScaling이 SizeToFit인 경우에는 이미지 크기 조정이 일어나지 않으며, ToolStrip의 크기는 가장 큰 항목의 크기이거나 사전 지정된 최소 크기가 됩니다.

    • AutoSize가 false이고 ToolStripItemImageScaling이 None인 경우, 이미지 또는 ToolStrip 스케일링이 발생하지 않습니다.

적용 대상