Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 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;
         }
     }
 }
Exemplo n.º 3
0
        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");
        }
Exemplo n.º 4
0
        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();
        }
 public DnnFormNumericTextBoxItem()
 {
     TextBoxWidth = new Unit(100);
     ShowSpinButtons = true;
     Type = NumericType.Number;
     DecimalDigits = 0;
 }
Exemplo n.º 6
0
 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();
 }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
 public MessageWindowParameters(string message, string title, string windowWidth, string windowHeight)
 {
     _Message = message;
     _Title = title;
     _WindowWidth = Unit.Parse(windowWidth);
     _WindowHeight = Unit.Parse(windowHeight);
 }
        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;
        }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
 /// <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;
 }
Exemplo n.º 12
0
		public DatePicker()
		{
			textBox.ID = "textBox";
			textBox.Width = new Unit("90px");
			textBox.Style[HtmlTextWriterStyle.VerticalAlign] = "bottom";

			Width = new Unit("64px");
			CssClass = "DatePicker";
		}
Exemplo n.º 13
0
        public static Unit GetUnit(string key, Unit defaultValue)
        {
            if (ConfigurationManager.AppSettings[key] != null)
            {
                return Unit.Parse(ConfigurationManager.AppSettings[key], CultureInfo.InvariantCulture);
            }

            return defaultValue;
        }
 public jAutocomplete() : base()
 {
     this.IncludeJqueryUI = true;
     this.UITheme = UIThemes.UiLightness;
     this.DataSource = null;
     this.DataSourceUrl = string.Empty;
     this.DataFieldName = string.Empty;
     this.MaxHeight = 0;
 }
Exemplo n.º 15
0
        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;
        }
 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;
 }
Exemplo n.º 17
0
 public Navigation01()
 {
     this.page_Index = "index.aspx";
     this.page_Add = "add.aspx";
     this.page_Delete = "delete.aspx";
     this.page_Modify = "modify.aspx";
     this.page_Search = "search.aspx";
     this.page_Show = "show.aspx";
     this.page_width = 600;
     this.page_Mode = Mode.Show;
 }
 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);
 }
Exemplo n.º 19
0
		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();
		}
Exemplo n.º 20
0
 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);
 }
Exemplo n.º 21
0
 public BackgroundPosition(System.Web.UI.WebControls.Unit value)
 {
     this._type = BackgroundPositionType.NotSet;
     if (!value.IsEmpty)
     {
         this._type = BackgroundPositionType.Unit;
         this._value = value;
     }
     else
     {
         this._value = System.Web.UI.WebControls.Unit.Empty;
     }
 }
        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 ) );
        }
 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();
 }
Exemplo n.º 24
0
		public FontUnit (FontSize type)
		{
			int t = (int) type;
			
			if (t < 0 || t > (int)FontSize.XXLarge)
				throw new ArgumentOutOfRangeException ("type");
			
			this.type = type;

			if (type == FontSize.AsUnit)
				unit = new Unit (10, UnitType.Point);
			else
				unit = Unit.Empty;
		}
Exemplo n.º 25
0
        public GridColumn(string headerName, string fieldName, Unit unit, FieldType type, ButtonType button, string commandName, HorizontalAlign hAlign)
        {
            this.headerName = headerName;
            this.fieldName = fieldName;
            this.unit = unit;
            this.type = type;
            this.button = button;
            this.commandName = commandName;
            this.hAlign = hAlign;

            if (type == FieldType.TextBoxTemplate)
            {
                _textBoxTemplate = new TextBoxTemplate(fieldName);
            }
        }
Exemplo n.º 26
0
 public BackgroundPosition(BackgroundPositionType type)
 {
     if ((type < BackgroundPositionType.NotSet) || (type > BackgroundPositionType.BottomOrRight))
     {
         throw new ArgumentOutOfRangeException("type");
     }
     this._type = type;
     if (type == BackgroundPositionType.Unit)
     {
         this._value = System.Web.UI.WebControls.Unit.Pixel(0);
     }
     else
     {
         this._value = System.Web.UI.WebControls.Unit.Empty;
     }
 }
Exemplo n.º 27
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public TabControl()
        {
            this.SelectedTab = new HtmlInputHidden();
            this._SelectedIndex = -1;
            this.SelectedTab.Value = string.Empty;
            this._Width = Unit.Pixel(350);
            this._Height = Unit.Pixel(150);
            this._Items = new TabPageCollection(this);
            this._SelectionMode = SelectionModeEnum.Client;

            this.Height = Unit.Pixel(100);
            this.Width = Unit.Pixel(100);
            this._HeightUnitMode = HeightUnitEnum.percent;
            this._WidthUnitMode = WidthUnitEnum.percent;
            this.LeftOffSetX = 0;
        }
Exemplo n.º 28
0
        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();
            string path = String.Format("{0}\\Images\\Rezerwacje\\{1}.gif", Server.MapPath("~"), Session["ZamowienieId"]);

            //korzystanie z biblioteki websiteScreenshote

            WebsitesScreenshot.WebsitesScreenshot _Obj = new WebsitesScreenshot.WebsitesScreenshot();
            WebsitesScreenshot.WebsitesScreenshot.Result _Result = _Obj.CaptureHTML(htmlToImage(strHTML, zmianaAdresu(wstawka)));

            if (_Result == WebsitesScreenshot.WebsitesScreenshot.Result.Captured)
            {
                _Obj.ImageFormat = WebsitesScreenshot.WebsitesScreenshot.ImageFormats.GIF;
                _Obj.SaveImage(path);
            }
            _Obj.Dispose();

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write(strHTML);
            Session[Cart.Ident] = null;
            HttpContext.Current.Response.Write("<script>window.print();</script>");
            HttpContext.Current.Response.End();

            Response.Redirect("~/ListaImprez.aspx");
        }
Exemplo n.º 29
0
		public static string CreateProgressBar(float progress, Orientation orientation, Unit width, Unit height, Unit borderWidth)
		{
			return CreateProgressBar(
				progress,
				orientation,
				width,
				height,
				borderWidth,
				string.Empty,
				string.Empty,
				string.Empty,
				string.Empty,
				string.Empty,
				string.Empty,
				string.Empty,
				string.Empty
				);
		}
 public ClsBindGridColumn_Web_Telerik(
     string FieldName
     , string FieldDesc
     , Unit? Width = null
     , string DataFormat = ""
     , Layer01_Constants.eSystem_Lookup_FieldType FieldType = Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Static
     , bool IsVisible = true
     , bool Enabled = true
     , bool IsFilter = true)
     : base(FieldName
     , FieldDesc
     , Width
     , DataFormat
     , FieldType
     , IsVisible
     , Enabled
     , IsFilter)
 {
 }