public kListColumn(string title, int width, ColumnAlignment alignment, string format) { this.Title = title; this.Width = width; this.Alignment = alignment; this.Format = format; }
public DocumentColumn(PropertyInfo propertyInfo, string header, Func <object> getDefaultValueFunc, int columnWidth, ColumnAlignment alignment, string stringFormat, IFormatProvider provider, string booleanTrue, string booleanFalse, Func <string, object> importFunc, Func <T, object, string> exportFunc, char fillChar, bool throwOnColumnOverflow, bool exportQuotedString) { _propertyInfo = propertyInfo; Header = header; _getDefaultValueFunc = getDefaultValueFunc; _stringFormat = stringFormat; _provider = provider; ColumnWidth = columnWidth; Alignment = alignment; _booleanTrue = booleanTrue; _booleanFalse = booleanFalse; _importFunc = importFunc; _exportFunc = exportFunc; _fillChar = fillChar; _throwOnColumnOverflow = throwOnColumnOverflow; _exportQuotedString = exportQuotedString; if (_propertyInfo != null) { _getValueFunc = _propertyInfo.GetValueGetter <T>(); Header = Header ?? _propertyInfo.Name; _type = _propertyInfo.PropertyType; } else { _isDummyColumn = true; _getValueFunc = x => ""; Header = Header ?? ""; } }
public ScriptColumn(string label, ScriptBlock script, ColumnAlignment alignment, int width, string tag, TrimLocation trimLocation, bool captureContext) : base(alignment, width, tag, trimLocation) { if (String.IsNullOrEmpty(label)) { throw new ArgumentException("You must supply a column label.", "label"); } if (null == script) { throw new ArgumentNullException("script"); } m_label = label; Script = script; if (captureContext) { Context = DbgProvider.CapturePsContext(); } } // end constructor
public kListColumn(string title, int width, ColumnAlignment alignment, string format) { Title = title; Width = width; Alignment = alignment; Format = format; }
public PropertyColumn(string propertyName, ColorString formatString, ColumnAlignment alignment, int width) : this(propertyName, formatString, null, alignment, width) { }
public ScriptColumn(string label, ScriptBlock script, ColumnAlignment alignment, int width) : this(label, script, alignment, width, null) { }
public ColumnDetail(string name, float width, ColumnAlignment alignment = ColumnAlignment.Left, ColumnType columnType = ColumnType.TextBox) { ColumnName = name; ColumnWidth = width; TypeofColumn = columnType; #if __PC__ switch (alignment) { case ColumnAlignment.Left: Alignment = DataGridViewContentAlignment.MiddleLeft; break; case ColumnAlignment.Right: Alignment = DataGridViewContentAlignment.MiddleRight; break; case ColumnAlignment.Center: Alignment = DataGridViewContentAlignment.MiddleCenter; break; } #elif __MACOS__ switch (alignment) { case ColumnAlignment.Left: Alignment = NSTextAlignment.Left; break; case ColumnAlignment.Right: Alignment = NSTextAlignment.Right; break; case ColumnAlignment.Center: Alignment = NSTextAlignment.Center; break; } #endif }
public ScriptColumn(string label, ScriptBlock script, ColumnAlignment alignment, int width, string tag) : this(label, script, alignment, width, tag, TrimLocation.Right) { }
public ColumnDesign(string label, ColumnAlignment alignment, int autoWrap) { this.label = label; this.alignment = alignment; initialWidth = label.Length; width = initialWidth; display = true; autoWrapCol = autoWrap; }
public PropertyColumn(string propertyName, ColorString formatString, string label, ColumnAlignment alignment, int width, string tag) : this(propertyName, formatString, label, alignment, width, tag, TrimLocation.Right) { }
/// <summary> /// Returns a Rectangle that specifies the size and location of the Color /// rectangle /// </summary> /// <param name="rowAlignment">The alignment of the Cells Row</param> /// <param name="columnAlignment">The alignment of the Cells Column</param> /// <returns>A Rectangle that specifies the size and location of the Color /// rectangle</returns> protected Rectangle CalcColorRect(RowAlignment rowAlignment, ColumnAlignment columnAlignment) { Rectangle rect = this.ClientRectangle; rect.X += 2; rect.Y += 2; rect.Height -= 6; rect.Width = 16; return(rect); }
public ColumnInfo(string header, ColumnAlignment alignment = ColumnAlignment.Left) { if (string.IsNullOrWhiteSpace(header)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(header)); } this.Header = header; this.Alignment = alignment; this.CurrentLength = header.Length; }
/// <summary> /// Returns a Rectangle that specifies the size and location of the Color /// rectangle /// </summary> /// <param name="rowAlignment">The alignment of the Cells Row</param> /// <param name="columnAlignment">The alignment of the Cells Column</param> /// <returns>A Rectangle that specifies the size and location of the Color /// rectangle</returns> protected Rectangle CalcColorRect(RowAlignment rowAlignment, ColumnAlignment columnAlignment) { Rectangle rect = this.ClientRectangle; rect.X += 2; rect.Y += 2; rect.Height -= 6; rect.Width = 16; return rect; }
/// <summary> /// Initializes a new instance of the <see cref="TableColumn"/> class. /// </summary> public TableColumn( string property, MethodInfo method = null, ColumnAlignment alignment = ColumnAlignment.Left, int width = 0, string label = null) { Property = property; Method = method; Alignment = alignment; Width = width; Label = label; }
protected string FormatString(string text, char fillchar, int len, ColumnAlignment alignment) { // Console.Out.WriteLine("[formatString] len: " + len + ", text.Length: " + text.Length); // text = "hi"; StringBuilder fillstr = new StringBuilder(); if (len > 4000) { len = 4000; } if (text == null) { text = ColumnValue.NullText; } int slen = text.Length; if (alignment == ColumnAlignment.Left) { fillstr.Append(text); } int fillNumber = len - slen; int boundary = 0; if (alignment == ColumnAlignment.Center) { boundary = fillNumber / 2; } while (fillNumber > boundary) { fillstr.Append(fillchar); --fillNumber; } if (alignment != ColumnAlignment.Left) { fillstr.Append(text); } while (fillNumber > 0) { fillstr.Append(fillchar); --fillNumber; } return(fillstr.ToString()); }
public Footer(ColumnAlignment alignment, ScriptBlock script, bool captureContext) { if (null == script) { throw new ArgumentNullException("script"); } Alignment = alignment; Script = script; if (captureContext) { Context = DbgProvider.CapturePsContext(); } }
/// <summary> /// Defines the style details for the column /// </summary> /// <param name="title">The title</param> /// <param name="alignment">The text alignment</param> /// <param name="importance">The importance</param> /// <param name="noWrap">True, if the cell text shouldn't word wrap</param> public virtual void DefineStyle ( string title, ColumnAlignment alignment, DataImportance importance = default, bool noWrap = false ) { this.Title = title; this.Alignment = alignment; this.Importance = importance; this.NoWrap = noWrap; this.HasStyling = true; }
public void AddColumn(string title, int width, ColumnAlignment alignment, string format) { columns.Add(new kListColumn(title, width, alignment, format)); formatString = string.Empty; totalWidth += width; if (alignment == ColumnAlignment.Left) { headerString += title.Substring(0, Math.Min(width, title.Length)).PadRight(width); } else { headerString += title.Substring(0, Math.Min(width, title.Length)).PadLeft(width); } }
public TableStyle(char top = '-', char right = '|', char bottom = '-', char left = '|', string separator = " | ", bool titleBorder = false, ColumnAlignment titleAlignment = ColumnAlignment.Left) { Top = top; Right = right; Bottom = bottom; Left = left; Separator = separator; TitleBorder = titleBorder; TitleAlignment = titleAlignment; }
public ScriptColumn(string label, ScriptBlock script, ColumnAlignment alignment, int width, string tag, TrimLocation trimLocation) : base(alignment, width, tag, trimLocation) { if (String.IsNullOrEmpty(label)) { throw new ArgumentException("You must supply a column label.", nameof(label)); } Label = label; Script = script ?? throw new ArgumentNullException(nameof(script)); } // end constructor
public ColumnInfo(string header, ColumnAlignment alignment = ColumnAlignment.Left, int fixedLength = 0) { if (string.IsNullOrWhiteSpace(header)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(header)); } if (header.ToCharArray().Any(ch => ch.IsSystemChar())) { throw new ArgumentException("Header name cannot contain special characters.", nameof(header)); } this.Header = header; this.Alignment = alignment; this.CurrentLength = header.Length; this.FixedLength = fixedLength; }
private static XLAlignmentHorizontalValues MapAlignment(ColumnAlignment alignment) { switch (alignment) { case ColumnAlignment.Center: return(XLAlignmentHorizontalValues.Center); case ColumnAlignment.Left: return(XLAlignmentHorizontalValues.Left); case ColumnAlignment.Right: return(XLAlignmentHorizontalValues.Right); default: return(XLAlignmentHorizontalValues.Left); } }
private static string ColumnAlignToString(this ColumnAlignment ca) { switch (ca) { case ColumnAlignment.Left: return("left"); case ColumnAlignment.Right: return("right"); case ColumnAlignment.Center: return("center"); default: return("left"); } }
private static ParagraphAlignment MapAlignment(ColumnAlignment alignment) { switch (alignment) { case ColumnAlignment.Center: return(ParagraphAlignment.Center); case ColumnAlignment.Left: return(ParagraphAlignment.Left); case ColumnAlignment.Right: return(ParagraphAlignment.Right); default: return(ParagraphAlignment.Left); } }
public GridColumn(string title, Func <T, string> source, ColumnWidth minWidth, ColumnWidth maxWidth = null, ColumnAlignment alignment = ColumnAlignment.Left, Func <T, string> dynamicStyle = null) { Title = title; Source = source; MinWidth = minWidth; DynamicStyle = dynamicStyle; if (maxWidth != null) { MaxWidth = maxWidth; } Alignment = alignment; }
public PropertyColumn(string propertyName, ColorString formatString, string label, ColumnAlignment alignment, int width, string tag, TrimLocation trimLocation) : base(alignment, width, tag, trimLocation) { if (String.IsNullOrEmpty(propertyName)) { throw new ArgumentException("You must supply a property name.", "propertyname"); } PropertyName = propertyName; FormatString = formatString; m_label = label; } // end constructor
/// <summary> /// Initialise default values /// </summary> private void Init() { this.text = null; this.width = Column.DefaultWidth; this.columnState = ColumnState.Normal; this.alignment = ColumnAlignment.Left; this.image = null; this.imageOnRight = false; this.columnModel = null; this.x = 0; this.tooltipText = null; this.format = ""; this.sortOrder = SortOrder.None; this.renderer = null; this.editor = null; this.comparer = null; this.state = (byte)(STATE_ENABLED | STATE_EDITABLE | STATE_VISIBLE | STATE_SELECTABLE | STATE_SORTABLE); }
/// <summary> /// Applies style configuration to a table column definition /// </summary> /// <param name="columnName">The column name</param> /// <param name="title">The title</param> /// <param name="alignment">The text alignment</param> /// <param name="importance">The importance</param> /// <param name="noWrap">True, if the cell text shouldn't word wrap</param> public void StyleColumn ( string columnName, string title, ColumnAlignment alignment, DataImportance importance = default, bool noWrap = false ) { var column = GetColumn(columnName); column.DefineStyle ( title, alignment, importance, noWrap ); }
/// <summary> /// Constructs the table column with the details /// </summary> /// <param name="name">The column name</param> /// <param name="title">The title</param> /// <param name="alignment">The alignment (optional)</param> /// <param name="importance">The importance (optional)</param> /// <param name="noWrap">Should text be wrapped (optional)</param> public TableColumn ( string name, string title, ColumnAlignment alignment = default, DataImportance importance = default, bool noWrap = false ) { Validate.IsNotEmpty(name); Validate.IsNotEmpty(title); this.ColumnId = Guid.NewGuid(); this.Name = name; this.Title = title; this.Alignment = alignment; this.Importance = importance; this.NoWrap = noWrap; }
/// <summary> /// Gets the Rectangle that specifies the Size and Location of /// the check box contained in the current Cell /// </summary> /// <returns>A Rectangle that specifies the Size and Location of /// the check box contained in the current Cell</returns> protected Rectangle CalcCheckRect(RowAlignment rowAlignment, ColumnAlignment columnAlignment) { Rectangle checkRect = new Rectangle(this.ClientRectangle.Location, this.CheckSize); if (checkRect.Height > this.ClientRectangle.Height) { checkRect.Height = this.ClientRectangle.Height; checkRect.Width = checkRect.Height; } switch (rowAlignment) { case RowAlignment.Center: { checkRect.Y += (this.ClientRectangle.Height - checkRect.Height) / 2; break; } case RowAlignment.Bottom: { checkRect.Y = this.ClientRectangle.Bottom - checkRect.Height; break; } } if (!this.DrawText) { if (columnAlignment == ColumnAlignment.Center) { checkRect.X += (this.ClientRectangle.Width - checkRect.Width) / 2; } else if (columnAlignment == ColumnAlignment.Right) { checkRect.X = this.ClientRectangle.Right - checkRect.Width; } } return(checkRect); }
/// <summary> /// Gets the Rectangle that specifies the Size and Location of /// the check box contained in the current Cell /// </summary> /// <returns>A Rectangle that specifies the Size and Location of /// the check box contained in the current Cell</returns> protected Rectangle CalcCheckRect(RowAlignment rowAlignment, ColumnAlignment columnAlignment) { Rectangle checkRect = new Rectangle(this.ClientRectangle.Location, this.CheckSize); if (checkRect.Height > this.ClientRectangle.Height) { checkRect.Height = this.ClientRectangle.Height; checkRect.Width = checkRect.Height; } switch (rowAlignment) { case RowAlignment.Center: { checkRect.Y += (this.ClientRectangle.Height - checkRect.Height) / 2; break; } case RowAlignment.Bottom: { checkRect.Y = this.ClientRectangle.Bottom - checkRect.Height; break; } } if (!this.DrawText) { if (columnAlignment == ColumnAlignment.Center) { checkRect.X += (this.ClientRectangle.Width - checkRect.Width) / 2; } else if (columnAlignment == ColumnAlignment.Right) { checkRect.X = this.ClientRectangle.Right - checkRect.Width; } } return checkRect; }
/// <summary> /// Initialise default values /// </summary> private void Init() { this.text = null; this.width = Column.DefaultWidth; this.columnState = ColumnState.Normal; this.alignment = ColumnAlignment.Left; this.image = null; this.imageOnRight = false; this.columnModel = null; this.x = 0; this.tooltipText = null; this.format = ""; this.sortOrder = SortOrder.None; this.renderer = null; this.editor = null; this.comparer = null; // Mateusz [PEYN] Adamus ([email protected]) // Added STATE_RESIZABLE to column's initialization this.state = (byte)(STATE_ENABLED | STATE_EDITABLE | STATE_VISIBLE | STATE_SELECTABLE | STATE_SORTABLE | STATE_RESIZABLE); }
/// <summary> /// Initializes a new instance of the CellStyle class with default settings and a specific Alignment /// </summary> /// <param name="alignment"></param> public CellStyle(ColumnAlignment alignment) : this() { this.Alignment = alignment; }
Rectangle CalcCheckRect(RowAlignment rowAlignment, ColumnAlignment columnAlignment) { return CalcCheckRectangle(); }
/// <summary> /// Initialise default values /// </summary> private void Init() { this.text = null; this.width = Column.DefaultWidth; this.columnState = ColumnState.Normal; this.alignment = ColumnAlignment.Left; this.image = null; this.imageOnRight = false; this.columnModel = null; this.x = 0; this.tooltipText = null; this.format = ""; this.sortOrder = SortOrder.None; this.renderer = null; this.editor = null; this.comparer = null; // Mateusz [PEYN] Adamus ([email protected]) // Added STATE_RESIZABLE to column's initialization this.state = (byte) (STATE_ENABLED | STATE_EDITABLE | STATE_VISIBLE | STATE_SELECTABLE | STATE_SORTABLE | STATE_RESIZABLE ); }
/// <summary> /// Initialise default values /// </summary> private void Init() { this.text = null; this.width = Column.DefaultWidth; this.columnState = ColumnState.Normal; this.alignment = ColumnAlignment.Left; this.image = null; this.imageOnRight = false; this.columnModel = null; this.x = 0; this.tooltipText = null; this.format = ""; this.sortOrder = SortOrder.None; this.renderer = null; this.editor = null; this.comparer = null; this.state = (byte) (STATE_ENABLED | STATE_EDITABLE | STATE_VISIBLE | STATE_SELECTABLE | STATE_SORTABLE); }
public ColumnDesign(string label, ColumnAlignment alignment) : this(label, alignment, -1) { }
/// <summary> /// Gets the Rectangle that specifies the Size and Location of /// the Image contained in the current Cell /// </summary> /// <param name="image">The Image to be drawn</param> /// <param name="sizeMode">An ImageSizeMode that specifies how the /// specified Image is scaled</param> /// <param name="rowAlignment">The alignment of the current Cell's row</param> /// <param name="columnAlignment">The alignment of the current Cell's Column</param> /// <returns>A Rectangle that specifies the Size and Location of /// the Image contained in the current Cell</returns> protected Rectangle CalcImageRect(Image image, ImageSizeMode sizeMode, RowAlignment rowAlignment, ColumnAlignment columnAlignment) { if (this.DrawText) { sizeMode = ImageSizeMode.ScaledToFit; } Rectangle imageRect = this.ClientRectangle; if (sizeMode == ImageSizeMode.Normal) { if (image.Width < imageRect.Width) { imageRect.Width = image.Width; } if (image.Height < imageRect.Height) { imageRect.Height = image.Height; } } else if (sizeMode == ImageSizeMode.ScaledToFit) { if (image.Width >= imageRect.Width || image.Height >= imageRect.Height) { double hScale = ((double) imageRect.Width) / ((double) image.Width); double vScale = ((double) imageRect.Height) / ((double) image.Height); double scale = Math.Min(hScale, vScale); imageRect.Width = (int) (((double) image.Width) * scale); imageRect.Height = (int) (((double) image.Height) * scale); } else { imageRect.Width = image.Width; imageRect.Height = image.Height; } } if (rowAlignment == RowAlignment.Center) { imageRect.Y += (this.ClientRectangle.Height - imageRect.Height) / 2; } else if (rowAlignment == RowAlignment.Bottom) { imageRect.Y = this.ClientRectangle.Bottom - imageRect.Height; } if (!this.DrawText) { if (columnAlignment == ColumnAlignment.Center) { imageRect.X += (this.ClientRectangle.Width - imageRect.Width) / 2; } else if (columnAlignment == ColumnAlignment.Right) { imageRect.X = this.ClientRectangle.Width - imageRect.Width; } } return imageRect; }
protected string FormatString(string text, char fillchar, int len, ColumnAlignment alignment) { // Console.Out.WriteLine("[formatString] len: " + len + ", text.Length: " + text.Length); // text = "hi"; StringBuilder fillstr = new StringBuilder(); if (len > 4000) len = 4000; if (text == null) text = ColumnValue.NullText; int slen = text.Length; if (alignment == ColumnAlignment.Left) fillstr.Append(text); int fillNumber = len - slen; int boundary = 0; if (alignment == ColumnAlignment.Center) boundary = fillNumber / 2; while (fillNumber > boundary) { fillstr.Append(fillchar); --fillNumber; } if (alignment != ColumnAlignment.Left) fillstr.Append(text); while (fillNumber > 0) { fillstr.Append(fillchar); --fillNumber; } return fillstr.ToString(); }
public void AddColumn(string title, int width, ColumnAlignment alignment) { AddColumn(title, width, alignment, string.Empty); }