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

WinForm Style Sheet

, 22 Jun 2004
An article on setting styles for Windows applications.
winformstylesheet_src.zip
WinformCSS
MyWinApp
App.ico
bin
Debug
obj
Debug
temp
TempPE
WinCSS
bin
Debug
obj
Debug
temp
TempPE
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Configuration;
namespace WinCSS
{
	/// <summary>
	/// Summary description for Helper.
	/// </summary>
	public class Helper
	{
		public Helper()
		{
			//
			// TODO: Add constructor logic here
			//
		}


		public static FontStyle getFontStyle(string FS)
		{
			FontStyle o = FontStyle.Regular;
			switch(FS)
			{
				case "Bold":
					o = FontStyle.Bold;
					break;
				case "Italic":
					o = FontStyle.Italic;
					break;
				case "Regular":
					o = FontStyle.Regular;
					break;
				case "Strikeout":
					o = FontStyle.Strikeout;
					break;
				case "Underline":
					o = FontStyle.Underline;
					break;
			}
			return o ;
		}

		public static System.Drawing.GraphicsUnit getGraphicUnit(string GU)
		{
			System.Drawing.GraphicsUnit o = System.Drawing.GraphicsUnit.Point;
			switch(GU)
			{
				case "Display":
					o = System.Drawing.GraphicsUnit.Display;
					break;
				case "Document":
					o = System.Drawing.GraphicsUnit.Document;
					break;
				case "Inch":
					o = System.Drawing.GraphicsUnit.Inch;
					break;
				case "Millimeter":
					o = System.Drawing.GraphicsUnit.Millimeter;
					break;
				case "Pixel":
					o = System.Drawing.GraphicsUnit.Pixel;
					break;
				case "Point":
					o = System.Drawing.GraphicsUnit.Point;
					break;
				case "World":
					o = System.Drawing.GraphicsUnit.World;
					break;
			}
			return o ;
		}
	}

}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Ali Zolghadri
Architect
Canada Canada
I worked for the software industry as a software architect, system analyst, senior software engineer and MIS (management information system) consultant for last 10 years.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411019.1 | Last Updated 23 Jun 2004
Article Copyright 2004 by Ali Zolghadri
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid