本文整理汇总了C#中System.Web.UI.WebControls.Unit类的典型用法代码示例。如果您正苦于以下问题:C# Unit类的具体用法?C# Unit怎么用?C# Unit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Unit类属于System.Web.UI.WebControls命名空间,在下文中一共展示了Unit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintWebControl
public static void PrintWebControl(Control ControlToPrint, Control MyStyle)
{
StringWriter stringWrite = new StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
if (ControlToPrint is WebControl)
{
Unit w = new Unit(100, UnitType.Percentage);
((WebControl)ControlToPrint).Width = w;
}
System.Web.UI.Page pg = new System.Web.UI.Page();
pg.EnableEventValidation = false;
HtmlForm frm = new HtmlForm();
frm.Controls.Add(MyStyle);
pg.Controls.Add(frm);
frm.Attributes.Add("runat", "server");
frm.Controls.Add(ControlToPrint);
pg.DesignerInitialize();
pg.RenderControl(htmlWrite);
string strHTML = stringWrite.ToString();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write(strHTML);
HttpContext.Current.Response.Write("<script>window.print();</script>");
HttpContext.Current.Response.End();
}
示例2: BackgroundPosition
public BackgroundPosition(string value, CultureInfo culture)
{
this._type = BackgroundPositionType.NotSet;
this._value = System.Web.UI.WebControls.Unit.Empty;
if ((value != null) && (value.Length != 0))
{
string str = value.ToLower();
if ((str.Equals("top") || str.Equals("left")) || str.Equals("toporleft"))
{
this._type = BackgroundPositionType.TopOrLeft;
}
else if (str.Equals("center"))
{
this._type = BackgroundPositionType.Center;
}
else if ((str.Equals("bottom") || str.Equals("right")) || str.Equals("bottomorright"))
{
this._type = BackgroundPositionType.BottomOrRight;
}
else
{
this._value = System.Web.UI.WebControls.Unit.Parse(value, culture);
this._type = BackgroundPositionType.Unit;
}
}
}
示例3: PrintWebControl
public void PrintWebControl(Control ControlToPrint)
{
StringWriter stringWrite = new StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
if (ControlToPrint is WebControl)
{
Unit w = new Unit(100, UnitType.Percentage);
((WebControl)ControlToPrint).Width = w;
}
Page pg = new Page();
pg.EnableEventValidation = false;
HtmlForm frm = new HtmlForm();
pg.Controls.Add(frm);
frm.Attributes.Add("runat", "server");
frm.Controls.Add(ControlToPrint);
pg.DesignerInitialize();
pg.RenderControl(htmlWrite);
string strHTML = stringWrite.ToString();
string wstawka = Server.MapPath("~").ToString();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write(htmlToImage(strHTML, zmianaAdresu(wstawka)));
HttpContext.Current.Response.Write("<script>window.print();</script>");
HttpContext.Current.Response.End();
Response.Redirect("~/ListaImprez.aspx");
}
示例4: PrintWebControl
public static void PrintWebControl(Control ctrl, string Script)
{
StringWriter stringWrite = new StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
if (ctrl is WebControl)
{
Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w;
}
Page pg = new Page();
pg.EnableEventValidation = false;
pg.StyleSheetTheme = "../CSS/order.css";
if (Script != string.Empty)
{
pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script);
}
HtmlLink link = new HtmlLink();
link.Href = "../CSS/order.css";
HtmlForm frm = new HtmlForm();
pg.Controls.Add(frm);
frm.Attributes.Add("runat", "server");
frm.Controls.Add(ctrl);
pg.DesignerInitialize();
pg.RenderControl(htmlWrite);
string strHTML = stringWrite.ToString();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write("<head runat='server'> <title>Printer - Bản in tại Support.evnit.evn.com.vn</title> <link type='text/css' rel='stylesheet' href='../CSS/order.css'><link type='text/css' rel='stylesheet' href='../CSS/style.css'></head>");
HttpContext.Current.Response.Write(strHTML);
HttpContext.Current.Response.Write("<script>window.print();</script>");
HttpContext.Current.Response.End();
}
示例5: DnnFormNumericTextBoxItem
public DnnFormNumericTextBoxItem()
{
TextBoxWidth = new Unit(100);
ShowSpinButtons = true;
Type = NumericType.Number;
DecimalDigits = 0;
}
示例6: PrintWebControl
public static void PrintWebControl(Control ctrl, string Script)
{
StringWriter stringWrite = new StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
if (ctrl is WebControl)
{
Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w;
}
Page pg = new Page();
pg.EnableEventValidation = false;
if (Script != string.Empty)
{
pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script);
}
HtmlForm frm = new HtmlForm();
pg.Controls.Add(frm);
frm.Attributes.Add("runat", "server");
frm.Controls.Add(ctrl);
pg.DesignerInitialize();
pg.RenderControl(htmlWrite);
string strHTML = stringWrite.ToString();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write(strHTML);
HttpContext.Current.Response.Write("<script>window.print();</script>");
HttpContext.Current.Response.End();
}
示例7: Size
public Size(Unit _value)
{
Unit reportUnit;
if (_value.Value < 0)
{
throw new ApplicationException("Value of Common.Report.Model.Size cannot be negative.");
}
switch (_value.Type)
{
case UnitType.Mm:
case UnitType.Inch:
case UnitType.Cm:
case UnitType.Point:
case UnitType.Pica:
reportUnit = _value;
break;
default:
reportUnit = new Unit(MeasureTools.UnitToMillimeters(_value), UnitType.Mm);
break;
}
this.Value = reportUnit;
}
示例8: MessageWindowParameters
public MessageWindowParameters(string message, string title, string windowWidth, string windowHeight)
{
_Message = message;
_Title = title;
_WindowWidth = Unit.Parse(windowWidth);
_WindowHeight = Unit.Parse(windowHeight);
}
示例9: UnitString
public static string UnitString(Unit unit)
{
string rv = string.Empty;
switch (unit.Type)
{
case UnitType.Cm:
case UnitType.Em:
case UnitType.Ex:
case UnitType.Mm:
rv = string.Format("{0}{1}", unit.Value, unit.Type.ToString().ToLower());
break;
case UnitType.Inch:
rv = string.Format("{0}in", unit.Value);
break;
case UnitType.Percentage:
rv = string.Format("{0}%", unit.Value);
break;
case UnitType.Pica:
rv = string.Format("{0}pc", unit.Value);
break;
case UnitType.Pixel:
rv = string.Format("{0}px", unit.Value);
break;
case UnitType.Point:
rv = string.Format("{0}pt", unit.Value);
break;
default:
//normally will be pixels
rv = string.Format("{0}", unit.Value);
break;
}
return rv;
}
示例10: UnitToMillimeters
internal static double UnitToMillimeters(Unit unit)
{
double toRet = unit.Value;
switch (unit.Type)
{
case UnitType.Cm:
{ toRet = unit.Value * MM_IN_ONE_CENTIMETER; break; }
case UnitType.Point:
{ toRet = unit.Value * MM_IN_ONE_POINT; break; }
case UnitType.Pica:
{ toRet = unit.Value * MM_IN_ONE_PICA; break; }
case UnitType.Inch:
{ toRet = unit.Value * MM_IN_ONE_INCH; break; }
case UnitType.Mm:
{ toRet = unit.Value; break; }
case UnitType.Pixel:
{
Unit OnePixelWidth = GetOnePixelSize();
toRet = UnitToMillimeters(OnePixelWidth)* unit.Value;
break;
}
default:
{
throw new ApplicationException("Pixel, Percentage, Em, Ex - are not supported in ReportViewer");
}
}
return toRet;
}
示例11: FormatUnit
/// <summary>
/// Formats the provided unit value ready for use in styles.
/// </summary>
/// <param name="value">The unit value to format.</param>
/// <returns>The provided unit value ready for use in styles.</returns>
public static string FormatUnit(Unit value)
{
string ext = String.Empty;
if (value.Type == UnitType.Pixel)
ext = "px";
else if (value.Type == UnitType.Percentage)
ext = "%";
return value.Value + ext;
}
示例12: DatePicker
public DatePicker()
{
textBox.ID = "textBox";
textBox.Width = new Unit("90px");
textBox.Style[HtmlTextWriterStyle.VerticalAlign] = "bottom";
Width = new Unit("64px");
CssClass = "DatePicker";
}
示例13: GetUnit
public static Unit GetUnit(string key, Unit defaultValue)
{
if (ConfigurationManager.AppSettings[key] != null)
{
return Unit.Parse(ConfigurationManager.AppSettings[key], CultureInfo.InvariantCulture);
}
return defaultValue;
}
示例14: UnitPixelTypeCheck
internal Unit UnitPixelTypeCheck(object obj, Unit defaultValue, string propertyName)
{
Unit temp = (obj == null) ? defaultValue : (Unit)obj;
if (temp.Type != UnitType.Pixel)
{
throw new InvalidCastException("The Unit Type for the toolbar spacer {0} property must be of Type 'Pixel'. Example: Unit.Pixel(150) or '150px'.".FormatWith(propertyName));
}
return temp;
}
示例15: EwfTableFieldOrItemSetup
internal EwfTableFieldOrItemSetup( IEnumerable<string> classes, Unit? size, TextAlignment textAlignment, TableCellVerticalAlignment verticalAlignment,
ClickScript clickScript, string toolTip, Control toolTipControl)
{
Classes = ( classes ?? new string[0] ).ToList();
Size = size ?? Unit.Empty;
TextAlignment = textAlignment;
VerticalAlignment = verticalAlignment;
ClickScript = clickScript;
ToolTip = toolTip;
ToolTipControl = toolTipControl;
}