⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fontsingleton.cs

📁 SharpDevelop2.0.0 c#开发免费工具
💻 CS
字号:
//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2032
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------


using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;	
	/// <summary>
	/// This Class caches all the Font's used in SharpReport.
	/// The Hashtable is filled during load of an Report
	/// </summary>
	/// <remarks>
	/// 	created by - Forstmeier Peter
	/// 	created on - 19.04.2005 13:19:28
	/// </remarks>
	
namespace SharpReportCore {	
	public sealed class FontSingleton : AbstractSingleton, System.IDisposable {
		
	//TODO This Class is not in use, should we used togehter with an rewrite of XmlFormreader.cs
		public static readonly FontSingleton Instance = new FontSingleton();
		Hashtable hash;
		
		
		private FontSingleton() {
			hash = new Hashtable();
		}
		public Hashtable Hash {
			get {
				return hash;
			}
			set {
				hash = value;
			}
		}
		
		/// <summary>
		/// Checka if the font is in the Hashtable, if so, retirn it, otherwise create it
		/// and return the newly created
		/// </summary>
		/// <param name="family">Font Family</param>
		/// <param name="size">Size of the Font</param>
		/// <param name="style">The FontSty鰁 like bold etc</param>
		/// <returns></returns>
		public Font GetFont(string family, float size, FontStyle style){
			try {
				string s=family+size.ToString()+((int)style).ToString();
				
				if(hash.Contains(s)){
					return (Font)hash[s];
				}
				Font f=new Font(family,size,style);
				hash.Add(s,f);
				return f;
			} catch (Exception) {
				throw;
			}
		}
		
		
		/// <summary>
		/// Clear the Hashtable from all Fonts
		/// </summary>
		/// <remarks>
		/// Interface method from IDisposable
		/// 
		/// </remarks>
		public  void Dispose() {
			
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -