ToolStripRenderer ToolStripRenderer ToolStripRenderer ToolStripRenderer Class

定義

處理 ToolStrip 物件的繪製功能。Handles the painting functionality for ToolStrip objects.

public ref class ToolStripRenderer abstract
public abstract class ToolStripRenderer
type ToolStripRenderer = class
Public MustInherit Class ToolStripRenderer
繼承
ToolStripRendererToolStripRendererToolStripRendererToolStripRenderer
衍生

範例

下列程式碼範例示範如何實作自訂 ToolStripRenderer 類別。The following code example demonstrates how to implement a custom ToolStripRenderer class. GridStrip GridStrip ToolStripButton類別會自訂控制面板的三個層面: 框線、框線和ToolStripButton影像。 GridStripRendererThe GridStripRenderer class customizes three aspects of the GridStrip control's appearance: GridStrip border, ToolStripButton border, and ToolStripButton image. 如需完整的程式代碼清單, 請參閱如何:執行自訂 ToolStripRendererFor a full code listing, see How to: Implement a Custom ToolStripRenderer.

// This class implements a custom ToolStripRenderer for the 
// GridStrip control. It customizes three aspects of the 
// GridStrip control's appearance: GridStrip border, 
// ToolStripButton border, and ToolStripButton image.
internal class GridStripRenderer : ToolStripRenderer
{   
    // The style of the empty cell's text.
    private static StringFormat style = new StringFormat();

    // The thickness (width or height) of a 
    // ToolStripButton control's border.
    static int borderThickness = 2;

    // The main bitmap that is the source for the 
    // subimagesthat are assigned to individual 
    // ToolStripButton controls.
    private Bitmap bmp = null;

    // The brush that paints the background of 
    // the GridStrip control.
    private Brush backgroundBrush = null;

    // This is the static constructor. It initializes the
    // StringFormat for drawing the text in the empty cell.
    static GridStripRenderer()
    {
        style.Alignment = StringAlignment.Center;
        style.LineAlignment = StringAlignment.Center;
    }

    // This method initializes the GridStripRenderer by
    // creating the image that is used as the source for
    // the individual button images.
    protected override void Initialize(ToolStrip ts)
    {
        base.Initialize(ts);

        this.InitializeBitmap(ts);
    }

    // This method initializes an individual ToolStripButton
    // control. It copies a subimage from the GridStripRenderer's
    // main image, according to the position and size of 
    // the ToolStripButton.
    protected override void InitializeItem(ToolStripItem item)
    {
        base.InitializeItem(item);

        GridStrip gs = item.Owner as GridStrip;

        // The empty cell does not receive a subimage.
        if ((item is ToolStripButton) &&
            (item != gs.EmptyCell))
        {
            // Copy the subimage from the appropriate 
            // part of the main image.
            Bitmap subImage = bmp.Clone(
                item.Bounds,
                PixelFormat.Undefined);

            // Assign the subimage to the ToolStripButton
            // control's Image property.
            item.Image = subImage;
        }
    }

    // This utility method creates the main image that
    // is the source for the subimages of the individual 
    // ToolStripButton controls.
    private void InitializeBitmap(ToolStrip toolStrip)
    {
        // Create the main bitmap, into which the image is drawn.
        this.bmp = new Bitmap(
            toolStrip.Size.Width,
            toolStrip.Size.Height);

        // Draw a fancy pattern. This could be any image or drawing.
        using (Graphics g = Graphics.FromImage(bmp))
        {
            // Draw smoothed lines.
            g.SmoothingMode = SmoothingMode.AntiAlias;
            
            // Draw the image. In this case, it is 
            // a number of concentric ellipses. 
            for (int i = 0; i < toolStrip.Size.Width; i += 8)
            {
                g.DrawEllipse(Pens.Blue, 0, 0, i, i);
            }
        }
    }

    // This method draws a border around the GridStrip control.
    protected override void OnRenderToolStripBorder(
        ToolStripRenderEventArgs e)
    {
        base.OnRenderToolStripBorder(e);

        ControlPaint.DrawFocusRectangle(
            e.Graphics,
            e.AffectedBounds,
            SystemColors.ControlDarkDark,
            SystemColors.ControlDarkDark);
    }

    // This method renders the GridStrip control's background.
    protected override void OnRenderToolStripBackground(
        ToolStripRenderEventArgs e)
    {
        base.OnRenderToolStripBackground(e);

        // This late initialization is a workaround. The gradient
        // depends on the bounds of the GridStrip control. The bounds 
        // are dependent on the layout engine, which hasn't fully
        // performed layout by the time the Initialize method runs.
        if (this.backgroundBrush == null)
        {
            this.backgroundBrush = new LinearGradientBrush(
               e.ToolStrip.ClientRectangle,
               SystemColors.ControlLightLight,
               SystemColors.ControlDark,
               90,
               true);
        }

        // Paint the GridStrip control's background.
        e.Graphics.FillRectangle(
            this.backgroundBrush, 
            e.AffectedBounds);
    }

    // This method draws a border around the button's image. If the background
    // to be rendered belongs to the empty cell, a string is drawn. Otherwise,
    // a border is drawn at the edges of the button.
    protected override void OnRenderButtonBackground(
        ToolStripItemRenderEventArgs e)
    {
        base.OnRenderButtonBackground(e);

        // Define some local variables for convenience.
        Graphics g = e.Graphics;
        GridStrip gs = e.ToolStrip as GridStrip;
        ToolStripButton gsb = e.Item as ToolStripButton;

        // Calculate the rectangle around which the border is painted.
        Rectangle imageRectangle = new Rectangle(
            borderThickness, 
            borderThickness, 
            e.Item.Width - 2 * borderThickness, 
            e.Item.Height - 2 * borderThickness);

        // If rendering the empty cell background, draw an 
        // explanatory string, centered in the ToolStripButton.
        if (gsb == gs.EmptyCell)
        {
            e.Graphics.DrawString(
                "Drag to here",
                gsb.Font, 
                SystemBrushes.ControlDarkDark,
                imageRectangle, style);
        }
        else
        {
            // If the button can be a drag source, paint its border red.
            // otherwise, paint its border a dark color.
            Brush b = gs.IsValidDragSource(gsb) ? b = 
                Brushes.Red : SystemBrushes.ControlDarkDark;

            // Draw the top segment of the border.
            Rectangle borderSegment = new Rectangle(
                0, 
                0, 
                e.Item.Width, 
                imageRectangle.Top);
            g.FillRectangle(b, borderSegment);

            // Draw the right segment.
            borderSegment = new Rectangle(
                imageRectangle.Right,
                0,
                e.Item.Bounds.Right - imageRectangle.Right,
                imageRectangle.Bottom);
            g.FillRectangle(b, borderSegment);

            // Draw the left segment.
            borderSegment = new Rectangle(
                0,
                0,
                imageRectangle.Left,
                e.Item.Height);
            g.FillRectangle(b, borderSegment);

            // Draw the bottom segment.
            borderSegment = new Rectangle(
                0,
                imageRectangle.Bottom,
                e.Item.Width,
                e.Item.Bounds.Bottom - imageRectangle.Bottom);
            g.FillRectangle(b, borderSegment);
        }
    }
}
' This class implements a custom ToolStripRenderer for the 
' GridStrip control. It customizes three aspects of the 
' GridStrip control's appearance: GridStrip border, 
' ToolStripButton border, and ToolStripButton image.
Friend Class GridStripRenderer
     Inherits ToolStripRenderer

   ' The style of the empty cell's text.
   Private Shared style As New StringFormat()
   
   ' The thickness (width or height) of a 
   ' ToolStripButton control's border.
   Private Shared borderThickness As Integer = 2
   
   ' The main bitmap that is the source for the 
   ' subimagesthat are assigned to individual 
   ' ToolStripButton controls.
   Private bmp As Bitmap = Nothing
   
   ' The brush that paints the background of 
   ' the GridStrip control.
   Private backgroundBrush As Brush = Nothing
   
   
   ' This is the static constructor. It initializes the
   ' StringFormat for drawing the text in the empty cell.
   Shared Sub New()
      style.Alignment = StringAlignment.Center
      style.LineAlignment = StringAlignment.Center
   End Sub 
   
   ' This method initializes the GridStripRenderer by
   ' creating the image that is used as the source for
   ' the individual button images.
   Protected Overrides Sub Initialize(ts As ToolStrip)
      MyBase.Initialize(ts)
      
      Me.InitializeBitmap(ts)
     End Sub

   ' This method initializes an individual ToolStripButton
   ' control. It copies a subimage from the GridStripRenderer's
   ' main image, according to the position and size of 
   ' the ToolStripButton.
   Protected Overrides Sub InitializeItem(item As ToolStripItem)
      MyBase.InitializeItem(item)
      
         Dim gs As GridStrip = item.Owner
      
      ' The empty cell does not receive a subimage.
         If ((TypeOf (item) Is ToolStripButton) And _
              (item IsNot gs.EmptyCell)) Then
             ' Copy the subimage from the appropriate 
             ' part of the main image.
             Dim subImage As Bitmap = bmp.Clone(item.Bounds, PixelFormat.Undefined)

             ' Assign the subimage to the ToolStripButton
             ' control's Image property.
             item.Image = subImage
         End If
   End Sub 

   ' This utility method creates the main image that
   ' is the source for the subimages of the individual 
   ' ToolStripButton controls.
   Private Sub InitializeBitmap(toolStrip As ToolStrip)
      ' Create the main bitmap, into which the image is drawn.
      Me.bmp = New Bitmap(toolStrip.Size.Width, toolStrip.Size.Height)
      
      ' Draw a fancy pattern. This could be any image or drawing.
      Dim g As Graphics = Graphics.FromImage(bmp)
      Try
         ' Draw smoothed lines.
         g.SmoothingMode = SmoothingMode.AntiAlias
         
         ' Draw the image. In this case, it is 
         ' a number of concentric ellipses. 
         Dim i As Integer
         For i = 0 To toolStrip.Size.Width - 8 Step 8
            g.DrawEllipse(Pens.Blue, 0, 0, i, i)
         Next i
      Finally
         g.Dispose()
      End Try
   End Sub 
   
   ' This method draws a border around the GridStrip control.
   Protected Overrides Sub OnRenderToolStripBorder(e As ToolStripRenderEventArgs)
      MyBase.OnRenderToolStripBorder(e)
      
      ControlPaint.DrawFocusRectangle(e.Graphics, e.AffectedBounds, SystemColors.ControlDarkDark, SystemColors.ControlDarkDark)
   End Sub 

   ' This method renders the GridStrip control's background.
   Protected Overrides Sub OnRenderToolStripBackground(e As ToolStripRenderEventArgs)
      MyBase.OnRenderToolStripBackground(e)
      
      ' This late initialization is a workaround. The gradient
      ' depends on the bounds of the GridStrip control. The bounds 
      ' are dependent on the layout engine, which hasn't fully
      ' performed layout by the time the Initialize method runs.
      If Me.backgroundBrush Is Nothing Then
         Me.backgroundBrush = New LinearGradientBrush(e.ToolStrip.ClientRectangle, SystemColors.ControlLightLight, SystemColors.ControlDark, 90, True)
      End If
      
      ' Paint the GridStrip control's background.
      e.Graphics.FillRectangle(Me.backgroundBrush, e.AffectedBounds)
     End Sub

   ' This method draws a border around the button's image. If the background
   ' to be rendered belongs to the empty cell, a string is drawn. Otherwise,
   ' a border is drawn at the edges of the button.
   Protected Overrides Sub OnRenderButtonBackground(e As ToolStripItemRenderEventArgs)
      MyBase.OnRenderButtonBackground(e)
      
      ' Define some local variables for convenience.
      Dim g As Graphics = e.Graphics
      Dim gs As GridStrip = e.ToolStrip 
      Dim gsb As ToolStripButton = e.Item 
      
      ' Calculate the rectangle around which the border is painted.
      Dim imageRectangle As New Rectangle(borderThickness, borderThickness, e.Item.Width - 2 * borderThickness, e.Item.Height - 2 * borderThickness)
      
      ' If rendering the empty cell background, draw an 
      ' explanatory string, centered in the ToolStripButton.
         If gsb Is gs.EmptyCell Then
             e.Graphics.DrawString("Drag to here", gsb.Font, SystemBrushes.ControlDarkDark, imageRectangle, style)
         Else
             ' If the button can be a drag source, paint its border red.
             ' otherwise, paint its border a dark color.
             Dim b As Brush = IIf(gs.IsValidDragSource(gsb), Brushes.Red, SystemBrushes.ControlDarkDark)

             ' Draw the top segment of the border.
             Dim borderSegment As New Rectangle(0, 0, e.Item.Width, imageRectangle.Top)
             g.FillRectangle(b, borderSegment)

             ' Draw the right segment.
             borderSegment = New Rectangle(imageRectangle.Right, 0, e.Item.Bounds.Right - imageRectangle.Right, imageRectangle.Bottom)
             g.FillRectangle(b, borderSegment)

             ' Draw the left segment.
             borderSegment = New Rectangle(0, 0, imageRectangle.Left, e.Item.Height)
             g.FillRectangle(b, borderSegment)

             ' Draw the bottom segment.
             borderSegment = New Rectangle(0, imageRectangle.Bottom, e.Item.Width, e.Item.Bounds.Bottom - imageRectangle.Bottom)
             g.FillRectangle(b, borderSegment)
         End If
     End Sub
 End Class

備註

使用類別, 將特定樣式或主題套用ToolStrip至。 ToolStripRendererUse the ToolStripRenderer class to apply a particular style or theme to a ToolStrip. 您可以將ToolStrip ToolStrip.Renderer屬性設定為繼承ToolStripItem ToolStripRenderer自的物件, 而不是自訂繪製 a 和它所包含的物件。Rather than custom painting a ToolStrip and the ToolStripItem objects it contains, you set the ToolStrip.Renderer property to an object that inherits from ToolStripRenderer. 所指定ToolStripRenderer的繪製會套用ToolStrip至, 以及它所包含的專案。The painting specified by the ToolStripRenderer is applied to the ToolStrip, as well as the items it contains.

您可以透過數種方式ToolStrip在控制項中執行自訂繪製。You can do custom painting in ToolStrip controls in several ways. ToolStrip和其他 Windows Forms 控制項一樣, 和ToolStripItem都具有可覆OnPaint寫的Paint方法和事件。As with other Windows Forms controls, the ToolStrip and ToolStripItem both have overridable OnPaint methods and Paint events. 如同一般繪製, 座標系統是相對於控制項的工作區;也就是說, 控制項的左上角為 0, 0。As with regular painting, the coordinate system is relative to the client area of the control; that is, the upper left-hand corner of the control is 0, 0. 的事件和OnPaint 方法ToolStripItem的行為就像其他控制項繪製事件一樣。 PaintThe Paint event and OnPaint method for a ToolStripItem behave like other control paint events.

類別具有可覆寫的方法, 可用於繪製背景、專案背景、專案影像、專案箭號、專案文字和ToolStrip框線。 ToolStripRendererThe ToolStripRenderer class has overridable methods for painting the background, item background, item image, item arrow, item text, and border of the ToolStrip. 這些方法的事件引數會公開數個屬性, 例如您可以視需要調整的矩形、色彩和文字格式。The event arguments for these methods expose several properties such as rectangles, colors, and text formats that you can adjust as desired.

若只要調整專案繪製方式的幾個層面, 通常會覆寫ToolStripRendererTo adjust just a few aspects of how an item is painted, you typically override the ToolStripRenderer.

如果您要撰寫新的專案, 並且想要控制繪製的所有層面, 請覆OnPaint寫方法。If you are writing a new item and want to control all aspects of the painting, override the OnPaint method. 在中OnPaint, 您可以使用的ToolStripRenderer方法。From within OnPaint, you can use methods from the ToolStripRenderer.

根據預設, ToolStrip會進行雙重緩衝處理, 利用OptimizedDoubleBuffer設定。By default, the ToolStrip is double buffered, taking advantage of the OptimizedDoubleBuffer setting.

建構函式

ToolStripRenderer() ToolStripRenderer() ToolStripRenderer() ToolStripRenderer()

初始化 ToolStripRenderer 類別的新執行個體。Initializes a new instance of the ToolStripRenderer class.

欄位

Offset2X Offset2X Offset2X Offset2X

取得或設定沿著 X 軸位移的兩倍位移乘數。Gets or sets the offset multiplier for twice the offset along the x-axis.

Offset2Y Offset2Y Offset2Y Offset2Y

取得或設定沿著 Y 軸位移的兩倍位移乘數。Gets or sets the offset multiplier for twice the offset along the y axis.

方法

CreateDisabledImage(Image) CreateDisabledImage(Image) CreateDisabledImage(Image) CreateDisabledImage(Image)

建立指定之影像的灰階複本。Creates a gray-scale copy of a given image.

DrawArrow(ToolStripArrowRenderEventArgs) DrawArrow(ToolStripArrowRenderEventArgs) DrawArrow(ToolStripArrowRenderEventArgs) DrawArrow(ToolStripArrowRenderEventArgs)

ToolStripItem 上繪製箭號。Draws an arrow on a ToolStripItem.

DrawButtonBackground(ToolStripItemRenderEventArgs) DrawButtonBackground(ToolStripItemRenderEventArgs) DrawButtonBackground(ToolStripItemRenderEventArgs) DrawButtonBackground(ToolStripItemRenderEventArgs)

繪製 ToolStripButton 的背景。Draws the background for a ToolStripButton.

DrawDropDownButtonBackground(ToolStripItemRenderEventArgs) DrawDropDownButtonBackground(ToolStripItemRenderEventArgs) DrawDropDownButtonBackground(ToolStripItemRenderEventArgs) DrawDropDownButtonBackground(ToolStripItemRenderEventArgs)

繪製 ToolStripDropDownButton 的背景。Draws the background for a ToolStripDropDownButton.

DrawGrip(ToolStripGripRenderEventArgs) DrawGrip(ToolStripGripRenderEventArgs) DrawGrip(ToolStripGripRenderEventArgs) DrawGrip(ToolStripGripRenderEventArgs)

ToolStrip 上繪製移動控制軸。Draws a move handle on a ToolStrip.

DrawImageMargin(ToolStripRenderEventArgs) DrawImageMargin(ToolStripRenderEventArgs) DrawImageMargin(ToolStripRenderEventArgs) DrawImageMargin(ToolStripRenderEventArgs)

ToolStrip 上繪製影像周圍的空間。Draws the space around an image on a ToolStrip.

DrawItemBackground(ToolStripItemRenderEventArgs) DrawItemBackground(ToolStripItemRenderEventArgs) DrawItemBackground(ToolStripItemRenderEventArgs) DrawItemBackground(ToolStripItemRenderEventArgs)

繪製 ToolStripItem 的背景。Draws the background for a ToolStripItem.

DrawItemCheck(ToolStripItemImageRenderEventArgs) DrawItemCheck(ToolStripItemImageRenderEventArgs) DrawItemCheck(ToolStripItemImageRenderEventArgs) DrawItemCheck(ToolStripItemImageRenderEventArgs)

ToolStripItem 上繪製影像,表示項目處於已選取狀態。Draws an image on a ToolStripItem that indicates the item is in a selected state.

DrawItemImage(ToolStripItemImageRenderEventArgs) DrawItemImage(ToolStripItemImageRenderEventArgs) DrawItemImage(ToolStripItemImageRenderEventArgs) DrawItemImage(ToolStripItemImageRenderEventArgs)

ToolStripItem 上繪製影像。Draws an image on a ToolStripItem.

DrawItemText(ToolStripItemTextRenderEventArgs) DrawItemText(ToolStripItemTextRenderEventArgs) DrawItemText(ToolStripItemTextRenderEventArgs) DrawItemText(ToolStripItemTextRenderEventArgs)

ToolStripItem 上繪製文字。Draws text on a ToolStripItem.

DrawLabelBackground(ToolStripItemRenderEventArgs) DrawLabelBackground(ToolStripItemRenderEventArgs) DrawLabelBackground(ToolStripItemRenderEventArgs) DrawLabelBackground(ToolStripItemRenderEventArgs)

繪製 ToolStripLabel 的背景。Draws the background for a ToolStripLabel.

DrawMenuItemBackground(ToolStripItemRenderEventArgs) DrawMenuItemBackground(ToolStripItemRenderEventArgs) DrawMenuItemBackground(ToolStripItemRenderEventArgs) DrawMenuItemBackground(ToolStripItemRenderEventArgs)

繪製 ToolStripMenuItem 的背景。Draws the background for a ToolStripMenuItem.

DrawOverflowButtonBackground(ToolStripItemRenderEventArgs) DrawOverflowButtonBackground(ToolStripItemRenderEventArgs) DrawOverflowButtonBackground(ToolStripItemRenderEventArgs) DrawOverflowButtonBackground(ToolStripItemRenderEventArgs)

繪製溢位按鈕的背景。Draws the background for an overflow button.

DrawSeparator(ToolStripSeparatorRenderEventArgs) DrawSeparator(ToolStripSeparatorRenderEventArgs) DrawSeparator(ToolStripSeparatorRenderEventArgs) DrawSeparator(ToolStripSeparatorRenderEventArgs)

繪製 ToolStripSeparatorDraws a ToolStripSeparator.

DrawSplitButton(ToolStripItemRenderEventArgs) DrawSplitButton(ToolStripItemRenderEventArgs) DrawSplitButton(ToolStripItemRenderEventArgs) DrawSplitButton(ToolStripItemRenderEventArgs)

繪製 ToolStripSplitButtonDraws a ToolStripSplitButton.

DrawStatusStripSizingGrip(ToolStripRenderEventArgs) DrawStatusStripSizingGrip(ToolStripRenderEventArgs) DrawStatusStripSizingGrip(ToolStripRenderEventArgs) DrawStatusStripSizingGrip(ToolStripRenderEventArgs)

繪製可調整大小的底框。Draws a sizing grip.

DrawToolStripBackground(ToolStripRenderEventArgs) DrawToolStripBackground(ToolStripRenderEventArgs) DrawToolStripBackground(ToolStripRenderEventArgs) DrawToolStripBackground(ToolStripRenderEventArgs)

繪製 ToolStrip 的背景。Draws the background for a ToolStrip.

DrawToolStripBorder(ToolStripRenderEventArgs) DrawToolStripBorder(ToolStripRenderEventArgs) DrawToolStripBorder(ToolStripRenderEventArgs) DrawToolStripBorder(ToolStripRenderEventArgs)

繪製 ToolStrip 的框線。Draws the border for a ToolStrip.

DrawToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs) DrawToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs) DrawToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs) DrawToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs)

繪製 ToolStripContentPanel 的背景。Draws the background of the ToolStripContentPanel.

DrawToolStripPanelBackground(ToolStripPanelRenderEventArgs) DrawToolStripPanelBackground(ToolStripPanelRenderEventArgs) DrawToolStripPanelBackground(ToolStripPanelRenderEventArgs) DrawToolStripPanelBackground(ToolStripPanelRenderEventArgs)

繪製 ToolStripPanel 的背景。Draws the background of the ToolStripPanel.

DrawToolStripStatusLabelBackground(ToolStripItemRenderEventArgs) DrawToolStripStatusLabelBackground(ToolStripItemRenderEventArgs) DrawToolStripStatusLabelBackground(ToolStripItemRenderEventArgs) DrawToolStripStatusLabelBackground(ToolStripItemRenderEventArgs)

繪製 ToolStripStatusLabel 的背景。Draws the background of the ToolStripStatusLabel.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
Initialize(ToolStrip) Initialize(ToolStrip) Initialize(ToolStrip) Initialize(ToolStrip)

在衍生類別中覆寫時,提供指定之 ToolStrip 的自訂初始化。When overridden in a derived class, provides for custom initialization of the given ToolStrip.

InitializeContentPanel(ToolStripContentPanel) InitializeContentPanel(ToolStripContentPanel) InitializeContentPanel(ToolStripContentPanel) InitializeContentPanel(ToolStripContentPanel)

初始化指定的 ToolStripContentPanelInitializes the specified ToolStripContentPanel.

InitializeItem(ToolStripItem) InitializeItem(ToolStripItem) InitializeItem(ToolStripItem) InitializeItem(ToolStripItem)

在衍生類別中覆寫時,提供指定之 ToolStripItem 的自訂初始化。When overridden in a derived class, provides for custom initialization of the given ToolStripItem.

InitializePanel(ToolStripPanel) InitializePanel(ToolStripPanel) InitializePanel(ToolStripPanel) InitializePanel(ToolStripPanel)

初始化指定的 ToolStripPanelInitializes the specified ToolStripPanel.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnRenderArrow(ToolStripArrowRenderEventArgs) OnRenderArrow(ToolStripArrowRenderEventArgs) OnRenderArrow(ToolStripArrowRenderEventArgs) OnRenderArrow(ToolStripArrowRenderEventArgs)

引發 RenderArrow 事件。Raises the RenderArrow event.

OnRenderButtonBackground(ToolStripItemRenderEventArgs) OnRenderButtonBackground(ToolStripItemRenderEventArgs) OnRenderButtonBackground(ToolStripItemRenderEventArgs) OnRenderButtonBackground(ToolStripItemRenderEventArgs)

引發 RenderButtonBackground 事件。Raises the RenderButtonBackground event.

OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs) OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs) OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs) OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs)

引發 RenderDropDownButtonBackground 事件。Raises the RenderDropDownButtonBackground event.

OnRenderGrip(ToolStripGripRenderEventArgs) OnRenderGrip(ToolStripGripRenderEventArgs) OnRenderGrip(ToolStripGripRenderEventArgs) OnRenderGrip(ToolStripGripRenderEventArgs)

引發 RenderGrip 事件。Raises the RenderGrip event.

OnRenderImageMargin(ToolStripRenderEventArgs) OnRenderImageMargin(ToolStripRenderEventArgs) OnRenderImageMargin(ToolStripRenderEventArgs) OnRenderImageMargin(ToolStripRenderEventArgs)

繪製項目背景。Draws the item background.

OnRenderItemBackground(ToolStripItemRenderEventArgs) OnRenderItemBackground(ToolStripItemRenderEventArgs) OnRenderItemBackground(ToolStripItemRenderEventArgs) OnRenderItemBackground(ToolStripItemRenderEventArgs)

引發 OnRenderItemBackground(ToolStripItemRenderEventArgs) 事件。Raises the OnRenderItemBackground(ToolStripItemRenderEventArgs) event.

OnRenderItemCheck(ToolStripItemImageRenderEventArgs) OnRenderItemCheck(ToolStripItemImageRenderEventArgs) OnRenderItemCheck(ToolStripItemImageRenderEventArgs) OnRenderItemCheck(ToolStripItemImageRenderEventArgs)

引發 RenderItemCheck 事件。Raises the RenderItemCheck event.

OnRenderItemImage(ToolStripItemImageRenderEventArgs) OnRenderItemImage(ToolStripItemImageRenderEventArgs) OnRenderItemImage(ToolStripItemImageRenderEventArgs) OnRenderItemImage(ToolStripItemImageRenderEventArgs)

引發 RenderItemImage 事件。Raises the RenderItemImage event.

OnRenderItemText(ToolStripItemTextRenderEventArgs) OnRenderItemText(ToolStripItemTextRenderEventArgs) OnRenderItemText(ToolStripItemTextRenderEventArgs) OnRenderItemText(ToolStripItemTextRenderEventArgs)

引發 RenderItemText 事件。Raises the RenderItemText event.

OnRenderLabelBackground(ToolStripItemRenderEventArgs) OnRenderLabelBackground(ToolStripItemRenderEventArgs) OnRenderLabelBackground(ToolStripItemRenderEventArgs) OnRenderLabelBackground(ToolStripItemRenderEventArgs)

引發 RenderLabelBackground 事件。Raises the RenderLabelBackground event.

OnRenderMenuItemBackground(ToolStripItemRenderEventArgs) OnRenderMenuItemBackground(ToolStripItemRenderEventArgs) OnRenderMenuItemBackground(ToolStripItemRenderEventArgs) OnRenderMenuItemBackground(ToolStripItemRenderEventArgs)

引發 RenderMenuItemBackground 事件。Raises the RenderMenuItemBackground event.

OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs) OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs) OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs) OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs)

引發 RenderOverflowButtonBackground 事件。Raises the RenderOverflowButtonBackground event.

OnRenderSeparator(ToolStripSeparatorRenderEventArgs) OnRenderSeparator(ToolStripSeparatorRenderEventArgs) OnRenderSeparator(ToolStripSeparatorRenderEventArgs) OnRenderSeparator(ToolStripSeparatorRenderEventArgs)

引發 RenderSeparator 事件。Raises the RenderSeparator event.

OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs) OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs) OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs) OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs)

引發 OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs) 事件。Raises the OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs) event.

OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs) OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs) OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs) OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs)

引發 RenderStatusStripSizingGrip 事件。Raises the RenderStatusStripSizingGrip event.

OnRenderToolStripBackground(ToolStripRenderEventArgs) OnRenderToolStripBackground(ToolStripRenderEventArgs) OnRenderToolStripBackground(ToolStripRenderEventArgs) OnRenderToolStripBackground(ToolStripRenderEventArgs)

引發 RenderToolStripBackground 事件。Raises the RenderToolStripBackground event.

OnRenderToolStripBorder(ToolStripRenderEventArgs) OnRenderToolStripBorder(ToolStripRenderEventArgs) OnRenderToolStripBorder(ToolStripRenderEventArgs) OnRenderToolStripBorder(ToolStripRenderEventArgs)

引發 RenderToolStripBorder 事件。Raises the RenderToolStripBorder event.

OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs) OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs) OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs) OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs)

引發 RenderToolStripContentPanelBackground 事件。Raises the RenderToolStripContentPanelBackground event.

OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs) OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs) OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs) OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs)

引發 RenderToolStripPanelBackground 事件。Raises the RenderToolStripPanelBackground event.

OnRenderToolStripStatusLabelBackground(ToolStripItemRenderEventArgs) OnRenderToolStripStatusLabelBackground(ToolStripItemRenderEventArgs) OnRenderToolStripStatusLabelBackground(ToolStripItemRenderEventArgs) OnRenderToolStripStatusLabelBackground(ToolStripItemRenderEventArgs)

引發 RenderToolStripStatusLabelBackground 事件。Raises the RenderToolStripStatusLabelBackground event.

ScaleArrowOffsetsIfNeeded() ScaleArrowOffsetsIfNeeded() ScaleArrowOffsetsIfNeeded() ScaleArrowOffsetsIfNeeded()

套用 Offset2XOffset2Y 以縮放箭頭圖示 (若需要根據電腦的 DPI 設定來縮放)。Applies the Offset2X and Offset2Y values to scaling the arrow icon, if scaling is required based on the DPI settings of the computer.

ScaleArrowOffsetsIfNeeded(Int32) ScaleArrowOffsetsIfNeeded(Int32) ScaleArrowOffsetsIfNeeded(Int32) ScaleArrowOffsetsIfNeeded(Int32)

套用 Offset2XOffset2Y 以縮放箭頭圖示 (根據指定的 DPI 值)。Applies the Offset2X and Offset2Y values to scaling the arrow icon based on the specified DPI value.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

事件

RenderArrow RenderArrow RenderArrow RenderArrow

發生於呈現 ToolStripItem 的箭號時。Occurs when an arrow on a ToolStripItem is rendered.

RenderButtonBackground RenderButtonBackground RenderButtonBackground RenderButtonBackground

發生於呈現 ToolStripButton 的背景時。Occurs when the background for a ToolStripButton is rendered

RenderDropDownButtonBackground RenderDropDownButtonBackground RenderDropDownButtonBackground RenderDropDownButtonBackground

發生於呈現 ToolStripDropDownButton 的背景時。Occurs when the background for a ToolStripDropDownButton is rendered.

RenderGrip RenderGrip RenderGrip RenderGrip

發生於呈現 ToolStrip 的移動控制軸時。Occurs when the move handle for a ToolStrip is rendered.

RenderImageMargin RenderImageMargin RenderImageMargin RenderImageMargin

繪製影像與其容器之間的邊界。Draws the margin between an image and its container.

RenderItemBackground RenderItemBackground RenderItemBackground RenderItemBackground

發生於呈現 ToolStripItem 的背景時。Occurs when the background for a ToolStripItem is rendered.

RenderItemCheck RenderItemCheck RenderItemCheck RenderItemCheck

發生於呈現已選取 ToolStripItem 的影像時。Occurs when the image for a selected ToolStripItem is rendered.

RenderItemImage RenderItemImage RenderItemImage RenderItemImage

發生於呈現 ToolStripItem 的影像時。Occurs when the image for a ToolStripItem is rendered.

RenderItemText RenderItemText RenderItemText RenderItemText

發生於呈現 ToolStripItem 的文字時。Occurs when the text for a ToolStripItem is rendered.

RenderLabelBackground RenderLabelBackground RenderLabelBackground RenderLabelBackground

發生於呈現 ToolStripLabel 的背景時。Occurs when the background for a ToolStripLabel is rendered.

RenderMenuItemBackground RenderMenuItemBackground RenderMenuItemBackground RenderMenuItemBackground

發生於呈現 ToolStripMenuItem 的背景時。Occurs when the background for a ToolStripMenuItem is rendered.

RenderOverflowButtonBackground RenderOverflowButtonBackground RenderOverflowButtonBackground RenderOverflowButtonBackground

發生於呈現溢位按鈕的背景時。Occurs when the background for an overflow button is rendered.

RenderSeparator RenderSeparator RenderSeparator RenderSeparator

發生於呈現 ToolStripSeparator 時。Occurs when a ToolStripSeparator is rendered.

RenderSplitButtonBackground RenderSplitButtonBackground RenderSplitButtonBackground RenderSplitButtonBackground

發生於呈現 ToolStripSplitButton 的背景時。Occurs when the background for a ToolStripSplitButton is rendered.

RenderStatusStripSizingGrip RenderStatusStripSizingGrip RenderStatusStripSizingGrip RenderStatusStripSizingGrip

發生於顯示樣式變更時。Occurs when the display style changes.

RenderToolStripBackground RenderToolStripBackground RenderToolStripBackground RenderToolStripBackground

發生於呈現 ToolStrip 的背景時。Occurs when the background for a ToolStrip is rendered.

RenderToolStripBorder RenderToolStripBorder RenderToolStripBorder RenderToolStripBorder

發生於呈現 ToolStrip 的框線時。Occurs when the border for a ToolStrip is rendered.

RenderToolStripContentPanelBackground RenderToolStripContentPanelBackground RenderToolStripContentPanelBackground RenderToolStripContentPanelBackground

繪製 ToolStripContentPanel 的背景。Draws the background of a ToolStripContentPanel.

RenderToolStripPanelBackground RenderToolStripPanelBackground RenderToolStripPanelBackground RenderToolStripPanelBackground

繪製 ToolStripPanel 的背景。Draws the background of a ToolStripPanel.

RenderToolStripStatusLabelBackground RenderToolStripStatusLabelBackground RenderToolStripStatusLabelBackground RenderToolStripStatusLabelBackground

繪製 ToolStripStatusLabel 的背景。Draws the background of a ToolStripStatusLabel.

適用於

另請參閱