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

📄 datepickerdesigner.cs

📁 用C#编写的一个新的日期显示器
💻 CS
字号:
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.WebControls;

namespace Sorke.Web.UI.WebControls
{
	public class DatePickerDesigner : ControlDesigner
	{

		public override string GetDesignTimeHtml()
		{
			DatePicker datepicker = (DatePicker)base.Component;
			datepicker.Style.Add("position", "statis");
			Table table = new Table();
			table.BorderWidth = Unit.Pixel(0);
			table.CellPadding = 0;
			table.CellSpacing = 0;
			table.Width = datepicker.Width;
			table.Height = datepicker.Height;
			TableRow tableRow = new TableRow();
			TableCell tableCell1 = new TableCell();
			tableCell1.HorizontalAlign = HorizontalAlign.Center;
			tableCell1.VerticalAlign = VerticalAlign.Middle;
			TableCell tableCell2 = new TableCell();
			tableCell2.Width = Unit.Pixel(1);
			tableCell2.HorizontalAlign = HorizontalAlign.Center;
			tableCell2.VerticalAlign = VerticalAlign.Middle;
			TextBox textBox = new TextBox();
			textBox.ID = datepicker.ID;
			textBox.CssClass = datepicker.CssClass;
			textBox.Enabled = datepicker.Enabled;
			textBox.ToolTip = datepicker.ToolTip;
			textBox.Width = Unit.Percentage(100.0);
			textBox.Height = Unit.Percentage(100.0);
			textBox.Text = datepicker.Text;
			textBox.Attributes.Add("defaultValue", datepicker.Text);
			if (datepicker.ReadOnly)
			{
				textBox.ReadOnly = base.ReadOnly;
			}
			
			textBox.Style.Add("cursor", "hand");
			tableCell1.Controls.Add(textBox);
			Image image = new Image();
			/*if (datepicker.ImageUrl == "")
			{
				image.ImageUrl = "DatePicker.gif";
			}
			else
			{*/
				image.ImageUrl = datepicker.ImageUrl;
			//}
			image.BorderWidth = Unit.Pixel(0);
			image.Style.Add("cursor", "hand");
			tableCell2.Controls.Add(image);
			tableRow.Controls.Add(tableCell1);
			tableRow.Controls.Add(tableCell2);
			table.Controls.Add(tableRow);
			StringWriter stringWriter = new StringWriter();
			HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
			table.RenderControl(htmlTextWriter);
			return stringWriter.ToString();
		}
	}

}

⌨️ 快捷键说明

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