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

📄 basetoday.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.Globalization;
	/// <summary>
	/// BaseClass for Today's Date
	/// </summary>
	/// <remarks>
	/// 	created by - Forstmeier Peter
	/// 	created on - 12.09.2005 22:48:04
	/// </remarks>
	
namespace SharpReportCore {
	public class BaseToday : BaseFunction {
		static string fnName = "SharpReport.Toolbar.Functions.TodaysDate";
		
		public BaseToday():base(fnName) {
			
		}
		
		public override void Render(ReportPageEventArgs rpea) {
			base.Render(rpea);
		
			string formattedString = FormatAsDate(System.DateTime.Now.ToString(),base.FormatString);
			
			RectangleF rect = base.PrepareRectangle (rpea,formattedString);

			//Printout the textPart
			base.PrintTheStuff (rpea,this.Text,rect);

			//here we print the functionpart allway's with Stringalignment.Far
			StringFormat fmt = StringFormat;
			fmt.Alignment = StringAlignment.Far;
			fmt.LineAlignment = StringAlignment.Near;
			
			rpea.PrintPageEventArgs.Graphics.DrawString(formattedString,
			                                         this.Font,
			                                         Brushes.Black,
			                                         rect,
			                                         fmt);
			
			// goon 
			base.NotiyfyAfterPrint (rpea.LocationAfterDraw);
		}
		
		public override string ToString() {
			return "BaseToday";
		}
			
			
		#region privates
		private string FormatAsDate (string toFormat,string formatWith) {
			if (toFormat.Length == 0) {
				return String.Empty;
			}
			if (formatWith.Length == 0) {
				return toFormat;
			}
			try {
				DateTime date = DateTime.Parse (toFormat.Trim(),
				                                CultureInfo.CurrentCulture.DateTimeFormat);
				string str = date.ToString(formatWith,
				                           DateTimeFormatInfo.CurrentInfo);
			    return str;
			} catch (Exception) {
				throw;
			}
			
		}
		#endregion
	}
}

⌨️ 快捷键说明

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