Click here to Skip to main content
15,886,024 members
Articles / Desktop Programming / Windows Forms

Winforms SkinFramework

Rate me:
Please Sign up or sign in to vote.
4.95/5 (54 votes)
18 Sep 2013LGPL38 min read 234K   14.8K   241  
Give your WinForms Windows a unique look using a unique design
// This file is part of CoderLine SkinFramework.
//
// CoderLine SkinFramework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// CoderLine SkinFramework is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with CoderLine SkinFramework.  If not, see <http://www.gnu.org/licenses/>.
//
// (C) 2010 Daniel Kuschny, (http://www.coderline.net)
using System.Drawing;
using System.Windows.Forms;
using SkinFramework.Painting;

namespace SkinFramework
{
    /// <summary>
    /// Specifies all available default skins.
    /// </summary>
    public enum DefaultSkin
    {
        Office2007Luna,
        Office2007Obsidian,
        Office2007Silver,
    }

    /// <summary>
    /// This is the base class for skins. 
    /// </summary>
    public abstract class SkinBase
    {
        #region General

        /// <summary>
        /// Called when the skin is loaded.
        /// </summary>
        public virtual void OnLoad()
        {
            // Optional Override
        } 

        #endregion

        #region Window Skinning

        /// <summary>
        /// Called when the form region needs to be set.
        /// </summary>
        /// <param name="form">The form whose region need to be set.</param>
        /// <param name="size">The size of the form which should be used for region calculation.</param>
        public abstract void OnSetRegion(Form form, Size size);

        /// <summary>
        /// Called when the non client area of the form needs to be painted.
        /// </summary>
        /// <param name="form">The form which gets drawn.</param>
        /// <param name="paintData">The paint data to use for drawing.</param>
        /// <returns><code>true</code> if the original painting should be suppressed, otherwise <code>false</code></returns>
        public abstract bool OnNcPaint(Form form, SkinningFormPaintData paintData);

        #endregion
    }
}

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 GNU Lesser General Public License (LGPLv3)


Written By
Austria Austria
I'm Daniel from Austria.
I started Webdeveloping in 2001 with HTML/JS. 2004 I also started to develop PHP. Nowadays I'm into developing Web-Applications in PHP and Java(2007), GUI Controls in C#(since 2006).

Comments and Discussions