本文整理汇总了C#中System.Web.UI.WebControls.Unit类的典型用法代码示例。如果您正苦于以下问题:C# Unit类的具体用法?C# Unit怎么用?C# Unit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Unit类属于System.Web.UI.WebControls命名空间,在下文中一共展示了Unit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:tsandtm,项目名称:BOEdu,代码行数:26,代码来源:Prints.cs
示例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;
}
}
}
开发者ID:ikvm,项目名称:webmatrix,代码行数:26,代码来源:BackgroundPosition.cs
示例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");
}
开发者ID:donor,项目名称:Projects,代码行数:32,代码来源:Wplaty.aspx.cs
示例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();
}
开发者ID:trungjc,项目名称:quanlyhocsinh,代码行数:31,代码来源:PrintHelper.cs
示例5: DnnFormNumericTextBoxItem
public DnnFormNumericTextBoxItem()
{
TextBoxWidth = new Unit(100);
ShowSpinButtons = true;
Type = NumericType.Number;
DecimalDigits = 0;
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:7,代码来源:DnnFormNumericTextBoxItem.cs
示例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();
}
开发者ID:manivts,项目名称:impexcubeapp,代码行数:26,代码来源:PrintHelper.cs
示例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;
}
开发者ID:carlosgilf,项目名称:prettyjs,代码行数:25,代码来源:Size.cs
示例8: MessageWindowParameters
public MessageWindowParameters(string message, string title, string windowWidth, string windowHeight)
{
_Message = message;
_Title = title;
_WindowWidth = Unit.Parse(windowWidth);
_WindowHeight = Unit.Parse(windowHeight);
}
开发者ID:biganth,项目名称:Curt,代码行数:7,代码来源:MessageWindowParameters.cs
示例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;
}
开发者ID:DaleHawthorne,项目名称:DaleWare.Web.UI.Controls,代码行数:35,代码来源:ControlDesignerUtility.cs
示例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;
}
开发者ID:carlosgilf,项目名称:prettyjs,代码行数:31,代码来源:MeasureTools.cs
示例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;
}
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:14,代码来源:Utilities.cs
示例12: DatePicker
public DatePicker()
{
textBox.ID = "textBox";
textBox.Width = new Unit("90px");
textBox.Style[HtmlTextWriterStyle.VerticalAlign] = "bottom";
Width = new Unit("64px");
CssClass = "DatePicker";
}
开发者ID:gbahns,项目名称:Tennis,代码行数:9,代码来源:DatePicker.cs
示例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;
}
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:9,代码来源:ConfigHelper.cs
示例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;
}
开发者ID:emayk,项目名称:Ext.NET.Pro,代码行数:11,代码来源:CommandSpacer.cs
示例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;
}
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:11,代码来源:EwfTableFieldOrItemSetup.cs
示例16: CanParseStringToUnit
public void CanParseStringToUnit()
{
var stringUnit = "1234px";
object objUnit = "1234px";
var result = stringUnit.TryConvertTo<Unit>();
var result2 = objUnit.TryConvertTo<Unit>();
var unit = new Unit("1234px");
Assert.IsTrue(result.Success);
Assert.IsTrue(result2.Success);
Assert.AreEqual(unit, result.Result);
Assert.AreEqual(unit, result2.Result);
}
开发者ID:phaniarveti,项目名称:Experiments,代码行数:12,代码来源:ObjectExtensionsTests.cs
示例17: Test
private void Test(Type ctrlType)
{
Unit unit1;
try
{
this.GHTSubTestBegin(ctrlType, "Valid value");
unit1 = new Unit(120);
this.TestedControl.Width = unit1;
}
catch (Exception exception5)
{
// ProjectData.SetProjectError(exception5);
Exception exception1 = exception5;
this.GHTSubTestUnexpectedExceptionCaught(exception1);
// ProjectData.ClearProjectError();
}
try
{
this.GHTSubTestBegin(ctrlType, "Default value");
unit1 = this.TestedControl.Width;
this.GHTSubTestAddResult("Default width = " + unit1.ToString());
}
catch (Exception exception6)
{
// ProjectData.SetProjectError(exception6);
Exception exception2 = exception6;
this.GHTSubTestUnexpectedExceptionCaught(exception2);
// ProjectData.ClearProjectError();
}
this.GHTSubTestEnd();
try
{
this.GHTSubTestBegin(ctrlType, "Negative value");
unit1 = new Unit(-10);
this.TestedControl.Width = unit1;
this.GHTSubTestExpectedExceptionNotCaught("ArgumentException");
}
catch (ArgumentException exception7)
{
// ProjectData.SetProjectError(exception7);
// ArgumentException exception3 = exception7;
this.GHTSubTestAddResult("Test passed. Expected ArgumentException exception was caught.");
// ProjectData.ClearProjectError();
}
catch (Exception exception8)
{
// ProjectData.SetProjectError(exception8);
Exception exception4 = exception8;
this.GHTSubTestUnexpectedExceptionCaught(exception4);
// ProjectData.ClearProjectError();
}
this.GHTSubTestEnd();
}
开发者ID:nobled,项目名称:mono,代码行数:53,代码来源:WebControl_Width.aspx.cs
示例18: JQBarChart
public JQBarChart()
{
Width = new Unit(600, UnitType.Pixel);
Height = new Unit(600, UnitType.Pixel);
Title = "JQBarChart";
barWidth = 20;
labelShow = true;
LegendShow = false;
stack = false;
pointLabels = true;
dataFields = new JQCollection<JQChartDataField>(this);
}
开发者ID:san90279,项目名称:UK_OAS,代码行数:12,代码来源:JQChart.cs
示例19: if
WebControl ActionControlStyle.SetUpControl( WebControl control, string defaultText, Unit width, Unit height, Action<Unit> widthSetter )
{
widthSetter( width );
var cssElement = CssElementCreator.NormalButtonStyleClass;
if( buttonSize == ButtonSize.ShrinkWrap )
cssElement = CssElementCreator.ShrinkWrapButtonStyleClass;
else if( buttonSize == ButtonSize.Large )
cssElement = CssElementCreator.LargeButtonStyleClass;
control.CssClass = control.CssClass.ConcatenateWithSpace( CssElementCreator.AllStylesClass + " " + cssElement );
return control.AddControlsReturnThis( ActionControlIcon.GetIconAndTextControls( icon, text.Any() ? text : defaultText ) );
}
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:13,代码来源:ButtonActionControlStyle.cs
示例20: FormItemBlock
private FormItemBlock(
bool hideIfEmpty, string heading, bool useFormItemListMode, int? numberOfColumns, int defaultFormItemCellSpan, Unit? firstColumnWidth,
Unit? secondColumnWidth, TableCellVerticalAlignment verticalAlignment, IEnumerable<FormItem> formItems)
{
this.hideIfEmpty = hideIfEmpty;
this.heading = heading;
this.useFormItemListMode = useFormItemListMode;
this.numberOfColumns = numberOfColumns;
this.defaultFormItemCellSpan = defaultFormItemCellSpan;
this.firstColumnWidth = firstColumnWidth;
this.secondColumnWidth = secondColumnWidth;
this.verticalAlignment = verticalAlignment;
this.formItems = ( formItems ?? new FormItem[ 0 ] ).ToList();
}
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:14,代码来源:FormItemBlock.cs
注:本文中的System.Web.UI.WebControls.Unit类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论