void SetFont(TextBlock textBlock, TextStyleDecorator styleDecorator) { textBlock.FontFamily = new FontFamily(styleDecorator.Font.FontFamily.Name); var b = styleDecorator.Font.Size; textBlock.FontSize = b * 96 / 72; if (styleDecorator.Font.Bold) { textBlock.FontWeight = FontWeights.Bold; } if (styleDecorator.Font.Underline) { CreateUnderline(textBlock, styleDecorator); } if (styleDecorator.Font.Italic) { textBlock.FontStyle = System.Windows.FontStyles.Italic; } if (styleDecorator.Font.Strikeout) { CreateStrikeout(textBlock, styleDecorator); } }
Pen CreateWpfPen(TextStyleDecorator styleDecorator) { Pen myPen = new Pen(); myPen.Brush = ConvertBrush(styleDecorator.ForeColor); myPen.Thickness = 1.5; return(myPen); }
public virtual BaseExportColumn CreateExportColumn() { TextStyleDecorator st = this.CreateItemStyle(); ExportText item = new ExportText(st, false); item.Text = this.text; return(item); }
public new IBaseExportColumn CreateExportColumn() { TextStyleDecorator st = base.CreateItemStyle(); ExportText item = new ExportText(st); item.Text = StandardFormatter.FormatOutput(DBValue, this.FormatString, base.DataType, this.NullValue); return(item); }
void CreateUnderline(TextBlock textBlock, TextStyleDecorator styleDecorator) { TextDecoration underLine = new TextDecoration(); Pen p = CreateWpfPen(styleDecorator); underLine.Pen = p; underLine.PenThicknessUnit = TextDecorationUnit.FontRecommended; textBlock.TextDecorations.Add(underLine); }
public override IBaseExportColumn CreateExportColumn() { this.SetErrorLayout(); TextStyleDecorator st = base.CreateItemStyle(); ExportText item = new ExportText(st); item.Text = this.errMess; return(item); }
public virtual IBaseExportColumn CreateExportColumn() { TextStyleDecorator st = this.CreateItemStyle(); ExportText item = new ExportText(st); item.Text = this.text; item.Expression = this.Expression; return(item); }
public new BaseExportColumn CreateExportColumn() { string toPrint = CheckForNullValue(); TextStyleDecorator st = base.CreateItemStyle(); ExportText item = new ExportText(st, false); item.Text = StandardFormatter.FormatOutput(toPrint, this.FormatString, base.DataType, this.NullValue); return(item); }
void CreateStrikeout(TextBlock textBlock, TextStyleDecorator styleDecorator) { TextDecoration strikeOut = new TextDecoration(); strikeOut.Location = TextDecorationLocation.Strikethrough; Pen p = CreateWpfPen(styleDecorator); strikeOut.Pen = p; strikeOut.PenThicknessUnit = TextDecorationUnit.FontRecommended; textBlock.TextDecorations.Add(strikeOut); }
private void SetContendAlignment(TextBlock textBlock, TextStyleDecorator decorator) { switch (decorator.ContentAlignment) { case ContentAlignment.TopLeft: textBlock.VerticalAlignment = VerticalAlignment.Top; textBlock.TextAlignment = TextAlignment.Left; break; case ContentAlignment.TopCenter: textBlock.VerticalAlignment = VerticalAlignment.Top; textBlock.TextAlignment = TextAlignment.Center; break; case ContentAlignment.TopRight: textBlock.VerticalAlignment = VerticalAlignment.Top; textBlock.TextAlignment = TextAlignment.Right; break; // Middle case ContentAlignment.MiddleLeft: textBlock.VerticalAlignment = VerticalAlignment.Center; textBlock.TextAlignment = TextAlignment.Left; break; case ContentAlignment.MiddleCenter: textBlock.VerticalAlignment = VerticalAlignment.Center; textBlock.TextAlignment = TextAlignment.Center; break; case ContentAlignment.MiddleRight: textBlock.VerticalAlignment = VerticalAlignment.Center; textBlock.TextAlignment = TextAlignment.Right; break; //Bottom case ContentAlignment.BottomLeft: textBlock.VerticalAlignment = VerticalAlignment.Bottom; textBlock.TextAlignment = TextAlignment.Left; break; case ContentAlignment.BottomCenter: textBlock.VerticalAlignment = VerticalAlignment.Bottom; textBlock.TextAlignment = TextAlignment.Center; break; case ContentAlignment.BottomRight: textBlock.VerticalAlignment = VerticalAlignment.Bottom; textBlock.TextAlignment = TextAlignment.Right; break; } }
protected TextStyleDecorator CreateItemStyle() { TextStyleDecorator style = new TextStyleDecorator(); style.BackColor = this.BackColor; style.ForeColor = this.ForeColor; style.Font = this.Font; style.Location = this.Location; style.Size = this.Size; style.DrawBorder = this.DrawBorder; style.StringFormat = this.stringFormat; style.StringTrimming = this.stringTrimming; style.ContentAlignment = this.contentAlignment; style.FormatString = this.formatString; style.DataType = this.dataType; return(style); }