|
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 UserControl1.
/// </summary>
public class ErrorLabel : System.Windows.Forms.Label
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public ErrorLabel()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitComponent call
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// ErrorLabel
//
this.AutoSize = true;
this.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.ForeColor = System.Drawing.Color.Black;
this.Size = new System.Drawing.Size(0, 19);
}
#endregion
public override Font Font
{
get
{
//return new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
return getFont();
}
}
public override Color ForeColor
{
get
{
//return System.Drawing.Color.Red;
return getForeColor();
}
}
public Font getFont()
{
string N = ConfigurationSettings.AppSettings["ErrorLabelFontName"];
string S = ConfigurationSettings.AppSettings["ErrorLabelFontSize"];
string FS = ConfigurationSettings.AppSettings["ErrorLabelFontStyle"];
string GU = ConfigurationSettings.AppSettings["ErrorLabelFontGraphicUnit"];
string GRI = ConfigurationSettings.AppSettings["ErrorLabelFontGRI"];
N = (N==null)?"Verdana":N;
S = (S==null)?"10":S;
FS = (FS==null)?"Bold":FS;
GU = (GU==null)?"Point":GU;
GRI = (GRI==null)?"0":GRI;
return new System.Drawing.Font(N,(float)(Convert.ToDouble(S)),Helper.getFontStyle(FS),Helper.getGraphicUnit(GU),Convert.ToByte(GRI));
}
public Color getForeColor()
{
string r = ConfigurationSettings.AppSettings["ErrorLabelForeColorR"];
string g = ConfigurationSettings.AppSettings["ErrorLabelForeColorG"];
string b = ConfigurationSettings.AppSettings["ErrorLabelForeColorB"];
r = (r==null)?"255":r;
g = (g==null)?"0":g;
b = (b==null)?"0":b;
return System.Drawing.Color.FromArgb(Convert.ToByte(r),Convert.ToByte(g),Convert.ToByte(b));
}
}
}
|
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.
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.