private string Align(string str, int size, TextAlignEnum txtAlign) { size = size - 1; switch (txtAlign) { case TextAlignEnum.Left: str = str.PadRight(size); break; case TextAlignEnum.Center: int fillLength = size - str.Length; int halfFillLength = fillLength / 2; str = str.PadLeft(str.Length + halfFillLength); str = str.PadRight(size); break; case TextAlignEnum.Right: str = str.PadLeft(size); break; default: str = str.PadRight(size); break; } return(" " + str); //Space for padding }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; FontSize = 10; FontWeight = FontWeightEnum.Normal; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant = 1; }
private void leftAlignToolStripButton2_Click(object sender, EventArgs e) { TextAlignEnum ta = TextAlignEnum.General; if (sender == leftAlignToolStripButton2) { ta = TextAlignEnum.Left; leftAlignToolStripButton2.Checked = true; rightAlignToolStripButton3.Checked = centerAlignToolStripButton2.Checked = false; } else if (sender == rightAlignToolStripButton3) { ta = TextAlignEnum.Right; rightAlignToolStripButton3.Checked = true; leftAlignToolStripButton2.Checked = centerAlignToolStripButton2.Checked = false; } else if (sender == centerAlignToolStripButton2) { ta = TextAlignEnum.Center; centerAlignToolStripButton2.Checked = true; rightAlignToolStripButton3.Checked = leftAlignToolStripButton2.Checked = false; } ApplyStyleToSelected("TextAlign", ta.ToString()); SetProperties(); }
/// <summary> /// Gets the text alignment. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextAlignEnum GetTextAlign(string v, TextAlignEnum def) { TextAlignEnum ta; switch (v.ToLower()) { case "left": ta = TextAlignEnum.Left; break; case "right": ta = TextAlignEnum.Right; break; case "center": ta = TextAlignEnum.Center; break; case "general": ta = TextAlignEnum.General; break; default: ta = def; break; } return(ta); }
}//End Function public Texture2D DrawTextBox(GraphicsDevice Device, string Text, Point BoundingSize, TextAlignEnum Align = TextAlignEnum.Left, int RowStride = 0, int ColumnStride = 0) { Texture2D result; MeasureBoxResult tmpMR = new MeasureBoxResult(this, BoundingSize, Text.Length, RowStride, ColumnStride); for (int t = 0; t < Text.Length; t++) { accessHzk(Text[t], (d) => { tmpMR.AddAsc(d); }, (d) => { tmpMR.AddHzk(d); }, () => {; }, () => { tmpMR.AddCrlf(); }); }//Next Char result = tmpMR.Render(Device, Align); return(result); }
string GetAlignment(TextAlignEnum ta) { switch (ta) { case TextAlignEnum.Center: return("center"); case TextAlignEnum.Right: return("right"); case TextAlignEnum.Left: return("left"); default: return("general"); } }
/// <summary> /// Gets the text alignment. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextAlignEnum GetTextAlign(string v, TextAlignEnum def) { TextAlignEnum ta; try { ta = (TextAlignEnum)Enum.Parse(typeof(TextAlignEnum), System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(v)); } catch { ta = def; } return(ta); }
/// <summary> /// Gets the text alignment. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextAlignEnum GetTextAlign(string v, TextAlignEnum def) { TextAlignEnum ta; try { ta = (TextAlignEnum)Enum.Parse(typeof(TextAlignEnum), v); } catch { ta = def; } return(ta); }
public HorizontalAlignment ConvertHorizontalAlignment(TextAlignEnum ha) { switch (ha) { case TextAlignEnum.Center: return(HorizontalAlignment.Center); case TextAlignEnum.Right: return(HorizontalAlignment.Right); case TextAlignEnum.Justified: return(HorizontalAlignment.Justify); default: return(HorizontalAlignment.Left); } }
//==bool pAllowTruncation: if true throw exception on text is truncated/clipped. public static string PadText(string pText, int pWidth, TextAlignEnum pAlign, string pPadChar) { string temp = ""; switch (pAlign) { case TextAlignEnum.Left: temp = AlignTextLeft(pText, pWidth, pPadChar); break; case TextAlignEnum.Right: temp = AlignTextRight(pText, pWidth, pPadChar); break; case TextAlignEnum.Center: // break; } return(temp); }
/// <summary> /// 컬럼 추가 Edit Control 지정 /// </summary> /// <param name="colName">컬럼 명</param> /// <param name="caption">해더명</param> /// <param name="width">길이</param> /// <param name="colAlign">데이터 정렬</param> /// <param name="readOnly">읽기 전용</param> /// <param name="control">컬럼 바인딩 컨트롤</param> /// <param name="format">컬럼 보기 형식</param> public static void x_AddColumnControl(this C1FlexGrid flexGrid, string colName, string caption, int width, string format , TextAlignEnum colAlign, bool readOnly, Control control) { Column column = flexGrid.Cols.Add(); column.Caption = caption; column.Name = colName; if (width != -1) { column.Width = width; } if (readOnly) { column.AllowEditing = false; column.Style = flexGrid.Styles[StyleType.ReadOnlyCell.ToString()]; } else { column.AllowEditing = true; column.Style = flexGrid.Styles[StyleType.DefaultCell.ToString()]; } // 컬럼 스타일 명 변경 string styleName = Guid.NewGuid().ToString("N"); CellStyle style = flexGrid.Styles.Add(styleName, column.Style); column.Style = style; column.TextAlign = colAlign; column.AllowEditing = !readOnly; if (!string.IsNullOrEmpty(format)) { column.Format = format; } column.Editor = control; }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; //WRP 291008 numFmtId should be 0 (Zero) for General format - will be interpreted as a string //It has default values in Excel07 as per ECMA-376 standard (SEction 3.8.30) for Office Open XML Excel07 _Format = "General"; FontSize = 10; FontWeight = FontWeightEnum.Normal; PatternType = patternTypeEnum.None; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant = 1; }
public static void x_AddColumn(this C1FlexGrid flexGrid, string colName, string caption, bool hidden , int width, Type columnDataType, TextAlignEnum headerAlign, TextAlignEnum colAlign , bool readOnly, string format) { Column column = flexGrid.Cols.Add(); column.Name = colName; column.Caption = caption; if (readOnly) { column.AllowEditing = false; //column.Style = flexGrid.GetStyle(StyleType.ReadOnlyCell); } else { column.AllowEditing = true; //column.Style = flexGrid.GetStyle(StyleType.DefaultCell); } column.TextAlign = colAlign; column.TextAlignFixed = headerAlign; if (columnDataType != null) { column.DataType = columnDataType; } column.Visible = !hidden; column.Width = width; if (!string.IsNullOrEmpty(format)) { column.Format = format; } }
public static void x_AddColumn(this C1FlexGrid flexGrid, string colName, string caption, bool hidden, int width, TextAlignEnum colAlign, bool readOnly) { x_AddColumn(flexGrid, colName, caption, hidden, width, colAlign, readOnly, ""); }
/// <summary> /// Gets the text alignment. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextAlignEnum GetTextAlign(string v, TextAlignEnum def) { TextAlignEnum ta; try { ta = (TextAlignEnum)Enum.Parse(typeof(TextAlignEnum), v); } catch { ta = def; } return ta; }
public void Align(TextAlignEnum ta) { if (_DrawPanel.SelectedCount < 1) return; _Undo.StartUndoGroup(Strings.DesignCtl_Undo_Align); _Undo.EndUndoGroup(); return; }
private FormBlock AddBlock(FormPage page, decimal x, decimal y, decimal width, string text, TextAlignEnum textAlign) { decimal xScale = 0.1m; decimal yScale = 0.1685m; var block = new FormBlock { TextAlign = textAlign, Left = -0.21m + xScale * x, Top = 0.1m + yScale * y, Width = xScale * width, Height = yScale * 1.1m, Text = text }; page.Blocks.Add(block); return(block); }
internal Texture2D Render(GraphicsDevice Device, TextAlignEnum Align) { LineWidth.Add(Math.Max(0, CurrentX - ColumnStride)); int tmpw, tmph; int tmpx = 0, tmpl = 0; tmpw = Math.Max(LineWidth.Max(), 1); tmph = CurrentY + MyHzk.MyHzkSize; if (tmpw > _maxTextureSize || tmph > _maxTextureSize) { throw new ArgumentException("Texture size too big, maybe there were too much Characters.", "Text"); } uint[] tmpData = new uint[tmpw * tmph]; for (int t = 0; t < CharData.Count; t++) { if (tmpl < LineStartIndex.Count && t == LineStartIndex[tmpl]) { switch (Align & (TextAlignEnum.Middle | TextAlignEnum.Right)) { case TextAlignEnum.Middle: tmpx = (tmpw - LineWidth[tmpl]) / 2; break; case TextAlignEnum.Right: tmpx = (tmpw - LineWidth[tmpl]); break; default: tmpx = 0; break; } tmpl++; } if (CharType[t] == hzkResult.asc) { for (int y = 0; y < MyHzk.MyHzkSize; y++) { for (int tt = 0; tt < MyHzk.MyAscStride; tt++) { for (int x = 0; x < 8; x++) { tmpData[(y + (int)CharPosition[t].Y) * tmpw + tt * 8 + x + (int)CharPosition[t].X + tmpx] = ((CharData[t][y * MyHzk.MyAscStride + tt] & (128 >> x)) > 0 ? Color.White.PackedValue : Color.Transparent.PackedValue); } } } } else if (CharType[t] == hzkResult.hzk) { for (int y = 0; y < MyHzk.MyHzkSize; y++) { for (int tt = 0; tt < MyHzk.MyHzkStride; tt++) { for (int x = 0; x < 8; x++) { tmpData[(y + (int)CharPosition[t].Y) * tmpw + tt * 8 + x + (int)CharPosition[t].X + tmpx] = ((CharData[t][y * MyHzk.MyHzkStride + tt] & (128 >> x)) > 0 ? Color.White.PackedValue : Color.Transparent.PackedValue); } } } } //End If Asc/Hzk } //Next Char Texture2D result = new Texture2D(Device, tmpw, tmph); result.SetData <uint>(tmpData); return(result); } //End Function
public static void x_AddColumn(this C1FlexGrid flexGrid, string colName, string caption, bool hidden, int width, Type columnDataType, TextAlignEnum colAlign, bool readOnly, string format) { x_AddColumn(flexGrid, colName, caption, hidden, width, columnDataType, TextAlignEnum.CenterCenter, colAlign, readOnly, format); }
public void SetTextAlign(TextAlignEnum textAlign) { horizontalAlign = textAlign; }
public static void x_AddColumn(this C1FlexGrid flexGrid, string colName, string caption, bool hidden, int width, TextAlignEnum headerAlign, TextAlignEnum colAlign, bool readOnly, string format) { x_AddColumn(flexGrid, colName, caption, hidden, width, null, headerAlign, colAlign, readOnly, format); }
public static void x_AddColumn(this C1FlexGrid flexGrid, string colName, string caption, bool hidden, int width, TextAlignEnum colAlign) { x_AddColumn(flexGrid, colName, caption, hidden, width, colAlign, false); }
/// <summary> /// Used to position text within the cell relative to image. /// This method assumes that the cell (represented by a RenderArea) contains /// both image and text, and that the image (RenderImage) is the first child /// within the render area (referenced by "prev" in position strings). /// </summary> /// <param name="rtxt"></param> /// <param name="ta"></param> /// <param name="ion"></param> private void AlignText(RenderObject rtxt, TextAlignEnum ta, ImageOn ion) { switch (ta) { case TextAlignEnum.LeftTop: rtxt.X = ion == ImageOn.Left ? "prev.right" : "0"; rtxt.Y = ion == ImageOn.Top ? "prev.bottom" : "0"; break; case TextAlignEnum.LeftCenter: rtxt.X = ion == ImageOn.Left ? "prev.right" : "0"; rtxt.Y = ion == ImageOn.Top ? "prev.bottom + (parent.height - prev.height - height) / 2" : (ion == ImageOn.Bottom ? "(parent.height - prev.height - height) / 2" : "(parent.height - height) / 2"); break; case TextAlignEnum.LeftBottom: rtxt.X = ion == ImageOn.Left ? "prev.right" : "0"; rtxt.Y = ion == ImageOn.Bottom ? "prev.top - height" : "parent.height - height"; break; case TextAlignEnum.CenterTop: rtxt.X = ion == ImageOn.Left ? "prev.right + (parent.width - prev.width - width) / 2" : (ion == ImageOn.Right ? "(parent.width - prev.width - width) / 2" : "(parent.width - width) / 2"); rtxt.Y = ion == ImageOn.Top ? "prev.bottom" : "0"; break; case TextAlignEnum.CenterCenter: rtxt.X = ion == ImageOn.Left ? "prev.right + (parent.width - prev.width - width) / 2" : (ion == ImageOn.Right ? "(parent.width - prev.width - width) / 2" : "(parent.width - width) / 2"); rtxt.Y = ion == ImageOn.Top ? "prev.bottom + (parent.height - prev.height - height) / 2" : (ion == ImageOn.Bottom ? "(parent.height - prev.height - height) / 2" : "(parent.height - height) / 2"); break; case TextAlignEnum.CenterBottom: rtxt.X = ion == ImageOn.Left ? "prev.right + (parent.width - prev.width - width) / 2" : (ion == ImageOn.Right ? "(parent.width - prev.width - width) / 2" : "(parent.width - width) / 2"); rtxt.Y = ion == ImageOn.Bottom ? "prev.top - height" : "parent.height - height"; break; case TextAlignEnum.RightTop: rtxt.X = ion == ImageOn.Right ? "prev.left - width" : "parent.width - width"; rtxt.Y = ion == ImageOn.Top ? "prev.bottom" : "0"; break; case TextAlignEnum.RightCenter: rtxt.X = ion == ImageOn.Right ? "prev.left - width" : "parent.width - width"; rtxt.Y = ion == ImageOn.Top ? "prev.bottom + (parent.height - prev.height - height) / 2" : (ion == ImageOn.Bottom ? "(parent.height - prev.height - height) / 2" : "(parent.height - height) / 2"); break; case TextAlignEnum.RightBottom: rtxt.X = ion == ImageOn.Right ? "prev.left - width" : "parent.width - width"; rtxt.Y = ion == ImageOn.Bottom ? "prev.top - height" : "parent.height - height"; break; default: // "general" alignments should not get here Debug.Assert(false); break; } }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; //WRP 291008 numFmtId should be 0 (Zero) for General format - will be interpreted as a string //It has default values in Excel07 as per ECMA-376 standard (SEction 3.8.30) for Office Open XML Excel07 _Format = "General"; FontSize = 10; FontWeight = FontWeightEnum.Normal; PatternType = patternTypeEnum.None; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant=1; }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; FontSize = 10; FontWeight = FontWeightEnum.Normal; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.Left; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant=1; }
public void Align(TextAlignEnum ta) { if (_DrawPanel.SelectedCount < 1) return; _Undo.StartUndoGroup("Align"); _Undo.EndUndoGroup(); return; }
public static void x_AddColumn(this C1FlexGrid flexGrid, string colName, string caption, bool hidden, int width, Type columnDataType, TextAlignEnum colAlign) { x_AddColumn(flexGrid, colName, caption, hidden, width, columnDataType, colAlign, false); }
private FormBlock AddBlock(FormPage page, decimal x, decimal y, decimal width, string text, TextAlignEnum textAlign) { decimal xScale = 0.08333m; // 0.0839m; decimal yScale = 0.16667m; // 0.1656m; var block = new FormBlock { TextAlign = textAlign, Left = 0.06m + xScale * x, Top = 0.06m + yScale * y, Width = xScale * width, Height = yScale * 1.1m, Text = text }; page.Blocks.Add(block); return block; }
/// <summary> /// Gets the text alignment. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextAlignEnum GetTextAlign(string v, TextAlignEnum def) { TextAlignEnum ta; switch(v.ToLower()) { case "left": ta = TextAlignEnum.Left; break; case "right": ta = TextAlignEnum.Right; break; case "center": ta = TextAlignEnum.Center; break; case "general": ta = TextAlignEnum.General; break; default: ta = def; break; } return ta; }
/// <summary> /// Gets the text alignment. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextAlignEnum GetTextAlign(string v, TextAlignEnum def) { TextAlignEnum ta; try { ta = (TextAlignEnum)Enum.Parse(typeof(TextAlignEnum), System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(v)); } catch { ta = def; } return ta; }
private FormBlock AddBlock(FormPage page, decimal x, decimal y, decimal width, string text, TextAlignEnum textAlign) { decimal xScale = 0.100m; // 0.0839m; decimal yScale = 0.16667m; // 0.1656m; var block = new FormBlock { LetterSpacing = "1.2px", TextAlign = textAlign, Left = 0.14m + xScale * x, Top = 0.06m + yScale * y, Width = xScale * width, Height = yScale * 1.1m, Text = text }; page.Blocks.Add(block); return(block); }