TextDecorations.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / TextDecorations.cs / 1305600 / TextDecorations.cs

                            //---------------------------------------------------------------------------- 
//
// 
//    Copyright (C) Microsoft Corporation.  All rights reserved.
//  
//
// 
// Description: TextDecorations class 
//
// History: 
//   11/18/2003 garyyang   Created
//   10/14/2004 garyyang   Refactored: The class becomes static and contains
//                         only well-known text decoration definitions
// 
//---------------------------------------------------------------------------
 
namespace System.Windows 
{
    ///  
    /// TextDecorations class contains a set of commonly used text decorations such as underline,
    /// strikethrough, baseline and over-line.
    /// 
 
    public static class TextDecorations
    { 
 
        static TextDecorations()
        { 
            // Init Underline
            TextDecoration td = new TextDecoration();
            td.Location       = TextDecorationLocation.Underline;
            underline         = new TextDecorationCollection(); 
            underline.Add(td);
            underline.Freeze(); 
 
            // Init strikethrough
            td = new TextDecoration(); 
            td.Location       = TextDecorationLocation.Strikethrough;
            strikethrough     = new TextDecorationCollection();
            strikethrough.Add(td);
            strikethrough.Freeze(); 

            // Init overline 
            td = new TextDecoration(); 
            td.Location       = TextDecorationLocation.OverLine;
            overLine          = new TextDecorationCollection(); 
            overLine.Add(td);
            overLine.Freeze();

            // Init baseline 
            td = new TextDecoration();
            td.Location       = TextDecorationLocation.Baseline; 
            baseline          = new TextDecorationCollection(); 
            baseline.Add(td);
            baseline.Freeze(); 
        }

        //---------------------------------
        // Public properties 
        //---------------------------------
 
        ///  
        /// returns a frozen collection containing an underline
        ///  
        public static TextDecorationCollection Underline
        {
            get
            { 
                return underline;
            } 
        } 

 
        /// 
        /// returns a frozen collection containing a strikethrough
        /// 
        public static TextDecorationCollection Strikethrough 
        {
            get 
            { 
                return strikethrough;
            } 
        }

        /// 
        /// returns a frozen collection containing an overline 
        /// 
        public static TextDecorationCollection OverLine 
        { 
            get
            { 
                return overLine;
            }
        }
 
        /// 
        /// returns a frozen collection containing a baseline 
        ///  
        public static TextDecorationCollection Baseline
        { 
            get
            {
                return baseline;
            } 
        }
 
        //-------------------------------- 
        // Private members
        //-------------------------------- 

        private static readonly TextDecorationCollection underline;
        private static readonly TextDecorationCollection strikethrough;
        private static readonly TextDecorationCollection overLine; 
        private static readonly TextDecorationCollection baseline;
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------------------- 
//
// 
//    Copyright (C) Microsoft Corporation.  All rights reserved.
//  
//
// 
// Description: TextDecorations class 
//
// History: 
//   11/18/2003 garyyang   Created
//   10/14/2004 garyyang   Refactored: The class becomes static and contains
//                         only well-known text decoration definitions
// 
//---------------------------------------------------------------------------
 
namespace System.Windows 
{
    ///  
    /// TextDecorations class contains a set of commonly used text decorations such as underline,
    /// strikethrough, baseline and over-line.
    /// 
 
    public static class TextDecorations
    { 
 
        static TextDecorations()
        { 
            // Init Underline
            TextDecoration td = new TextDecoration();
            td.Location       = TextDecorationLocation.Underline;
            underline         = new TextDecorationCollection(); 
            underline.Add(td);
            underline.Freeze(); 
 
            // Init strikethrough
            td = new TextDecoration(); 
            td.Location       = TextDecorationLocation.Strikethrough;
            strikethrough     = new TextDecorationCollection();
            strikethrough.Add(td);
            strikethrough.Freeze(); 

            // Init overline 
            td = new TextDecoration(); 
            td.Location       = TextDecorationLocation.OverLine;
            overLine          = new TextDecorationCollection(); 
            overLine.Add(td);
            overLine.Freeze();

            // Init baseline 
            td = new TextDecoration();
            td.Location       = TextDecorationLocation.Baseline; 
            baseline          = new TextDecorationCollection(); 
            baseline.Add(td);
            baseline.Freeze(); 
        }

        //---------------------------------
        // Public properties 
        //---------------------------------
 
        ///  
        /// returns a frozen collection containing an underline
        ///  
        public static TextDecorationCollection Underline
        {
            get
            { 
                return underline;
            } 
        } 

 
        /// 
        /// returns a frozen collection containing a strikethrough
        /// 
        public static TextDecorationCollection Strikethrough 
        {
            get 
            { 
                return strikethrough;
            } 
        }

        /// 
        /// returns a frozen collection containing an overline 
        /// 
        public static TextDecorationCollection OverLine 
        { 
            get
            { 
                return overLine;
            }
        }
 
        /// 
        /// returns a frozen collection containing a baseline 
        ///  
        public static TextDecorationCollection Baseline
        { 
            get
            {
                return baseline;
            } 
        }
 
        //-------------------------------- 
        // Private members
        //-------------------------------- 

        private static readonly TextDecorationCollection underline;
        private static readonly TextDecorationCollection strikethrough;
        private static readonly TextDecorationCollection overLine; 
        private static readonly TextDecorationCollection baseline;
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK