Click here to Skip to main content
15,879,474 members
Articles / Desktop Programming / Windows Forms

Clipz - A Friendly Introduction to the Windows 7 Taskbar Features

Rate me:
Please Sign up or sign in to vote.
4.91/5 (57 votes)
17 Dec 2009CPOL9 min read 71.6K   1.6K   123  
An overview of the Windows 7 taskbar features, and how to use then in your own applications.
//Copyright (c) Microsoft Corporation.  All rights reserved.

using Microsoft.WindowsAPICodePack.Dialogs;

namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
{
    /// <summary>
    /// Defines an abstract class that supports shared functionality for the 
    /// common file dialog controls.
    /// </summary>
    public abstract class CommonFileDialogControl : DialogControl
    {
        /// <summary>
        /// Holds the text that is displayed for this control.
        /// </summary>
        private string textValue;
        
        /// <summary>
        /// Gets or sets the text string that is displayed on the control.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1307:SpecifyStringComparison", MessageId = "System.String.Compare(System.String,System.String)", Justification = "We are not currently handling globalization or localization")]
        public virtual string Text
        {
            get { return textValue; }
            set
            {
                // Don't update this property if it hasn't changed
                if (string.Compare(value, textValue) == 0)
                    return;

                textValue = value;
                ApplyPropertyChange("Text");
            }
        }

        private bool enabled = true;
        /// <summary>
        /// Gets or sets a value that determines if this control is enabled.  
        /// </summary>
        public bool Enabled
        {
            get { return enabled; }
            set
            {
                // Don't update this property if it hasn't changed
                if (value == enabled)
                    return;
                
                enabled = value;
                ApplyPropertyChange("Enabled");
            }
        }

        private bool visible = true;
        /// <summary>
        /// Gets or sets a boolean value that indicates whether  
        /// this control is visible.
        /// </summary>
        public bool Visible
        {
            get { return visible; }
            set
            {
                // Don't update this property if it hasn't changed
                if (value == visible)
                    return;

                visible = value;
                ApplyPropertyChange("Visible");
            }
        }

        private bool isAdded = false;
        /// <summary>
        /// Has this control been added to the dialog
        /// </summary>
        internal bool IsAdded
        {
            get { return isAdded; }
            set { isAdded = value; }
        }

        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        protected CommonFileDialogControl() : base()
        {
        }

        /// <summary>
        /// Creates a new instance of this class with the text.
        /// </summary>
        /// <param name="text">The text of the common file dialog control.</param>
        protected CommonFileDialogControl(string text) : base() 
        {
            this.textValue = text;
        }

        /// <summary>
        /// Creates a new instance of this class with the specified name and text.
        /// </summary>
        /// <param name="name">The name of the common file dialog control.</param>
        /// <param name="text">The text of the common file dialog control.</param>
        protected CommonFileDialogControl(string name, string text) : base(name) 
        {
            this.textValue = text;
        }
        
        /// <summary>
        /// Attach the custom control itself to the specified dialog
        /// </summary>
        /// <param name="dialog">the target dialog</param>
        internal abstract void Attach(IFileDialogCustomize dialog);

        internal virtual void SyncUnmanagedProperties()
        {
            ApplyPropertyChange("Enabled");
            ApplyPropertyChange("Visible");
        }
    }
}

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)


Written By
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

Comments and Discussions