當前位置: 首頁>>代碼示例>>C#>>正文


C# WebControls.Unit類代碼示例

本文整理匯總了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();
        }
開發者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


注:本文中的System.Web.UI.WebControls.Unit類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。