// Token: 0x06001B27 RID: 6951 RVA: 0x0009B8D6 File Offset: 0x00099AD6 public ColumnBehavior(HorizontalAlign horizontalAlign, int width, bool isFixedWidth) { this.horizontalAlign = horizontalAlign; this.width = width; this.isFixedWidth = isFixedWidth; this.isSortable = false; }
public static T ParseValue <T>(string value, T defaultValue) { try { if (string.IsNullOrWhiteSpace(value)) { return(defaultValue); } //split string into comma separated values string[] csv = value.Replace(" ", string.Empty).Split(','); //switch on type and parse accordingly object parsed = defaultValue switch { string _ => value, char _ => value[1], int _ => int.Parse(value), float _ => float.Parse(value), double _ => double.Parse(value), bool _ => bool.Parse(value), Vector2 _ => new Vector2(float.Parse(csv[0]), float.Parse(csv[1])), Point _ => new Point(int.Parse(csv[0]), int.Parse(csv[1])), Rectangle _ => new Rectangle(int.Parse(csv[0]), int.Parse(csv[1]), int.Parse(csv[2]), int.Parse(csv[3])), Color _ => Color.FromNonPremultiplied(int.Parse(csv[0]), int.Parse(csv[1]), int.Parse(csv[2]), csv.Length == 4 ? int.Parse(csv[3]) : 255), HorizontalAlign _ => Enum.TryParse(value, true, out HorizontalAlign converted) ? converted : default,
/// <summary> /// Initialises an instance of the <see cref="PositionProfile"/> class. /// </summary> public PositionProfile(HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, int offsetX, int offsetY) { this.HorizontalAlign = horizontalAlign; this.VerticalAlign = verticalAlign; this.OffsetX = offsetX; this.OffsetY = offsetY; }
/// <summary> /// Set text-align attribute of html element /// </summary> /// <remarks> /// Set NotSet to remove this attribute. /// </remarks> /// <param name="value"></param> /// <returns></returns> public HtmlStyleBuilder Align(HorizontalAlign value) { if (value == HorizontalAlign.NotSet) Remove("text-align"); MergeAttribute("text-align", value.ToString().ToLower(), true); return this; }
public ListColumn(string member, string label, HorizontalAlign align, TypeColumn type) { this.Member = member; this.Label = label; this.Align = align; this.Type = type; }
/// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void PushLayout(HorizontalAlign align, bool wrap) { Layout newLayout = new Layout(align, wrap); newLayout.MergeWith(CurrentLayout); _layoutStack.Push(newLayout); }
public Rect GetCharacterRect(Vector2 position, string text, int index, HorizontalAlign halign, VerticalAlign valign) { Rect r = new Rect(); r.Position = getCharacterPosition(position, text, index, halign, valign); r.Size.Y = Baseline; if (index == text.Length) { r.Size.X = _charWidth[0]; } else { if (text[index] == ' ') { r.Size.X = SpaceWidth; } else { int ci = GetCharacterIndex(text[index]); if (ci == -1) { ci = 0; } r.Size.X = _charWidth[ci]; } } return(r); }
private void RenderNavigationSection(HtmlTextWriter writer) { if (CustomInfoSectionWidth.Type == UnitType.Percentage) { writer.AddStyleAttribute(HtmlTextWriterStyle.Width, (Unit.Percentage(100 - CustomInfoSectionWidth.Value)).ToString()); } if (HorizontalAlign != HorizontalAlign.NotSet) { writer.AddAttribute(HtmlTextWriterAttribute.Align, HorizontalAlign.ToString().ToLower()); } if (!string.IsNullOrEmpty(CssClass)) { writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClass); } if (LayoutType == LayoutType.Table) { writer.AddAttribute(HtmlTextWriterAttribute.Valign, "bottom"); writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "true"); writer.RenderBeginTag(HtmlTextWriterTag.Td); //<td> } else { writer.AddStyleAttribute("float", "left"); writer.RenderBeginTag(HtmlTextWriterTag.Div); //<div> } RenderPagingElements(writer); writer.RenderEndTag(); //</div> or </td> }
public TextSprite SetHorizontalAlign(HorizontalAlign hAlign) { _horizontalAlign = hAlign; UpdateCentering(); return(this); }
public Label(Theme theme, TextFormat font, float x, float y, float width, float height, string text) : base(theme, font, x, y, width, height) { this.Text = text; this.align = HorizontalAlign.Left; this.castShadow = false; }
protected override void RenderHeader(HtmlTextWriter writer) { writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2"); writer.AddAttribute(HtmlTextWriterAttribute.Border, "0"); writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%"); TitleStyle headerStyle = base.HeaderStyle; if (!headerStyle.IsEmpty) { Style style2 = new Style(); if (!headerStyle.ForeColor.IsEmpty) { style2.ForeColor = headerStyle.ForeColor; } style2.Font.CopyFrom(headerStyle.Font); if (!headerStyle.Font.Size.IsEmpty) { style2.Font.Size = new FontUnit(new Unit(100.0, UnitType.Percentage)); } if (!style2.IsEmpty) { style2.AddAttributesToRender(writer, this); } } writer.RenderBeginTag(HtmlTextWriterTag.Table); writer.RenderBeginTag(HtmlTextWriterTag.Tr); HorizontalAlign horizontalAlign = headerStyle.HorizontalAlign; if (horizontalAlign != HorizontalAlign.NotSet) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign)); } writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%"); writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write(this.HeaderText); writer.RenderEndTag(); WebPartVerb headerCloseVerb = this.HeaderCloseVerb; if (headerCloseVerb.Visible) { writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap"); writer.RenderBeginTag(HtmlTextWriterTag.Td); ZoneLinkButton button = new ZoneLinkButton(this, headerCloseVerb.EventArgument) { Text = headerCloseVerb.Text, ImageUrl = headerCloseVerb.ImageUrl, ToolTip = headerCloseVerb.Description, Enabled = headerCloseVerb.Enabled, Page = this.Page }; button.ApplyStyle(this.HeaderVerbStyle); button.RenderControl(writer); writer.RenderEndTag(); } writer.RenderEndTag(); writer.RenderEndTag(); }
/// <summary> /// Adds HTML attributes and styles that need to be rendered to the specified /// System.Web.UI.HtmlTextWriter instance. /// </summary> /// <param name="writer">An System.Web.UI.HtmlTextWriter that represents the output stream to render HTML content on the client</param> protected override void AddAttributesToRender(HtmlTextWriter writer) { base.AddAttributesToRender(writer); string backImageUrl = this.BackImageUrl; if (backImageUrl.Trim().Length > 0) { writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + base.ResolveClientUrl(backImageUrl) + ")"); } this.AddScrollingAttribute(this.ScrollBars, writer); HorizontalAlign horizontalAlign = this.HorizontalAlign; if (horizontalAlign != HorizontalAlign.NotSet) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign)); writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, converter.ConvertToInvariantString(horizontalAlign).ToLowerInvariant()); } if (!this.Wrap) { writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap"); } if (this.Direction == ContentDirection.LeftToRight) { writer.AddAttribute(HtmlTextWriterAttribute.Dir, "ltr"); } else if (this.Direction == ContentDirection.RightToLeft) { writer.AddAttribute(HtmlTextWriterAttribute.Dir, "rtl"); } }
/// <include file='doc\TableStyle.uex' path='docs/doc[@for="TableStyle.CopyFrom"]/*' /> /// <internalonly/> /// <devdoc> /// <para>Copies non-blank elements from the specified style, overwriting existing /// style elements if necessary.</para> /// </devdoc> public override void CopyFrom(Style s) { if (s != null && !s.IsEmpty) { base.CopyFrom(s); if (s is TableStyle) { TableStyle ts = (TableStyle)s; if (ts.IsSet(PROP_BACKIMAGEURL)) { this.BackImageUrl = ts.BackImageUrl; } if (ts.IsSet(PROP_CELLPADDING)) { this.CellPadding = ts.CellPadding; } if (ts.IsSet(PROP_CELLSPACING)) { this.CellSpacing = ts.CellSpacing; } if (ts.IsSet(PROP_GRIDLINES)) { this.GridLines = ts.GridLines; } if (ts.IsSet(PROP_HORZALIGN)) { this.HorizontalAlign = ts.HorizontalAlign; } } } }
/// <summary>Generates the HTML text code.</summary> /// <param name="alignment">The alignment.</param> /// <param name="text">The text.</param> /// <param name="prefixCode">The prefix code.</param> /// <param name="fontStyle">The font style.</param> /// <returns>The <see cref="string"/>.</returns> public static string GenerateHTMLTextCode(HorizontalAlign alignment, string text, string prefixCode = "p", FontStyle fontStyle = FontStyle.Regular) { // Allow using custom prefix text to create specific types like: 'h1' or 'p'. // FontStyle style = FontStyle.Bold | FontStyle.Regular; // Add custom font styling. // <p align="center" style="font-style:italic;font-size:12pt"> // <p align="center" style="font-style:italic;"> // Features the latest project repositories as a gallery showcase. // </p> StringBuilder imageBuilder = new StringBuilder(); imageBuilder.AppendLine(string.Format(@"<{1} align={0}{2}{0}>", Constants.Quotes, prefixCode, alignment.ToString())); // Create the font style. // imageBuilder.Append(string.Format(@"style={0}font-style:italic;{0}>", Constants.Quotes, 0)); // imageBuilder.Append(string.Format(@"style={0}{2}{0}>", Constants.Quotes, 0)); imageBuilder.AppendLine($@"{text}"); imageBuilder.AppendLine($@"</{prefixCode}>"); return(imageBuilder.ToString()); }
protected override void Initialize(DataRow schemeData) { if (schemeData != null) { this.FontName = BaseAutoFormat <Wizard> .GetStringProperty("FontName", schemeData); this.FontSize = new FontUnit(BaseAutoFormat <Wizard> .GetStringProperty("FontSize", schemeData), CultureInfo.InvariantCulture); this.BackColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("BackColor", schemeData)); this.BorderColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("BorderColor", schemeData)); this.BorderWidth = new Unit(BaseAutoFormat <Wizard> .GetStringProperty("BorderWidth", schemeData), CultureInfo.InvariantCulture); this.SideBarStyleBackColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("SideBarStyleBackColor", schemeData)); this.SideBarStyleVerticalAlign = (VerticalAlign)BaseAutoFormat <Wizard> .GetIntProperty("SideBarStyleVerticalAlign", schemeData); this.BorderStyle = (System.Web.UI.WebControls.BorderStyle) BaseAutoFormat <Wizard> .GetIntProperty("BorderStyle", schemeData); this.NavigationButtonStyleBorderWidth = new Unit(BaseAutoFormat <Wizard> .GetStringProperty("NavigationButtonStyleBorderWidth", schemeData), CultureInfo.InvariantCulture); this.NavigationButtonStyleFontName = BaseAutoFormat <Wizard> .GetStringProperty("NavigationButtonStyleFontName", schemeData); this.NavigationButtonStyleFontSize = new FontUnit(BaseAutoFormat <Wizard> .GetStringProperty("NavigationButtonStyleFontSize", schemeData), CultureInfo.InvariantCulture); this.NavigationButtonStyleBorderStyle = (System.Web.UI.WebControls.BorderStyle) BaseAutoFormat <Wizard> .GetIntProperty("NavigationButtonStyleBorderStyle", schemeData); this.NavigationButtonStyleBorderColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("NavigationButtonStyleBorderColor", schemeData)); this.NavigationButtonStyleForeColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("NavigationButtonStyleForeColor", schemeData)); this.NavigationButtonStyleBackColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("NavigationButtonStyleBackColor", schemeData)); this.StepStyleBorderWidth = new Unit(BaseAutoFormat <Wizard> .GetStringProperty("StepStyleBorderWidth", schemeData), CultureInfo.InvariantCulture); this.StepStyleBorderStyle = (System.Web.UI.WebControls.BorderStyle) BaseAutoFormat <Wizard> .GetIntProperty("StepStyleBorderStyle", schemeData); this.StepStyleBorderColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("StepStyleBorderColor", schemeData)); this.StepStyleForeColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("StepStyleForeColor", schemeData)); this.StepStyleBackColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("StepStyleBackColor", schemeData)); this.StepStyleFontSize = new FontUnit(BaseAutoFormat <Wizard> .GetStringProperty("StepStyleFontSize", schemeData), CultureInfo.InvariantCulture); this.SideBarButtonStyleFontUnderline = BaseAutoFormat <Wizard> .GetBooleanProperty("SideBarButtonStyleFontUnderline", schemeData); this.SideBarButtonStyleFontName = BaseAutoFormat <Wizard> .GetStringProperty("SideBarButtonStyleFontName", schemeData); this.SideBarButtonStyleForeColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("SideBarButtonStyleForeColor", schemeData)); this.SideBarButtonStyleBorderWidth = new Unit(BaseAutoFormat <Wizard> .GetStringProperty("SideBarButtonStyleBorderWidth", schemeData), CultureInfo.InvariantCulture); this.SideBarButtonStyleBackColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("SideBarButtonStyleBackColor", schemeData)); this.HeaderStyleForeColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("HeaderStyleForeColor", schemeData)); this.HeaderStyleBorderColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("HeaderStyleBorderColor", schemeData)); this.HeaderStyleBackColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("HeaderStyleBackColor", schemeData)); this.HeaderStyleFontSize = new FontUnit(BaseAutoFormat <Wizard> .GetStringProperty("HeaderStyleFontSize", schemeData), CultureInfo.InvariantCulture); this.HeaderStyleFontBold = BaseAutoFormat <Wizard> .GetBooleanProperty("HeaderStyleFontBold", schemeData); this.HeaderStyleBorderWidth = new Unit(BaseAutoFormat <Wizard> .GetStringProperty("HeaderStyleBorderWidth", schemeData), CultureInfo.InvariantCulture); this.HeaderStyleHorizontalAlign = (HorizontalAlign)BaseAutoFormat <Wizard> .GetIntProperty("HeaderStyleHorizontalAlign", schemeData); this.HeaderStyleBorderStyle = (System.Web.UI.WebControls.BorderStyle) BaseAutoFormat <Wizard> .GetIntProperty("HeaderStyleBorderStyle", schemeData); this.SideBarStyleBackColor = ColorTranslator.FromHtml(BaseAutoFormat <Wizard> .GetStringProperty("SideBarStyleBackColor", schemeData)); this.SideBarStyleVerticalAlign = (VerticalAlign)BaseAutoFormat <Wizard> .GetIntProperty("SideBarStyleVerticalAlign", schemeData); this.SideBarStyleFontSize = new FontUnit(BaseAutoFormat <Wizard> .GetStringProperty("SideBarStyleFontSize", schemeData), CultureInfo.InvariantCulture); this.SideBarStyleFontUnderline = BaseAutoFormat <Wizard> .GetBooleanProperty("SideBarStyleFontUnderline", schemeData); this.SideBarStyleFontStrikeout = BaseAutoFormat <Wizard> .GetBooleanProperty("SideBarStyleFontStrikeout", schemeData); this.SideBarStyleBorderWidth = new Unit(BaseAutoFormat <Wizard> .GetStringProperty("SideBarStyleBorderWidth", schemeData), CultureInfo.InvariantCulture); } }
private void SetHorizontalAlignment(HorizontalAlign align) { if (align != HorizontalAlign.NotSet) { _Html.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, align.ToString()); } }
public Text setHorizontalAlign(HorizontalAlign hAlign) { _horizontalAlign = hAlign; updateCentering(); return(this); }
/// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="OnPreRender"]/*'/> //protected override void OnPreRender(EventArgs e) //{ // Page.ClientScript.RegisterClientScriptResource(this.GetType(), "Wuqi.Webdiyer.ANPScript.js"); // base.OnPreRender(e); //} /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="AddAttributesToRender"]/*'/> protected override void AddAttributesToRender(HtmlTextWriter writer) { if (Page != null && !UrlPaging) { Page.VerifyRenderingInServerForm(this); } const string isANPScriptRegistered = "isANPScriptRegistered"; if (!DesignMode && HttpContext.Current.Items[scriptRegItemName] != null && HttpContext.Current.Items[isANPScriptRegistered] == null) { writer.Write("<script type=\"text/javascript\" src=\""); writer.Write(Page.ClientScript.GetWebResourceUrl(this.GetType(), "Wuqi.Webdiyer.ANPScript.js")); writer.WriteLine("\"></script>"); HttpContext.Current.Items[isANPScriptRegistered] = true; } if (HorizontalAlign != HorizontalAlign.NotSet) { writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, HorizontalAlign.ToString().ToLower()); } if (!string.IsNullOrEmpty(BackImageUrl)) { writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, BackImageUrl); } base.AddAttributesToRender(writer); }
private static void SizeLayoutElement(ILayoutElement layoutElement, float width, HorizontalAlign horizontalAlign, float restrictedWidth, float? height, bool variableRowHeight, float rowHeight) { float? newWidth = null; // if horizontalAlign is "justify" or "contentJustify", // restrict the width to restrictedWidth. Otherwise, // size it normally if (horizontalAlign == HorizontalAlign.Justify || horizontalAlign == HorizontalAlign.ContentJustify) { newWidth = restrictedWidth; } else { if (null != layoutElement.PercentWidth) newWidth = CalculatePercentWidth(layoutElement, width); } if (variableRowHeight) layoutElement.SetLayoutBoundsSize(newWidth, height); else layoutElement.SetLayoutBoundsSize(newWidth, rowHeight); }
/// <devdoc> /// <para>Adds information about horizontal alignment, vertical alignment, and wrap to the list of attributes to render.</para> /// </devdoc> public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner) { base.AddAttributesToRender(writer, owner); if (!Wrap) { if (IsControlEnableLegacyRendering(owner)) { writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap"); } else { writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap"); } } HorizontalAlign hAlign = HorizontalAlign; if (hAlign != HorizontalAlign.NotSet) { TypeConverter hac = TypeDescriptor.GetConverter(typeof(HorizontalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Align, hac.ConvertToString(hAlign).ToLower(CultureInfo.InvariantCulture)); } VerticalAlign vAlign = VerticalAlign; if (vAlign != VerticalAlign.NotSet) { TypeConverter hac = TypeDescriptor.GetConverter(typeof(VerticalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Valign, hac.ConvertToString(vAlign).ToLower(CultureInfo.InvariantCulture)); } }
private void NewRow(string desc, string propertyName, FormatMethod fm, HorizontalAlign cellAlign) { TableRow row = this.NewRow(); row.CssClass = "tdbg"; row.Cells.Add(NewTitleCell(desc)); for (int i = 0; i < this.ProductInfoList.Count; i++) { ProductDetailInfo info = this.ProductInfoList[i]; string name = string.Empty; if (fm != null) { name = fm(info); } else { MethodInfo method = info.GetType().GetMethod("get_" + propertyName); if (method != null) { name = Convert.ToString(method.Invoke(info, null)); } } TableCell cell = NewCell(name); cell.HorizontalAlign = cellAlign; row.Cells.Add(cell); } this.TbProduct.Rows.Add(row); }
public static TableCell GetTableCell(string text,HorizontalAlign align) { TableCell tableCell = new TableCell(); tableCell.Text = text; tableCell.HorizontalAlign = align; return tableCell; }
/// <include file='doc\TableItemStyle.uex' path='docs/doc[@for="TableItemStyle.AddAttributesToRender"]/*' /> /// <devdoc> /// <para>Adds information about horizontal alignment, vertical alignment, and wrap to the list of attributes to render.</para> /// </devdoc> public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner) { base.AddAttributesToRender(writer, owner); if (!Wrap) { writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap"); } HorizontalAlign hAlign = HorizontalAlign; if (hAlign != HorizontalAlign.NotSet) { TypeConverter hac = TypeDescriptor.GetConverter(typeof(HorizontalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Align, hac.ConvertToString(hAlign)); } VerticalAlign vAlign = VerticalAlign; if (vAlign != VerticalAlign.NotSet) { TypeConverter hac = TypeDescriptor.GetConverter(typeof(VerticalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Valign, hac.ConvertToString(vAlign)); } }
private void RenderTitleBar(HtmlTextWriter writer, WebPart webPart) { writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Border, "0"); writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%"); writer.RenderBeginTag(HtmlTextWriterTag.Table); writer.RenderBeginTag(HtmlTextWriterTag.Tr); int colspan = 1; bool showTitleIcons = this.Zone.ShowTitleIcons; string titleIconImageUrl = null; if (showTitleIcons) { titleIconImageUrl = webPart.TitleIconImageUrl; if (!string.IsNullOrEmpty(titleIconImageUrl)) { colspan++; writer.RenderBeginTag(HtmlTextWriterTag.Td); this.RenderTitleIcon(writer, webPart); writer.RenderEndTag(); } } writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%"); TableItemStyle partTitleStyle = this.Zone.PartTitleStyle; if (!partTitleStyle.Wrap) { writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap"); } HorizontalAlign horizontalAlign = partTitleStyle.HorizontalAlign; if (horizontalAlign != HorizontalAlign.NotSet) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign).ToLower(CultureInfo.InvariantCulture)); } VerticalAlign verticalAlign = partTitleStyle.VerticalAlign; if (verticalAlign != VerticalAlign.NotSet) { TypeConverter converter2 = TypeDescriptor.GetConverter(typeof(VerticalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Valign, converter2.ConvertToString(verticalAlign).ToLower(CultureInfo.InvariantCulture)); } if (this.Zone.RenderClientScript) { writer.AddAttribute(HtmlTextWriterAttribute.Id, this.GetWebPartTitleClientID(webPart)); } writer.RenderBeginTag(HtmlTextWriterTag.Td); if (showTitleIcons && !string.IsNullOrEmpty(titleIconImageUrl)) { writer.Write(" "); } this.RenderTitleText(writer, webPart); writer.RenderEndTag(); this.RenderVerbsInTitleBar(writer, webPart, colspan); writer.RenderEndTag(); writer.RenderEndTag(); }
// Token: 0x06001B23 RID: 6947 RVA: 0x0009B879 File Offset: 0x00099A79 public ColumnBehavior(HorizontalAlign horizontalAlign, int width, bool isFixedWidth, SortOrder defaultSortOrder, GroupType groupType) { this.horizontalAlign = horizontalAlign; this.width = width; this.isFixedWidth = isFixedWidth; this.defaultSortOrder = defaultSortOrder; this.groupType = groupType; }
public static string Align(this string source, int columnSize, HorizontalAlign horizontalAlign, char padValue) { return(horizontalAlign switch { HorizontalAlign.Center => source.PadCenter(columnSize, padValue), HorizontalAlign.Right => source.PadLeft(columnSize, padValue), _ => source.PadRight(columnSize, padValue) });
/// <summary>Generates the HTML image code with a link.</summary> /// <param name="alignment">The alignment.</param> /// <param name="href">The href.</param> /// <param name="src">The source.</param> /// <param name="altText">The alt text.</param> /// <param name="size">The size.</param> /// <returns>The <see cref="string"/>.</returns> public static string GenerateHTMLImageCode(HorizontalAlign alignment, string href, string src, string altText, Size size) { StringBuilder imageBuilder = new StringBuilder(); imageBuilder.AppendLine(string.Format(@"<p align={0}{1}{0}>", Constants.Quotes, alignment.ToString())); imageBuilder.AppendLine(string.Format(@"<a href={0}{1}{0}><img alt={0}{3}{0} width={0}{4}{0} height={0}{5}{0} src={0}{2}{0}></a></p>", Constants.Quotes, href, src, altText, size.Width, size.Height)); return(imageBuilder.ToString()); }
public Column(string dbFieldName, string dbSortFieldName, string HeaderText, bool required, HorizontalAlign ha, int MaxLength) { _dbFieldName = dbFieldName; _dbSortFieldName = dbSortFieldName; _HeaderText = HeaderText; _required = required; _ha = ha; _maxLength = MaxLength; }
void AddTextWithShadow(GuiRenderer renderer, string text, Vec2 position, HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, ColorValue color) { Vec2 shadowOffset = 2.0f / RendererWorld.Instance.DefaultViewport.DimensionsInPixels.Size.ToVec2(); renderer.AddText(text, position + shadowOffset, horizontalAlign, verticalAlign, new ColorValue(0, 0, 0, color.Alpha / 2)); renderer.AddText(text, position, horizontalAlign, verticalAlign, color); }
private void drawString(string str, Page page, Font fnt, Brush br, Pen pen, HorizontalAlign halign, float left, float top, float width, float height, StringFormat sf) { page.Canvas.DrawRoundedRectangle(pen, new RectangleF(left, top, m_width, m_height), 5); sf.HorizontalAlign = halign; str = str + " and " + halign.ToString(); page.Canvas.DrawString(str, fnt, br, new RectangleF(left, top, width, height), sf); sf.HorizontalAlign = HorizontalAlign.Left; }
void AddTextWithShadow(GuiRenderer renderer, Font font, string text, Vec2 position, HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, ColorValue color) { Vec2 shadowOffset = 1.0f / renderer.ViewportForScreenGuiRenderer.DimensionsInPixels.Size.ToVec2(); renderer.AddText(font, text, position + shadowOffset, horizontalAlign, verticalAlign, new ColorValue(0, 0, 0, color.Alpha / 2)); renderer.AddText(font, text, position, horizontalAlign, verticalAlign, color); }
public Label(string text, HorizontalAlign halign, VerticalAlign valign) { m_text = text; m_font = new Font("Arial", 8, FontStyle.Regular); m_stringFormat = new StringFormat(); m_color = Color.Black; this.HorizontalAlign = halign; this.VerticalAlign = valign; }
/// <summary> /// Set text-align attribute of html element /// </summary> /// <remarks> /// Set NotSet to remove this attribute. /// </remarks> /// <param name="value"></param> /// <returns></returns> public HtmlStyleBuilder Align(HorizontalAlign value) { if (value == HorizontalAlign.NotSet) { Remove("text-align"); } MergeAttribute("text-align", value.ToString().ToLower(), true); return(this); }
protected override void AddDesignTimeCssAttributes(IDictionary styleAttributes) { Panel component = (Panel)base.Component; switch (component.Direction) { case ContentDirection.LeftToRight: styleAttributes["direction"] = "ltr"; break; case ContentDirection.RightToLeft: styleAttributes["direction"] = "rtl"; break; } string backImageUrl = component.BackImageUrl; if (backImageUrl.Trim().Length > 0) { IUrlResolutionService service = (IUrlResolutionService)this.GetService(typeof(IUrlResolutionService)); if (service != null) { backImageUrl = service.ResolveClientUrl(backImageUrl); styleAttributes["background-image"] = "url(" + backImageUrl + ")"; } } switch (component.ScrollBars) { case ScrollBars.Horizontal: styleAttributes["overflow-x"] = "scroll"; break; case ScrollBars.Vertical: styleAttributes["overflow-y"] = "scroll"; break; case ScrollBars.Both: styleAttributes["overflow"] = "scroll"; break; case ScrollBars.Auto: styleAttributes["overflow"] = "auto"; break; } HorizontalAlign horizontalAlign = component.HorizontalAlign; if (horizontalAlign != HorizontalAlign.NotSet) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign)); styleAttributes["text-align"] = converter.ConvertToInvariantString(horizontalAlign).ToLowerInvariant(); } if (!component.Wrap) { styleAttributes["white-space"] = "nowrap"; } base.AddDesignTimeCssAttributes(styleAttributes); }
// Methods to set layout /// <summary> /// Set the default properties on this MenuItem /// </summary> public virtual void SetDefaults() { this.Size = new Vector2(200, 40); this.FontSize = 40; this.Colour = Color.Black; this.SelectedColour = Color.Yellow; this.TextAlign = HorizontalAlign.Center; this.TextVAlign = VerticalAlign.Bottom; this.TextOffset = Vector2.Zero; }
public PccRow(string Css, HorizontalAlign HAlign, VerticalAlign VAlign, int CellSpan, int RowSpan, int Height) { m_Row = new TableRow(); m_Css = Css; m_HAlign = HAlign; m_VAlign = VAlign; m_CellSpan = CellSpan; m_RowSpan = RowSpan; m_Height = Height; }
public PccRow(string Css) { m_Row = new TableRow(); m_Css = Css; m_HAlign = 0; m_VAlign = 0; m_CellSpan = 0; m_RowSpan = 0; m_Height = 0; }
public Label(string text, SpriteFont spriteFont) { this.Text = text; this.SpriteFont = spriteFont; this.HorizontalAlign = HorizontalAlign.LEFT; this.VerticalAlign = VerticalAlign.TOP; this.TextSize = this.SpriteFont.MeasureString(text); this.Width = (int)this.TextSize.X; this.Height = (int)this.TextSize.Y; }
public Text( IFont font, string text, Vector2 localOffset, Color color ) { _font = font; _text = text; _localOffset = localOffset; this.color = color; _horizontalAlign = HorizontalAlign.Left; _verticalAlign = VerticalAlign.Top; updateSize(); }
public Text(SpriteFont font, string text, Vector2 position, Color color, HorizontalAlign horizontalAlign = HorizontalAlign.Center, VerticalAlign verticalAlign = VerticalAlign.Center) : base(false) { this.font = font; this.text = text; Position = position; Color = color; this.horizontalOrigin = horizontalAlign; this.verticalOrigin = verticalAlign; UpdateSize(); }
public PccRow() { // // TODO: 在這裡加入建構函式的程式碼 // m_Row = new TableRow(); m_Css = ""; m_HAlign = 0; m_VAlign = 0; m_CellSpan = 0; m_RowSpan = 0; m_Height = 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); } }
/// <summary> /// This will extract the horizontal alignment parameter. /// </summary> /// <param name="parameters">The collection of parameters.</param> /// <param name="defaultValue">The default value.</param> /// <returns>The <see cref="HorizontalAlign"/> value.</returns> /// <exception cref="ArgumentException"> /// Thrown if the alignment value is not a valid enum value. /// /// -- or -- /// /// Thrown if the alignment is not Center, Left, or Right /// </exception> public static HorizontalAlign ExtractAlign(ICollection<string> parameters, HorizontalAlign defaultValue) { string align; if (!TryGetValue(parameters, "align", out align)) return defaultValue; if (!Utility.IsDefinedOnEnum<HorizontalAlign>(align)) throw new ArgumentException("Invalid parameter.", "align"); var alignment = (HorizontalAlign) Enum.Parse(typeof (HorizontalAlign), align, true); if (alignment != HorizontalAlign.Center && alignment != HorizontalAlign.Left && alignment != HorizontalAlign.Right) throw new ArgumentException("Invalid parameter.", "align"); return alignment; }
/// <summary>Constructor.</summary> /// <param name="container">The containing block element whose children are being stacked.</param> /// <param name="horizontal">The alignment to apply to the X axis.</param> /// <param name="vertical">The alignment to apply to the Y axis.</param> public StackPanel(jQueryObject container, HorizontalAlign horizontal, VerticalAlign vertical) { // Setup initial conditions. this.container = container; // Set default values. Horizontal = Script.IsNullOrUndefined(horizontal) ? DefaultHorizontal : horizontal; Vertical = Script.IsNullOrUndefined(vertical) ? DefaultVertical: vertical; // Wire up events. childMargin.PropertyChanged += delegate { UpdateLayout(); }; // Finish up. isInitialized = true; UpdateLayout(); }
public Background(Rectangle screenBounds, TextureFrame frame, VerticalAlign vertical = VerticalAlign.Middle, HorizontalAlign horizontal = HorizontalAlign.Center) { if (screenBounds == null || screenBounds.Size == Point.Zero) throw new ArgumentNullException(nameof(screenBounds)); if (frame == null) throw new ArgumentNullException(nameof(frame)); _frame = frame; Color = Color.White; Alpha = 1f; var scaleFactor = Math.Max(screenBounds.Width/frame.Size.X, screenBounds.Height/frame.Size.Y); _scale = new Vector2(scaleFactor); var pos = new Vector2(); var frameSize = frame.Size*scaleFactor; switch (vertical) { case VerticalAlign.Top: pos.Y = 0; break; case VerticalAlign.Bottom: pos.Y = SkidiGame.ScreenBounds.Height - frameSize.Y; break; case VerticalAlign.Middle: pos.Y = (SkidiGame.ScreenBounds.Height - frameSize.Y)*.5f; break; } switch (horizontal) { case HorizontalAlign.Left: pos.X = 0; break; case HorizontalAlign.Right: pos.X = (SkidiGame.ScreenBounds.Width - frameSize.X); break; case HorizontalAlign.Center: pos.X = (SkidiGame.ScreenBounds.Width - frameSize.X)*.5f; break; } Position = pos; }
public static void DrawInRect( SpriteBatch spriteBatch, GameSprite sprite, Rectangle bounds, HorizontalAlign alignHorizontal = HorizontalAlign.Center, VerticalAlign alignVertical = VerticalAlign.Middle ) { Vector2 location = Vector2.Zero; Vector2 origin = Vector2.Zero; switch (alignHorizontal) { case HorizontalAlign.Left: location.X = bounds.X; origin.X = 0; break; case HorizontalAlign.Center: location.X = bounds.X + bounds.Width / 2; origin.X = sprite.TextureRect.Width / 2; break; case HorizontalAlign.Right: location.X = bounds.X + bounds.Width; origin.X = sprite.TextureRect.Width; break; } switch (alignVertical) { case VerticalAlign.Top: location.Y = bounds.Y; origin.Y = 0; break; case VerticalAlign.Middle: location.Y = bounds.Y + bounds.Height / 2; origin.Y = sprite.TextureRect.Height / 2; break; case VerticalAlign.Bottom: location.Y = bounds.Y + bounds.Height; origin.Y = sprite.TextureRect.Height; break; } sprite.Draw (spriteBatch, location, origin: origin); }
/// <summary> /// Renders a string from a specified SpriteFont /// </summary> /// <param name="spriteBatch">SpriteBatch to render to</param> /// <param name="font">SpriteFont to render with</param> /// <param name="text">String to render</param> /// <param name="color">Text Color</param> /// <param name="position">Position to render to</param> /// <param name="hAlign">Horizontal Align</param> /// <param name="vAlign">Vertical Align</param> public static void DrawText(SpriteBatch spriteBatch, SpriteFont font, string text, Color color, Vector2 position, HorizontalAlign hAlign, VerticalAlign vAlign) { //Get the size of the text for offsetting Vector2 fullSize = font.MeasureString(text); //Offset Horizontal and Vertical aligns based on the specified enum value Vector2 alignOffset = new Vector2(); switch (hAlign) { case HorizontalAlign.AlignCenter: alignOffset.X = fullSize.X / 2; break; case HorizontalAlign.AlignRight: alignOffset.X = fullSize.X; break; default: break; } switch (vAlign) { case VerticalAlign.AlignCenter: alignOffset.Y = fullSize.Y / 2; break; case VerticalAlign.AlignBottom: alignOffset.Y = fullSize.Y; break; default: break; } Vector2 drawPos = position - alignOffset; drawPos.X = (int)Math.Round(drawPos.X); drawPos.Y = (int)Math.Round(drawPos.Y); spriteBatch.DrawString(font, text, drawPos, color); }
void AddTextWithShadow( GuiRenderer renderer, Engine.Renderer.Font font, string text, Vec2 position, HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, ColorValue color ) { Vec2 shadowOffset = 2.0f / renderer.ViewportForScreenGuiRenderer.DimensionsInPixels.Size.ToVec2(); renderer.AddText( font, text, position + shadowOffset, horizontalAlign, verticalAlign, new ColorValue( 0, 0, 0, color.Alpha / 2 ) ); renderer.AddText( font, text, position, horizontalAlign, verticalAlign, color ); }
/// <summary> /// Computes the location of a rectangle of the specified size, align to the given anchor. /// </summary> /// <param name="size">The rectangle size.</param> /// <param name="anchor">The anchor rectangle.</param> /// <param name="horizontalAlignment">The horizontal alignment.</param> /// <param name="verticalAlignment">The vertical alignment.</param> /// <returns>The aligned rectangle.</returns> public static Rectangle Align(this Size size, Rectangle anchor, HorizontalAlign horizontalAlignment, VerticalAlign verticalAlignment) { // Declare the location. Point location = default(Point); // Compute the X coordinate. switch (horizontalAlignment) { case HorizontalAlign.LeftOutside: location.X = anchor.Left - size.Width; break; case HorizontalAlign.LeftInside: location.X = anchor.Left; break; case HorizontalAlign.Center: location.X = anchor.Left + (anchor.Width >> 1) - (size.Width >> 1); break; case HorizontalAlign.RightInside: location.X = anchor.Right - size.Width; break; case HorizontalAlign.RightOutside: location.X = anchor.Right; break; } // Compute the Y coordinate. switch (verticalAlignment) { case VerticalAlign.TopOutside: location.Y = anchor.Top - size.Height; break; case VerticalAlign.TopInside: location.Y = anchor.Top; break; case VerticalAlign.Center: location.Y = anchor.Top + (anchor.Height >> 1) - (size.Height >> 1); break; case VerticalAlign.BottomInside: location.Y = anchor.Bottom - size.Height; break; case VerticalAlign.BottomOutside: location.Y = anchor.Bottom; break; } // Return the aligned rectangle. return new Rectangle(location, size); }
public WatermarkImageTransformation( WebImage image, int width, int height, HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, int opacity, int padding) : base(horizontalAlign, verticalAlign, padding) { WatermarkImage = image; Width = width; Height = height; Opacity = opacity; }
/// <summary> /// 设置列头对齐方式 /// </summary> /// <param name="grid"></param> /// <param name="startCol"></param> /// <param name="endCol"></param> /// <param name="ha"></param> public static void SetColumnHeaderAlign(UltraWebGrid grid, int startCol, int endCol,HorizontalAlign ha) { for (int i = startCol; i < endCol; i++) { grid.Bands[0].Columns[i].Header.Style.HorizontalAlign = ha; } }
public WatermarkTextTransformation( string text, Color fontColor, int fontSize, FontStyle fontStyle, FontFamily fontFamily, HorizontalAlign alignX, VerticalAlign alignY, int padding) : base(alignX, alignY, padding) { Text = text; FontColor = fontColor; FontSize = fontSize; FontStyle = fontStyle; FontFamily = fontFamily; }
public WatermarkTransformation(HorizontalAlign alignX, VerticalAlign alignY, int padding) { HorizontalAlign = alignX; VerticalAlign = alignY; Padding = padding; }
/* public Layout(Layout currentLayout) { Align = currentLayout.Align; Wrap = currentLayout.Wrap; } */ public Layout(HorizontalAlign alignment, bool wrapping) { Align = alignment; Wrap = wrapping; }
private void AddGridColumn(string headerText, string dataField, int width, HorizontalAlign alignment, bool visible, string dataFormatString) { // Instantiate a new column ConfigBoundCol dgc = new ConfigBoundCol(); // Create and size the columns if (width > 0) { dgc.ItemStyle.Width = width; } dgc.ItemStyle.HorizontalAlign = alignment; dgc.HeaderStyle.HorizontalAlign = alignment; // Append the header text to the column dgc.HeaderText = headerText; // Create the datafield to be used in the dataset dgc.DataField = dataField; // Set the dataformat of the column dgc.DataFormatString = dataFormatString; // Set the column visibility dgc.Visible = visible; // Add the column to the grid grdConfig.Columns.AddAt(colAddNo, dgc); colAddNo++; }
private AlignAttribute(string text, HorizontalAlign horizontalAlign) { _horizontalAlign = horizontalAlign; Text = text; }
TableCell CreateCell (Control c0, Control c1, Style s, HorizontalAlign align) { TableCell cell = CreateCell (c0, c1, s); cell.HorizontalAlign = align; return cell; }
private static TableRow CreateDoubleSpannedColumnRow(HorizontalAlign? cellHorizontalAlignment, params Control[] cellControls) { TableRow row = CreateTableRow(); TableCell cell = CreateTableCell(); cell.ColumnSpan = 2; if (cellHorizontalAlignment.HasValue) { cell.HorizontalAlign = cellHorizontalAlignment.Value; } foreach (Control control in cellControls) { cell.Controls.Add(control); } row.Cells.Add(cell); return row; }