Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Clipz - A Friendly Introduction to the Windows 7 Taskbar Features

, 17 Dec 2009 CPOL
An overview of the Windows 7 taskbar features, and how to use then in your own applications.
Clipz.zip
Clipz
bin
Debug
Clipz.csproj.user
CopyIcon.ico
DeleteIcon.ico
Model
Native Methods
Properties
Settings.settings
Resources
Audio.png
Clipboard.png
NextIcon.ico
PreviousIcon.ico
Utility
Core
AppRestartRecovery
Dialogs
Common
TaskDialogs
Interop
AppRestartRecovery
Dialogs
NetworkList
PowerManagement
TaskDialogs
NetworkList
PowerManagement
Properties
PropertySystem
SafeHandles
Libraries
StructureMap.dll
Shell
Common
CommonFileDialogs
Controls
Design
ShellObjects.cd
ShellThumbnailClassDiagram.cd
DesktopWindowManager
ExplorerBrowser
ExplorerBrowserDiagram.cd
Interop
Common
Dialogs
ExplorerBrowser
KnownFolders
PropertySystem
StockIcons
Taskbar
KnownFolders
Properties
PropertySystem
StockIcons
Taskbar
//Copyright (c) Microsoft Corporation.  All rights reserved.

namespace Microsoft.WindowsAPICodePack.Dialogs
{
    /// <summary>
    /// Provides a visual representation of the progress of a long running operation.
    /// </summary>
    public class TaskDialogProgressBar : TaskDialogBar
    {
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public TaskDialogProgressBar() 
        {
        }
        /// <summary>
        /// Creates a new instance of this class with the specified name.
        /// And using the default values: Min = 0, Max = 100, Current = 0
        /// </summary>
        /// <param name="name">The name of the control.</param>
        public TaskDialogProgressBar(string name) : base(name) { }
        /// <summary>
        /// Creates a new instance of this class with the specified 
        /// minimum, maximum and current values.
        /// </summary>
        /// <param name="minimum">The minimum value for this control.</param>
        /// <param name="maximum">The maximum value for this control.</param>
        /// <param name="value">The current value for this control.</param>
        public TaskDialogProgressBar(int minimum, int maximum, int value)
        {
            Minimum = minimum;
            Maximum = maximum;
            Value = value;
        }

        private int minimum = TaskDialogDefaults.ProgressBarMinimumValue;
        private int value = TaskDialogDefaults.ProgressBarMinimumValue;
        private int maximum = TaskDialogDefaults.ProgressBarMaximumValue;

        /// <summary>
        /// Gets or sets the minimum value for the control.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames", MessageId = "value",
                        Justification="Value is standard for progressbar's current value property")]
        public int Minimum
        {
            get { return minimum; }
            set 
            {
                CheckPropertyChangeAllowed("Minimum");
                // Check for positive numbers
                if (value < 0)
                    throw new System.ArgumentException("Minimum value provided must be a positive number", "value");
                // Check if min / max differ
                if (value >= Maximum)
                    throw new System.ArgumentException("Minimum value provided must less than the maximum value", "value");
                minimum = value;
                ApplyPropertyChange("Minimum");
            }
        }
        /// <summary>
        /// Gets or sets the maximum value for the control.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames", MessageId = "value",
            Justification="Value is standard for progressbar's current value property")]
        public int Maximum
        {
            get { return maximum; }
            set 
            {
                CheckPropertyChangeAllowed("Maximum");
                // Check if min / max differ
                if (value < Minimum)
                    throw new System.ArgumentException("Maximum value provided must be greater than the minimum value", "value");
                maximum = value;
                ApplyPropertyChange("Maximum");
            }
        }
        /// <summary>
        /// Gets or sets the current value for the control.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames", MessageId = "value",
                        Justification="Value is standard for progressbar's current value property")]
        public int Value
        {
            get { return this.value; }
            set 
            {
                CheckPropertyChangeAllowed("Value");
                // Check for positive numbers
                if (value < Minimum)
                    throw new System.ArgumentException("Value provided must be greater than or equal to minimum value", "value");
                if (value > Maximum)
                    throw new System.ArgumentException("Value provided must be less than or equal to the maximum value", "value");
                this.value = value;
                ApplyPropertyChange("Value");
            }
        }

        internal bool HasValidValues
        {
            get { return (minimum <= value && value <= maximum); }
        }
        /// <summary>
        /// Resets the control to its minimum value.
        /// </summary>
        protected internal override void Reset()
        {
            base.Reset();
            value = minimum;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

TylerBrinks
Web Developer PageLabs
United States United States
I'm the founder of PageLabs, a web-based performance and SEO optimization site.

Give your site a boost in performance, even take a free speed test!
 
http://www.pagelabs.com
Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150129.1 | Last Updated 17 Dec 2009
Article Copyright 2009 by TylerBrinks
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid