Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / ToolStripProgressBar.cs / 1 / ToolStripProgressBar.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms {
using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;
using System.Security;
using System.Security.Permissions;
///
[DefaultProperty("Value")]
public class ToolStripProgressBar : ToolStripControlHost {
internal static readonly object EventRightToLeftLayoutChanged = new object();
///
public ToolStripProgressBar()
: base(CreateControlInstance()) {
}
public ToolStripProgressBar(string name) : this() {
this.Name = name;
}
///
///
/// Create a strongly typed accessor for the class
///
///
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ProgressBar ProgressBar {
get {
return this.Control as ProgressBar;
}
}
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
]
public override Image BackgroundImage {
get {
return base.BackgroundImage;
}
set {
base.BackgroundImage = value;
}
}
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
]
public override ImageLayout BackgroundImageLayout {
get {
return base.BackgroundImageLayout;
}
set {
base.BackgroundImageLayout = value;
}
}
///
///
/// Specify what size you want the item to start out at
///
///
protected override System.Drawing.Size DefaultSize {
get {
return new Size(100,15);
}
}
///
///
/// Specify how far from the edges you want to be
///
///
protected internal override Padding DefaultMargin {
get {
if (this.Owner != null && this.Owner is StatusStrip) {
return new Padding(1, 3, 1, 3);
}
else {
return new Padding(1, 2, 1, 1);
}
}
}
[
DefaultValue(100),
SRCategory(SR.CatBehavior),
SRDescription(SR.ProgressBarMarqueeAnimationSpeed)
]
public int MarqueeAnimationSpeed {
get { return ProgressBar.MarqueeAnimationSpeed; }
set { ProgressBar.MarqueeAnimationSpeed = value; }
}
[
DefaultValue(100),
SRCategory(SR.CatBehavior),
RefreshProperties(RefreshProperties.Repaint),
SRDescription(SR.ProgressBarMaximumDescr)
]
public int Maximum {
get {
return ProgressBar.Maximum;
}
set {
ProgressBar.Maximum = value;
}
}
[
DefaultValue(0),
SRCategory(SR.CatBehavior),
RefreshProperties(RefreshProperties.Repaint),
SRDescription(SR.ProgressBarMinimumDescr)
]
public int Minimum {
get {
return ProgressBar.Minimum;
}
set {
ProgressBar.Minimum = value;
}
}
///
///
/// This is used for international applications where the language
/// is written from RightToLeft. When this property is true,
// and the RightToLeft is true, mirroring will be turned on on the form, and
/// control placement and text will be from right to left.
///
[
SRCategory(SR.CatAppearance),
Localizable(true),
DefaultValue(false),
SRDescription(SR.ControlRightToLeftLayoutDescr)
]
public virtual bool RightToLeftLayout {
get {
return ProgressBar.RightToLeftLayout;
}
set {
ProgressBar.RightToLeftLayout = value;
}
}
///
///
/// Wrap some commonly used properties
///
///
[
DefaultValue(10),
SRCategory(SR.CatBehavior),
SRDescription(SR.ProgressBarStepDescr)
]
public int Step {
get {
return ProgressBar.Step;
}
set {
ProgressBar.Step = value;
}
}
///
///
/// Wrap some commonly used properties
///
///
[
DefaultValue(ProgressBarStyle.Blocks),
SRCategory(SR.CatBehavior),
SRDescription(SR.ProgressBarStyleDescr)
]
public ProgressBarStyle Style {
get {
return ProgressBar.Style;
}
set {
ProgressBar.Style = value;
}
}
///
///
/// Hide the property.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
]
public override string Text
{
get
{
return Control.Text;
}
set
{
Control.Text = value;
}
}
///
///
/// Wrap some commonly used properties
///
///
[
DefaultValue(0),
SRCategory(SR.CatBehavior),
Bindable(true),
SRDescription(SR.ProgressBarValueDescr)
]
public int Value {
get {
return ProgressBar.Value;
}
set {
ProgressBar.Value = value;
}
}
private static Control CreateControlInstance() {
ProgressBar progressBar = new ProgressBar();
progressBar.Size = new Size(100,15);
return progressBar;
}
private void HandleRightToLeftLayoutChanged(object sender, EventArgs e) {
OnRightToLeftLayoutChanged(e);
}
///
protected virtual void OnRightToLeftLayoutChanged(EventArgs e) {
RaiseEvent(EventRightToLeftLayoutChanged, e);
}
///
protected override void OnSubscribeControlEvents(Control control) {
ProgressBar bar = control as ProgressBar;
if (bar != null) {
// Please keep this alphabetized and in [....] with Unsubscribe
//
bar.RightToLeftLayoutChanged += new EventHandler(HandleRightToLeftLayoutChanged);
}
base.OnSubscribeControlEvents(control);
}
///
protected override void OnUnsubscribeControlEvents(Control control) {
ProgressBar bar = control as ProgressBar;
if (bar != null) {
// Please keep this alphabetized and in [....] with Subscribe
//
bar.RightToLeftLayoutChanged -= new EventHandler(HandleRightToLeftLayoutChanged);
}
base.OnUnsubscribeControlEvents(control);
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event KeyEventHandler KeyDown
{
add
{
base.KeyDown += value;
}
remove
{
base.KeyDown -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event KeyPressEventHandler KeyPress
{
add
{
base.KeyPress += value;
}
remove
{
base.KeyPress -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event KeyEventHandler KeyUp
{
add
{
base.KeyUp += value;
}
remove
{
base.KeyUp -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event EventHandler LocationChanged
{
add
{
base.LocationChanged += value;
}
remove
{
base.LocationChanged -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event EventHandler OwnerChanged
{
add
{
base.OwnerChanged += value;
}
remove
{
base.OwnerChanged -= value;
}
}
///
[SRCategory(SR.CatPropertyChanged), SRDescription(SR.ControlOnRightToLeftLayoutChangedDescr)]
public event EventHandler RightToLeftLayoutChanged {
add {
Events.AddHandler(EventRightToLeftLayoutChanged, value);
}
remove {
Events.RemoveHandler(EventRightToLeftLayoutChanged, value);
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event EventHandler TextChanged
{
add
{
base.TextChanged += value;
}
remove
{
base.TextChanged -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event EventHandler Validated
{
add
{
base.Validated += value;
}
remove
{
base.Validated -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event CancelEventHandler Validating
{
add
{
base.Validating += value;
}
remove
{
base.Validating -= value;
}
}
public void Increment(int value) {
ProgressBar.Increment(value);
}
public void PerformStep() {
ProgressBar.PerformStep();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms {
using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;
using System.Security;
using System.Security.Permissions;
///
[DefaultProperty("Value")]
public class ToolStripProgressBar : ToolStripControlHost {
internal static readonly object EventRightToLeftLayoutChanged = new object();
///
public ToolStripProgressBar()
: base(CreateControlInstance()) {
}
public ToolStripProgressBar(string name) : this() {
this.Name = name;
}
///
///
/// Create a strongly typed accessor for the class
///
///
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ProgressBar ProgressBar {
get {
return this.Control as ProgressBar;
}
}
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
]
public override Image BackgroundImage {
get {
return base.BackgroundImage;
}
set {
base.BackgroundImage = value;
}
}
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
]
public override ImageLayout BackgroundImageLayout {
get {
return base.BackgroundImageLayout;
}
set {
base.BackgroundImageLayout = value;
}
}
///
///
/// Specify what size you want the item to start out at
///
///
protected override System.Drawing.Size DefaultSize {
get {
return new Size(100,15);
}
}
///
///
/// Specify how far from the edges you want to be
///
///
protected internal override Padding DefaultMargin {
get {
if (this.Owner != null && this.Owner is StatusStrip) {
return new Padding(1, 3, 1, 3);
}
else {
return new Padding(1, 2, 1, 1);
}
}
}
[
DefaultValue(100),
SRCategory(SR.CatBehavior),
SRDescription(SR.ProgressBarMarqueeAnimationSpeed)
]
public int MarqueeAnimationSpeed {
get { return ProgressBar.MarqueeAnimationSpeed; }
set { ProgressBar.MarqueeAnimationSpeed = value; }
}
[
DefaultValue(100),
SRCategory(SR.CatBehavior),
RefreshProperties(RefreshProperties.Repaint),
SRDescription(SR.ProgressBarMaximumDescr)
]
public int Maximum {
get {
return ProgressBar.Maximum;
}
set {
ProgressBar.Maximum = value;
}
}
[
DefaultValue(0),
SRCategory(SR.CatBehavior),
RefreshProperties(RefreshProperties.Repaint),
SRDescription(SR.ProgressBarMinimumDescr)
]
public int Minimum {
get {
return ProgressBar.Minimum;
}
set {
ProgressBar.Minimum = value;
}
}
///
///
/// This is used for international applications where the language
/// is written from RightToLeft. When this property is true,
// and the RightToLeft is true, mirroring will be turned on on the form, and
/// control placement and text will be from right to left.
///
[
SRCategory(SR.CatAppearance),
Localizable(true),
DefaultValue(false),
SRDescription(SR.ControlRightToLeftLayoutDescr)
]
public virtual bool RightToLeftLayout {
get {
return ProgressBar.RightToLeftLayout;
}
set {
ProgressBar.RightToLeftLayout = value;
}
}
///
///
/// Wrap some commonly used properties
///
///
[
DefaultValue(10),
SRCategory(SR.CatBehavior),
SRDescription(SR.ProgressBarStepDescr)
]
public int Step {
get {
return ProgressBar.Step;
}
set {
ProgressBar.Step = value;
}
}
///
///
/// Wrap some commonly used properties
///
///
[
DefaultValue(ProgressBarStyle.Blocks),
SRCategory(SR.CatBehavior),
SRDescription(SR.ProgressBarStyleDescr)
]
public ProgressBarStyle Style {
get {
return ProgressBar.Style;
}
set {
ProgressBar.Style = value;
}
}
///
///
/// Hide the property.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
]
public override string Text
{
get
{
return Control.Text;
}
set
{
Control.Text = value;
}
}
///
///
/// Wrap some commonly used properties
///
///
[
DefaultValue(0),
SRCategory(SR.CatBehavior),
Bindable(true),
SRDescription(SR.ProgressBarValueDescr)
]
public int Value {
get {
return ProgressBar.Value;
}
set {
ProgressBar.Value = value;
}
}
private static Control CreateControlInstance() {
ProgressBar progressBar = new ProgressBar();
progressBar.Size = new Size(100,15);
return progressBar;
}
private void HandleRightToLeftLayoutChanged(object sender, EventArgs e) {
OnRightToLeftLayoutChanged(e);
}
///
protected virtual void OnRightToLeftLayoutChanged(EventArgs e) {
RaiseEvent(EventRightToLeftLayoutChanged, e);
}
///
protected override void OnSubscribeControlEvents(Control control) {
ProgressBar bar = control as ProgressBar;
if (bar != null) {
// Please keep this alphabetized and in [....] with Unsubscribe
//
bar.RightToLeftLayoutChanged += new EventHandler(HandleRightToLeftLayoutChanged);
}
base.OnSubscribeControlEvents(control);
}
///
protected override void OnUnsubscribeControlEvents(Control control) {
ProgressBar bar = control as ProgressBar;
if (bar != null) {
// Please keep this alphabetized and in [....] with Subscribe
//
bar.RightToLeftLayoutChanged -= new EventHandler(HandleRightToLeftLayoutChanged);
}
base.OnUnsubscribeControlEvents(control);
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event KeyEventHandler KeyDown
{
add
{
base.KeyDown += value;
}
remove
{
base.KeyDown -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event KeyPressEventHandler KeyPress
{
add
{
base.KeyPress += value;
}
remove
{
base.KeyPress -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event KeyEventHandler KeyUp
{
add
{
base.KeyUp += value;
}
remove
{
base.KeyUp -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event EventHandler LocationChanged
{
add
{
base.LocationChanged += value;
}
remove
{
base.LocationChanged -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event EventHandler OwnerChanged
{
add
{
base.OwnerChanged += value;
}
remove
{
base.OwnerChanged -= value;
}
}
///
[SRCategory(SR.CatPropertyChanged), SRDescription(SR.ControlOnRightToLeftLayoutChangedDescr)]
public event EventHandler RightToLeftLayoutChanged {
add {
Events.AddHandler(EventRightToLeftLayoutChanged, value);
}
remove {
Events.RemoveHandler(EventRightToLeftLayoutChanged, value);
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event EventHandler TextChanged
{
add
{
base.TextChanged += value;
}
remove
{
base.TextChanged -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event EventHandler Validated
{
add
{
base.Validated += value;
}
remove
{
base.Validated -= value;
}
}
///
///
/// Hide the event.
///
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
new public event CancelEventHandler Validating
{
add
{
base.Validating += value;
}
remove
{
base.Validating -= value;
}
}
public void Increment(int value) {
ProgressBar.Increment(value);
}
public void PerformStep() {
ProgressBar.PerformStep();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AutoSizeToolBoxItem.cs
- Int16.cs
- AuthenticationSection.cs
- X509Chain.cs
- FreezableCollection.cs
- WinEventWrap.cs
- SqlDataSourceAdvancedOptionsForm.cs
- RemoveFromCollection.cs
- XmlSchemaSimpleTypeList.cs
- XamlStream.cs
- QueryStringHandler.cs
- MDIWindowDialog.cs
- GroupItemAutomationPeer.cs
- InvalidCommandTreeException.cs
- SoapFault.cs
- MsmqNonTransactedPoisonHandler.cs
- RelationshipNavigation.cs
- GenerateDerivedKeyRequest.cs
- TextRangeEditLists.cs
- XmlSchemaImport.cs
- ReadWriteSpinLock.cs
- IndexedString.cs
- Assert.cs
- ListViewCommandEventArgs.cs
- ExpressionParser.cs
- RelationalExpressions.cs
- ManagementOptions.cs
- HostAdapter.cs
- TdsParserHelperClasses.cs
- ResetableIterator.cs
- AttributeInfo.cs
- ResourceBinder.cs
- Expressions.cs
- TextTabProperties.cs
- BaseDataBoundControl.cs
- FlagsAttribute.cs
- DataListItemEventArgs.cs
- OrderedDictionary.cs
- XamlSerializationHelper.cs
- TextRunCache.cs
- ClientConfigurationHost.cs
- DataColumn.cs
- WorkflowTraceTransfer.cs
- CreateDataSourceDialog.cs
- AuthenticationModulesSection.cs
- SqlCommandBuilder.cs
- OleDbConnectionInternal.cs
- CounterSampleCalculator.cs
- PermissionSetTriple.cs
- Int16Storage.cs
- RightsManagementSuppressedStream.cs
- backend.cs
- SymbolTable.cs
- UrlAuthFailedErrorFormatter.cs
- PrinterResolution.cs
- StatusBarDrawItemEvent.cs
- SpeechSynthesizer.cs
- XmlSchemaAny.cs
- AuthenticatingEventArgs.cs
- ConfigXmlReader.cs
- ProfileSettingsCollection.cs
- FontStretch.cs
- DataGridViewCheckBoxColumn.cs
- ViewCellRelation.cs
- EntityException.cs
- UnsafeNativeMethods.cs
- HashCodeCombiner.cs
- ConnectionStringsExpressionBuilder.cs
- RenderingEventArgs.cs
- IteratorFilter.cs
- EditingMode.cs
- KeyValueConfigurationCollection.cs
- Geometry3D.cs
- TargetParameterCountException.cs
- XmlSchemaNotation.cs
- ActiveXContainer.cs
- GB18030Encoding.cs
- FormsAuthentication.cs
- HtmlTernaryTree.cs
- Stylesheet.cs
- FlowDocumentPage.cs
- CounterSampleCalculator.cs
- AccessibilityHelperForXpWin2k3.cs
- AncillaryOps.cs
- GeneralTransformGroup.cs
- FtpCachePolicyElement.cs
- PowerStatus.cs
- DataRowChangeEvent.cs
- ToolboxSnapDragDropEventArgs.cs
- XamlTreeBuilderBamlRecordWriter.cs
- ToolStripDropDownClosedEventArgs.cs
- InputEventArgs.cs
- ToolStripManager.cs
- WorkflowInstanceAbortedRecord.cs
- ScopeElementCollection.cs
- DataBoundControlActionList.cs
- SqlAggregateChecker.cs
- sqlinternaltransaction.cs
- AuthenticateEventArgs.cs
- ListenerAdapterBase.cs