Επεξεργασία

Κοινή χρήση μέσω


ToolStripProgressBar Class

Definition

Represents a Windows progress bar control contained in a StatusStrip.

public ref class ToolStripProgressBar : System::Windows::Forms::ToolStripControlHost
public class ToolStripProgressBar : System.Windows.Forms.ToolStripControlHost
type ToolStripProgressBar = class
    inherit ToolStripControlHost
Public Class ToolStripProgressBar
Inherits ToolStripControlHost
Inheritance
Inheritance

Examples

The following code example demonstrates a ToolStripProgressBar that calculates a sequence of Fibonacci numbers.

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.ComponentModel;

class FibonacciNumber : Form
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.Run(new FibonacciNumber());
    }

    private StatusStrip progressStatusStrip;
    private ToolStripProgressBar toolStripProgressBar;
    private NumericUpDown requestedCountControl;
    private Button goButton;
    private TextBox outputTextBox;
    private BackgroundWorker backgroundWorker;
    private ToolStripStatusLabel toolStripStatusLabel;
    private int requestedCount;

    public FibonacciNumber()
    {
        Text = "Fibonacci";
        
        // Prepare the StatusStrip.
        progressStatusStrip = new StatusStrip();
        toolStripProgressBar = new ToolStripProgressBar();
        toolStripProgressBar.Enabled = false;
        toolStripStatusLabel = new ToolStripStatusLabel();
        progressStatusStrip.Items.Add(toolStripProgressBar);
        progressStatusStrip.Items.Add(toolStripStatusLabel);

        FlowLayoutPanel flp = new FlowLayoutPanel();
        flp.Dock = DockStyle.Top;

        Label beforeLabel = new Label();
        beforeLabel.Text = "Calculate the first ";
        beforeLabel.AutoSize = true;
        flp.Controls.Add(beforeLabel);
        requestedCountControl = new NumericUpDown();
        requestedCountControl.Maximum = 1000;
        requestedCountControl.Minimum = 1;
        requestedCountControl.Value = 100;
        flp.Controls.Add(requestedCountControl);
        Label afterLabel = new Label();
        afterLabel.Text = "Numbers in the Fibonacci sequence.";
        afterLabel.AutoSize = true;
        flp.Controls.Add(afterLabel);
        
        goButton = new Button();
        goButton.Text = "&Go";
        goButton.Click += new System.EventHandler(button1_Click);
        flp.Controls.Add(goButton);

        outputTextBox = new TextBox();
        outputTextBox.Multiline = true;
        outputTextBox.ReadOnly = true;
        outputTextBox.ScrollBars = ScrollBars.Vertical;
        outputTextBox.Dock = DockStyle.Fill;

        Controls.Add(outputTextBox);
        Controls.Add(progressStatusStrip);
        Controls.Add(flp);

        backgroundWorker = new BackgroundWorker();
        backgroundWorker.WorkerReportsProgress = true;
        backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
        backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
        backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
    }

    private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
    {
        // This method will run on a thread other than the UI thread.
        // Be sure not to manipulate any Windows Forms controls created
        // on the UI thread from this method.
        backgroundWorker.ReportProgress(0, "Working...");
        Decimal lastlast = 0;
        Decimal last = 1;
        Decimal current;
        if (requestedCount >= 1)
        { AppendNumber(0); }
        if (requestedCount >= 2)
        { AppendNumber(1); }
        for (int i = 2; i < requestedCount; ++i)
        {
            // Calculate the number.
            checked { current = lastlast + last; }
            // Introduce some delay to simulate a more complicated calculation.
            System.Threading.Thread.Sleep(100);
            AppendNumber(current);
            backgroundWorker.ReportProgress((100 * i) / requestedCount, "Working...");
            // Get ready for the next iteration.
            lastlast = last;
            last = current;
        }

        backgroundWorker.ReportProgress(100, "Complete!");
    }

    private delegate void AppendNumberDelegate(Decimal number);
    private void AppendNumber(Decimal number)
    {
        if (outputTextBox.InvokeRequired)
        { outputTextBox.Invoke(new AppendNumberDelegate(AppendNumber), number); }
        else
        { outputTextBox.AppendText(number.ToString("N0") + Environment.NewLine); }
    }
    private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
    {
        toolStripProgressBar.Value = e.ProgressPercentage;
        toolStripStatusLabel.Text = e.UserState as String;
    }

    private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {
        if (e.Error is OverflowException)
        { outputTextBox.AppendText(Environment.NewLine + "**OVERFLOW ERROR, number is too large to be represented by the decimal data type**"); }
        toolStripProgressBar.Enabled = false;
        requestedCountControl.Enabled = true;
        goButton.Enabled = true;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        goButton.Enabled = false;
        toolStripProgressBar.Enabled = true;
        requestedCount = (int)requestedCountControl.Value;
        requestedCountControl.Enabled = false;
        outputTextBox.Clear();
        backgroundWorker.RunWorkerAsync();
    }
}
Imports System.Collections.Generic
Imports System.Windows.Forms
Imports System.ComponentModel



Class FibonacciNumber
   Inherits Form
   
   <STAThread()>  _
   Shared Sub Main()
      Application.EnableVisualStyles()
      Application.Run(New FibonacciNumber())
   End Sub    
   Private progressStatusStrip As StatusStrip
   Private toolStripProgressBar As ToolStripProgressBar
   Private requestedCountControl As NumericUpDown
   Private goButton As Button
   Private outputTextBox As TextBox
   Private backgroundWorker As BackgroundWorker
   Private toolStripStatusLabel As ToolStripStatusLabel
   Private requestedCount As Integer
   
   
   Public Sub New()
      [Text] = "Fibonacci"
      
      ' Prepare the StatusStrip.
      progressStatusStrip = New StatusStrip()
      toolStripProgressBar = New ToolStripProgressBar()
      toolStripProgressBar.Enabled = False
      toolStripStatusLabel = New ToolStripStatusLabel()
      progressStatusStrip.Items.Add(toolStripProgressBar)
      progressStatusStrip.Items.Add(toolStripStatusLabel)
      
      Dim flp As New FlowLayoutPanel()
      flp.Dock = DockStyle.Top
      
      Dim beforeLabel As New Label()
      beforeLabel.Text = "Calculate the first "
      beforeLabel.AutoSize = True
      flp.Controls.Add(beforeLabel)
      requestedCountControl = New NumericUpDown()
      requestedCountControl.Maximum = 1000
      requestedCountControl.Minimum = 1
      requestedCountControl.Value = 100
      flp.Controls.Add(requestedCountControl)
      Dim afterLabel As New Label()
      afterLabel.Text = "Numbers in the Fibonacci sequence."
      afterLabel.AutoSize = True
      flp.Controls.Add(afterLabel)
      
      goButton = New Button()
      goButton.Text = "&Go"
      AddHandler goButton.Click, AddressOf button1_Click
      flp.Controls.Add(goButton)
      
      outputTextBox = New TextBox()
      outputTextBox.Multiline = True
      outputTextBox.ReadOnly = True
      outputTextBox.ScrollBars = ScrollBars.Vertical
      outputTextBox.Dock = DockStyle.Fill
      
      Controls.Add(outputTextBox)
      Controls.Add(progressStatusStrip)
      Controls.Add(flp)
      
      backgroundWorker = New BackgroundWorker()
      backgroundWorker.WorkerReportsProgress = True
      AddHandler backgroundWorker.DoWork, AddressOf backgroundWorker1_DoWork
      AddHandler backgroundWorker.RunWorkerCompleted, AddressOf backgroundWorker1_RunWorkerCompleted
      AddHandler backgroundWorker.ProgressChanged, AddressOf backgroundWorker1_ProgressChanged
   End Sub 
    
   
   Private Sub backgroundWorker1_DoWork(sender As Object, e As DoWorkEventArgs)
      ' This method will run on a thread other than the UI thread.
      ' Be sure not to manipulate any Windows Forms controls created
      ' on the UI thread from this method.
      backgroundWorker.ReportProgress(0, "Working...")
      Dim lastlast As [Decimal] = 0
      Dim last As [Decimal] = 1
      Dim current As [Decimal]
      If requestedCount >= 1 Then
         AppendNumber(0)
      End If
      If requestedCount >= 2 Then
         AppendNumber(1)
      End If
      Dim i As Integer
      
      While i < requestedCount
         ' Calculate the number.
         current = lastlast + last
         ' Introduce some delay to simulate a more complicated calculation.
         System.Threading.Thread.Sleep(100)
         AppendNumber(current)
         backgroundWorker.ReportProgress(100 * i / requestedCount, "Working...")
         ' Get ready for the next iteration.
         lastlast = last
         last = current
         i += 1
      End While
      
      
      backgroundWorker.ReportProgress(100, "Complete!")
    End Sub
   
   
   Delegate Sub AppendNumberDelegate(number As [Decimal])
   
   Private Sub AppendNumber(number As [Decimal])
      If outputTextBox.InvokeRequired Then
         outputTextBox.Invoke(New AppendNumberDelegate(AddressOf AppendNumber), number)
      Else
         outputTextBox.AppendText((number.ToString("N0") + Environment.NewLine))
      End If
   End Sub 
   Private Sub backgroundWorker1_ProgressChanged(sender As Object, e As ProgressChangedEventArgs)
      toolStripProgressBar.Value = e.ProgressPercentage
      toolStripStatusLabel.Text = e.UserState '
   End Sub 
   
   
   Private Sub backgroundWorker1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
      If TypeOf e.Error Is OverflowException Then
         outputTextBox.AppendText((Environment.NewLine + "**OVERFLOW ERROR, number is too large to be represented by the decimal data type**"))
      End If
      toolStripProgressBar.Enabled = False
      requestedCountControl.Enabled = True
      goButton.Enabled = True
   End Sub 
    
   
   Private Sub button1_Click(sender As Object, e As EventArgs)
      goButton.Enabled = False
      toolStripProgressBar.Enabled = True
      requestedCount = Fix(requestedCountControl.Value)
      requestedCountControl.Enabled = False
      outputTextBox.Clear()
      backgroundWorker.RunWorkerAsync()
   End Sub 
End Class

Remarks

ToolStripProgressBar is the ProgressBar optimized for hosting in a ToolStrip. A subset of the hosted control's properties and events are exposed at the ToolStripProgressBar level, but the underlying ProgressBar control is fully accessible through the ProgressBar property.

A ToolStripProgressBar control visually indicates the progress of a lengthy operation. The ToolStripProgressBar control displays a bar that fills in from left to right with the system highlight color as an operation progresses.

Note

The ToolStripProgressBar control can only be oriented horizontally.

The ToolStripProgressBar control is typically used when an application performs tasks such as copying files or printing documents. Users of an application might consider an application unresponsive if there is no visual cue. Use the ToolStripProgressBar to notify the user that the application is performing a lengthy task and that the application is still responding.

The Maximum and Minimum properties define the range of values to represent the progress of a task. The Minimum property is typically set to a value of zero, and the Maximum property is typically set to a value indicating the completion of a task. For example, to display the progress properly when copying a group of files, the Maximum property could be set to the total number of files to be copied. The Value property represents the progress that the application has made toward completing the operation. Because the bar displayed in the control is a collection of blocks, the value displayed by the ToolStripProgressBar only approximates the Value property's current value. Based on the size of the ToolStripProgressBar, the Value property determines when to display the next block.

There are a number of ways to modify the value displayed by the ToolStripProgressBar other than changing the Value property directly. You can use the Step property to specify a specific value to increment the Value property by, and then call the PerformStep method to increment the value. To vary the increment value, you can use the Increment method and specify a value by which to increment the Value property.

ToolStripProgressBar replaces the older ProgressBar control, which is nevertheless retained for backward compatibility.

Constructors

ToolStripProgressBar()

Initializes a new instance of the ToolStripProgressBar class.

ToolStripProgressBar(String)

Initializes a new instance of the ToolStripProgressBar class with specified name.

Properties

AccessibilityObject

Gets the AccessibleObject assigned to the control.

(Inherited from ToolStripItem)
AccessibleDefaultActionDescription

Gets or sets the default action description of the control for use by accessibility client applications.

(Inherited from ToolStripItem)
AccessibleDescription

Gets or sets the description that will be reported to accessibility client applications.

(Inherited from ToolStripItem)
AccessibleName

Gets or sets the name of the control for use by accessibility client applications.

(Inherited from ToolStripItem)
AccessibleRole

Gets or sets the accessible role of the control, which specifies the type of user interface element of the control.

(Inherited from ToolStripItem)
Alignment

Gets or sets a value indicating whether the item aligns towards the beginning or end of the ToolStrip.

(Inherited from ToolStripItem)
AllowDrop

Gets or sets a value indicating whether drag-and-drop and item reordering are handled through events that you implement.

(Inherited from ToolStripItem)
Anchor

Gets or sets the edges of the container to which a ToolStripItem is bound and determines how a ToolStripItem is resized with its parent.

(Inherited from ToolStripItem)
AutoSize

Gets or sets a value indicating whether the item is automatically sized.

(Inherited from ToolStripItem)
AutoToolTip

Gets or sets a value indicating whether to use the Text property or the ToolTipText property for the ToolStripItem ToolTip.

(Inherited from ToolStripItem)
Available

Gets or sets a value indicating whether the ToolStripItem should be placed on a ToolStrip.

(Inherited from ToolStripItem)
BackColor

Gets or sets the background color for the control.

(Inherited from ToolStripControlHost)
BackgroundImage

This property is not relevant to this class.

BackgroundImageLayout

This property is not relevant to this class.

BindingContext

Gets or sets the collection of currency managers for the IBindableComponent.

(Inherited from BindableComponent)
Bounds

Gets the size and location of the item.

(Inherited from ToolStripItem)
CanRaiseEvents

Gets a value indicating whether the component can raise an event.

(Inherited from Component)
CanSelect

Gets a value indicating whether the control can be selected.

(Inherited from ToolStripControlHost)
CausesValidation

Gets or sets a value indicating whether the hosted control causes and raises validation events on other controls when the hosted control receives focus.

(Inherited from ToolStripControlHost)
Command

Gets or sets the ICommand whose Execute(Object) method will be called when the ToolStripItem's Click event is invoked.

(Inherited from ToolStripItem)
CommandParameter

Gets or sets the parameter that is passed to the ICommand that's assigned to the Command property.

(Inherited from ToolStripItem)
Container

Gets the IContainer that contains the Component.

(Inherited from Component)
ContentRectangle

Gets the area where content, such as text and icons, can be placed within a ToolStripItem without overwriting background borders.

(Inherited from ToolStripItem)
Control

Gets the Control that this ToolStripControlHost is hosting.

(Inherited from ToolStripControlHost)
ControlAlign

Gets or sets the alignment of the control on the form.

(Inherited from ToolStripControlHost)
DataBindings

Gets the collection of data-binding objects for this IBindableComponent.

(Inherited from BindableComponent)
DefaultAutoToolTip

Gets a value indicating whether to display the ToolTip that is defined as the default.

(Inherited from ToolStripItem)
DefaultDisplayStyle

Gets a value indicating what is displayed on the ToolStripItem.

(Inherited from ToolStripItem)
DefaultMargin

Gets the spacing between the ToolStripProgressBar and adjacent items.

DefaultPadding

Gets the internal spacing characteristics of the item.

(Inherited from ToolStripItem)
DefaultSize

Gets the height and width of the ToolStripProgressBar in pixels.

DesignMode

Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
DismissWhenClicked

Gets a value indicating whether items on a ToolStripDropDown are hidden after they are clicked.

(Inherited from ToolStripItem)
DisplayStyle

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
Dock

Gets or sets which ToolStripItem borders are docked to its parent control and determines how a ToolStripItem is resized with its parent.

(Inherited from ToolStripItem)
DoubleClickEnabled

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
Enabled

Gets or sets a value indicating whether the parent control of the ToolStripItem is enabled.

(Inherited from ToolStripControlHost)
Events

Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
Focused

Gets a value indicating whether the control has input focus.

(Inherited from ToolStripControlHost)
Font

Gets or sets the font to be used on the hosted control.

(Inherited from ToolStripControlHost)
ForeColor

Gets or sets the foreground color of the hosted control.

(Inherited from ToolStripControlHost)
Height

Gets or sets the height, in pixels, of a ToolStripItem.

(Inherited from ToolStripItem)
Image

The image associated with the object.

(Inherited from ToolStripControlHost)
ImageAlign

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
ImageIndex

Gets or sets the index value of the image that is displayed on the item.

(Inherited from ToolStripItem)
ImageKey

Gets or sets the key accessor for the image in the ImageList that is displayed on a ToolStripItem.

(Inherited from ToolStripItem)
ImageScaling

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
ImageTransparentColor

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
IsDisposed

Gets a value indicating whether the object has been disposed of.

(Inherited from ToolStripItem)
IsOnDropDown

Gets a value indicating whether the container of the current Control is a ToolStripDropDown.

(Inherited from ToolStripItem)
IsOnOverflow

Gets a value indicating whether the Placement property is set to Overflow.

(Inherited from ToolStripItem)
Margin

Gets or sets the space between the item and adjacent items.

(Inherited from ToolStripItem)
MarqueeAnimationSpeed

Gets or sets a value representing the delay between each Marquee display update, in milliseconds.

Maximum

Gets or sets the upper bound of the range that is defined for this ToolStripProgressBar.

MergeAction

Gets or sets how child menus are merged with parent menus.

(Inherited from ToolStripItem)
MergeIndex

Gets or sets the position of a merged item within the current ToolStrip.

(Inherited from ToolStripItem)
Minimum

Gets or sets the lower bound of the range that is defined for this ToolStripProgressBar.

Name

Gets or sets the name of the item.

(Inherited from ToolStripItem)
Overflow

Gets or sets whether the item is attached to the ToolStrip or ToolStripOverflowButton or can float between the two.

(Inherited from ToolStripItem)
Owner

Gets or sets the owner of this item.

(Inherited from ToolStripItem)
OwnerItem

Gets the parent ToolStripItem of this ToolStripItem.

(Inherited from ToolStripItem)
Padding

Gets or sets the internal spacing, in pixels, between the item's contents and its edges.

(Inherited from ToolStripItem)
Parent

Gets or sets the parent container of the ToolStripItem.

(Inherited from ToolStripItem)
Placement

Gets the current layout of the item.

(Inherited from ToolStripItem)
Pressed

Gets a value indicating whether the state of the item is pressed.

(Inherited from ToolStripItem)
ProgressBar

Gets the ProgressBar.

Renderer

Returns the parent ToolStrip's renderer.

(Inherited from ToolStripItem)
RightToLeft

Gets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts.

(Inherited from ToolStripControlHost)
RightToLeftAutoMirrorImage

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
RightToLeftLayout

Gets or sets a value indicating whether the ToolStripProgressBar layout is right-to-left or left-to-right when the RightToLeft property is set to Yes.

Selected

Gets a value indicating whether the item is selected.

(Inherited from ToolStripControlHost)
ShowKeyboardCues

Gets a value indicating whether to show or hide shortcut keys.

(Inherited from ToolStripItem)
Site

Gets or sets the site of the hosted control.

(Inherited from ToolStripControlHost)
Size

Gets or sets the size of the ToolStripItem.

(Inherited from ToolStripControlHost)
Step

Gets or sets the amount by which to increment the current value of the ToolStripProgressBar when the PerformStep() method is called.

Style

Gets or sets the style of the ToolStripProgressBar.

Tag

Gets or sets the object that contains data about the item.

(Inherited from ToolStripItem)
Text

Gets or sets the text displayed on the ToolStripProgressBar.

TextAlign

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
TextDirection

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
TextImageRelation

This property is not relevant to this class.

(Inherited from ToolStripControlHost)
ToolTipText

Gets or sets the text that appears as a ToolTip for a control.

(Inherited from ToolStripItem)
Value

Gets or sets the current value of the ToolStripProgressBar.

Visible

Gets or sets a value indicating whether the item is displayed.

(Inherited from ToolStripItem)
Width

Gets or sets the width in pixels of a ToolStripItem.

(Inherited from ToolStripItem)

Methods

CreateAccessibilityInstance()

Creates a new accessibility object for the control.

CreateAccessibilityInstance()

Creates a new accessibility object for the control.

(Inherited from ToolStripControlHost)
CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose()

Releases all resources used by the Component.

(Inherited from Component)
Dispose(Boolean)

Releases the unmanaged resources used by the ToolStripControlHost and optionally releases the managed resources.

(Inherited from ToolStripControlHost)
DoDragDrop(Object, DragDropEffects, Bitmap, Point, Boolean)

Begins a drag operation.

(Inherited from ToolStripItem)
DoDragDrop(Object, DragDropEffects)

Begins a drag-and-drop operation.

(Inherited from ToolStripItem)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Focus()

Gives the focus to a control.

(Inherited from ToolStripControlHost)
GetCurrentParent()

Retrieves the ToolStrip that is the container of the current ToolStripItem.

(Inherited from ToolStripItem)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService()
Obsolete.

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetPreferredSize(Size)

Retrieves the size of a rectangular area into which a control can be fitted.

(Inherited from ToolStripControlHost)
GetService(Type)

Returns an object that represents a service provided by the Component or by its Container.

(Inherited from Component)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
Increment(Int32)

Advances the current position of the progress bar by the specified amount.

InitializeLifetimeService()
Obsolete.

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
Invalidate()

Invalidates the entire surface of the ToolStripItem and causes it to be redrawn.

(Inherited from ToolStripItem)
Invalidate(Rectangle)

Invalidates the specified region of the ToolStripItem by adding it to the update region of the ToolStripItem, which is the area that will be repainted at the next paint operation, and causes a paint message to be sent to the ToolStripItem.

(Inherited from ToolStripItem)
IsInputChar(Char)

Determines whether a character is an input character that the item recognizes.

(Inherited from ToolStripItem)
IsInputKey(Keys)

Determines whether the specified key is a regular input key or a special key that requires preprocessing.

(Inherited from ToolStripItem)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
OnAvailableChanged(EventArgs)

Raises the AvailableChanged event.

(Inherited from ToolStripItem)
OnBackColorChanged(EventArgs)

Raises the BackColorChanged event.

(Inherited from ToolStripItem)
OnBindingContextChanged(EventArgs)

Raises the BindingContextChanged event.

(Inherited from BindableComponent)
OnBoundsChanged()

Occurs when the Bounds property changes.

(Inherited from ToolStripControlHost)
OnClick(EventArgs)

Raises the Click event.

(Inherited from ToolStripItem)
OnCommandCanExecuteChanged(EventArgs)

Raises the CommandCanExecuteChanged event.

(Inherited from ToolStripItem)
OnCommandChanged(EventArgs)

Raises the CommandChanged event.

(Inherited from ToolStripItem)
OnCommandParameterChanged(EventArgs)

Raises the CommandParameterChanged event.

(Inherited from ToolStripItem)
OnDisplayStyleChanged(EventArgs)

Raises the DisplayStyleChanged event.

(Inherited from ToolStripItem)
OnDoubleClick(EventArgs)

Raises the DoubleClick event.

(Inherited from ToolStripItem)
OnDragDrop(DragEventArgs)

Raises the DragDrop event.

(Inherited from ToolStripItem)
OnDragEnter(DragEventArgs)

Raises the DragEnter event.

(Inherited from ToolStripItem)
OnDragLeave(EventArgs)

Raises the DragLeave event.

(Inherited from ToolStripItem)
OnDragOver(DragEventArgs)

Raises the DragOver event.

(Inherited from ToolStripItem)
OnEnabledChanged(EventArgs)

Raises the EnabledChanged event.

(Inherited from ToolStripItem)
OnEnter(EventArgs)

Raises the Enter event.

(Inherited from ToolStripControlHost)
OnFontChanged(EventArgs)

Raises the FontChanged event.

(Inherited from ToolStripItem)
OnForeColorChanged(EventArgs)

Raises the ForeColorChanged event.

(Inherited from ToolStripItem)
OnGiveFeedback(GiveFeedbackEventArgs)

Raises the GiveFeedback event.

(Inherited from ToolStripItem)
OnGotFocus(EventArgs)

Raises the GotFocus event.

(Inherited from ToolStripControlHost)
OnHostedControlResize(EventArgs)

Synchronizes the resizing of the control host with the resizing of the hosted control.

(Inherited from ToolStripControlHost)
OnKeyDown(KeyEventArgs)

Raises the KeyDown event.

(Inherited from ToolStripControlHost)
OnKeyPress(KeyPressEventArgs)

Raises the KeyPress event.

(Inherited from ToolStripControlHost)
OnKeyUp(KeyEventArgs)

Raises the KeyUp event.

(Inherited from ToolStripControlHost)
OnLayout(LayoutEventArgs)

Raises the Layout event.

(Inherited from ToolStripControlHost)
OnLeave(EventArgs)

Raises the Leave event.

(Inherited from ToolStripControlHost)
OnLocationChanged(EventArgs)

Raises the LocationChanged event.

(Inherited from ToolStripItem)
OnLostFocus(EventArgs)

Raises the LostFocus event.

(Inherited from ToolStripControlHost)
OnMouseDown(MouseEventArgs)

Raises the MouseDown event.

(Inherited from ToolStripItem)
OnMouseEnter(EventArgs)

Raises the MouseEnter event.

(Inherited from ToolStripItem)
OnMouseHover(EventArgs)

Raises the MouseHover event.

(Inherited from ToolStripItem)
OnMouseLeave(EventArgs)

Raises the MouseLeave event.

(Inherited from ToolStripItem)
OnMouseMove(MouseEventArgs)

Raises the MouseMove event.

(Inherited from ToolStripItem)
OnMouseUp(MouseEventArgs)

Raises the MouseUp event.

(Inherited from ToolStripItem)
OnOwnerChanged(EventArgs)

Raises the OwnerChanged event.

(Inherited from ToolStripItem)
OnOwnerFontChanged(EventArgs)

Raises the FontChanged event when the Font property has changed on the parent of the ToolStripItem.

(Inherited from ToolStripItem)
OnPaint(PaintEventArgs)

Raises the Paint event.

(Inherited from ToolStripControlHost)
OnParentBackColorChanged(EventArgs)

Raises the BackColorChanged event.

(Inherited from ToolStripItem)
OnParentChanged(ToolStrip, ToolStrip)

Raises the ParentChanged event.

(Inherited from ToolStripControlHost)
OnParentEnabledChanged(EventArgs)

Raises the EnabledChanged event when the Enabled property value of the item's container changes.

(Inherited from ToolStripItem)
OnParentForeColorChanged(EventArgs)

Raises the ForeColorChanged event.

(Inherited from ToolStripItem)
OnParentRightToLeftChanged(EventArgs)

Raises the RightToLeftChanged event.

(Inherited from ToolStripItem)
OnQueryContinueDrag(QueryContinueDragEventArgs)

Raises the QueryContinueDrag event.

(Inherited from ToolStripItem)
OnRequestCommandExecute(EventArgs)

Called in the context of OnClick(EventArgs) to invoke Execute(Object) if the context allows.

(Inherited from ToolStripItem)
OnRightToLeftChanged(EventArgs)

Raises the RightToLeftChanged event.

(Inherited from ToolStripItem)
OnRightToLeftLayoutChanged(EventArgs)

Raises the RightToLeftLayoutChanged event.

OnSelectedChanged(EventArgs)

Raises the SelectedChanged event.

(Inherited from ToolStripItem)
OnSubscribeControlEvents(Control)

Subscribes events from the hosted control.

OnTextChanged(EventArgs)

Raises the TextChanged event.

(Inherited from ToolStripItem)
OnUnsubscribeControlEvents(Control)

Unsubscribes events from the hosted control.

OnValidated(EventArgs)

Raises the Validated event.

(Inherited from ToolStripControlHost)
OnValidating(CancelEventArgs)

Raises the Validating event.

(Inherited from ToolStripControlHost)
OnVisibleChanged(EventArgs)

Raises the VisibleChanged event.

(Inherited from ToolStripItem)
PerformClick()

Generates a Click event for a ToolStripItem.

(Inherited from ToolStripItem)
PerformStep()

Advances the current position of the progress bar by the amount of the Step property.

ProcessCmdKey(Message, Keys)

Processes a command key.

(Inherited from ToolStripControlHost)
ProcessDialogKey(Keys)

Processes a dialog key.

(Inherited from ToolStripControlHost)
ProcessMnemonic(Char)

Processes a mnemonic character.

(Inherited from ToolStripControlHost)
ResetBackColor()

This method is not relevant to this class.

(Inherited from ToolStripControlHost)
ResetDisplayStyle()

This method is not relevant to this class.

(Inherited from ToolStripItem)
ResetFont()

This method is not relevant to this class.

(Inherited from ToolStripItem)
ResetForeColor()

This method is not relevant to this class.

(Inherited from ToolStripControlHost)
ResetImage()

This method is not relevant to this class.

(Inherited from ToolStripItem)
ResetMargin()

This method is not relevant to this class.

(Inherited from ToolStripItem)
ResetPadding()

This method is not relevant to this class.

(Inherited from ToolStripItem)
ResetRightToLeft()

This method is not relevant to this class.

(Inherited from ToolStripItem)
ResetTextDirection()

This method is not relevant to this class.

(Inherited from ToolStripItem)
Select()

Selects the item.

(Inherited from ToolStripItem)
SetBounds(Rectangle)

Sets the size and location of the item.

(Inherited from ToolStripItem)
SetVisibleCore(Boolean)

Sets the ToolStripItem to the specified visible state.

(Inherited from ToolStripControlHost)
ToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.

(Inherited from ToolStripItem)

Events

AvailableChanged

Occurs when the value of the Available property changes.

(Inherited from ToolStripItem)
BackColorChanged

Occurs when the value of the BackColor property changes.

(Inherited from ToolStripItem)
BindingContextChanged

Occurs when the binding context has changed.

(Inherited from BindableComponent)
Click

Occurs when the ToolStripItem is clicked.

(Inherited from ToolStripItem)
CommandCanExecuteChanged

Occurs when the CanExecute(Object) status of the ICommand that's assigned to the Command property has changed.

(Inherited from ToolStripItem)
CommandChanged

Occurs when the assigned ICommand of the Command property has changed.

(Inherited from ToolStripItem)
CommandParameterChanged

Occurs when the value of the CommandParameter property has changed.

(Inherited from ToolStripItem)
DisplayStyleChanged

This event is not relevant to this class.

(Inherited from ToolStripControlHost)
Disposed

Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)
DoubleClick

Occurs when the item is double-clicked with the mouse.

(Inherited from ToolStripItem)
DragDrop

Occurs when the user drags an item and the user releases the mouse button, indicating that the item should be dropped into this item.

(Inherited from ToolStripItem)
DragEnter

Occurs when the user drags an item into the client area of this item.

(Inherited from ToolStripItem)
DragLeave

Occurs when the user drags an item and the mouse pointer is no longer over the client area of this item.

(Inherited from ToolStripItem)
DragOver

Occurs when the user drags an item over the client area of this item.

(Inherited from ToolStripItem)
EnabledChanged

Occurs when the Enabled property value has changed.

(Inherited from ToolStripItem)
Enter

Occurs when the hosted control is entered.

(Inherited from ToolStripControlHost)
ForeColorChanged

Occurs when the ForeColor property value changes.

(Inherited from ToolStripItem)
GiveFeedback

Occurs during a drag operation.

(Inherited from ToolStripItem)
GotFocus

Occurs when the hosted control receives focus.

(Inherited from ToolStripControlHost)
KeyDown

This event is not relevant for this class.

KeyPress

This event is not relevant for this class.

KeyUp

This event is not relevant for this class.

Leave

Occurs when the input focus leaves the hosted control.

(Inherited from ToolStripControlHost)
LocationChanged

This event is not relevant for this class.

LostFocus

Occurs when the hosted control loses focus.

(Inherited from ToolStripControlHost)
MouseDown

Occurs when the mouse pointer is over the item and a mouse button is pressed.

(Inherited from ToolStripItem)
MouseEnter

Occurs when the mouse pointer enters the item.

(Inherited from ToolStripItem)
MouseHover

Occurs when the mouse pointer hovers over the item.

(Inherited from ToolStripItem)
MouseLeave

Occurs when the mouse pointer leaves the item.

(Inherited from ToolStripItem)
MouseMove

Occurs when the mouse pointer is moved over the item.

(Inherited from ToolStripItem)
MouseUp

Occurs when the mouse pointer is over the item and a mouse button is released.

(Inherited from ToolStripItem)
OwnerChanged

This event is not relevant for this class.

Paint

Occurs when the item is redrawn.

(Inherited from ToolStripItem)
QueryAccessibilityHelp

Occurs when an accessibility client application invokes help for the ToolStripItem.

(Inherited from ToolStripItem)
QueryContinueDrag

Occurs during a drag-and-drop operation and allows the drag source to determine whether the drag-and-drop operation should be canceled.

(Inherited from ToolStripItem)
RightToLeftChanged

Occurs when the RightToLeft property value changes.

(Inherited from ToolStripItem)
RightToLeftLayoutChanged

Occurs when the value of the RightToLeftLayout property changes.

SelectedChanged

Occurs when the value of the Selected property changes.

(Inherited from ToolStripItem)
TextChanged

This event is not relevant for this class.

Validated

This event is not relevant to this class.

Validating

This event is not relevant to this class.

VisibleChanged

Occurs when the value of the Visible property changes.

(Inherited from ToolStripItem)

Explicit Interface Implementations

IDropTarget.OnDragDrop(DragEventArgs)

Raises the DragDrop event.

(Inherited from ToolStripItem)
IDropTarget.OnDragEnter(DragEventArgs)

Raises the DragEnter event.

(Inherited from ToolStripItem)
IDropTarget.OnDragLeave(EventArgs)

Raises the DragLeave event.

(Inherited from ToolStripItem)
IDropTarget.OnDragOver(DragEventArgs)

Raises the DragOver event.

(Inherited from ToolStripItem)

Applies to

See also