public LabelPlotStyle(Altaxo.Data.IReadableColumn labelColumn, Altaxo.Main.Properties.IReadOnlyPropertyBag context) { this._font = GraphDocument.GetDefaultFont(context); this._fontSizeOffset = _font.Size; var color = GraphDocument.GetDefaultPlotColor(context); this._independentColor = false; this._brush = new BrushX(color) { ParentObject = this }; this._backgroundColorLinkage = ColorLinkage.Independent; this.LabelColumnProxy = Altaxo.Data.ReadableColumnProxyBase.FromColumn(labelColumn); this._cachedStringFormat = new StringFormat(StringFormatFlags.NoWrap); }
public FilledRectangle(BrushX brush) { _brush = (BrushX)brush.Clone(); }
public void CopyFrom(ScatterPlotStyle from, bool suppressChangeEvent) { this._shape = from._shape; this._style = from._style; if(null==this._dropLine) this._dropLine = new CSPlaneIDList(); else this._dropLine.Clear(); this._dropLine.AddClonedRange(from._dropLine); this._pen = null == from._pen ? null : (PenX)from._pen.Clone(); this._independentColor = from._independentColor; this._independentSymbolSize = from._independentSymbolSize; this._symbolSize = from._symbolSize; this._relativePenWidth = from._relativePenWidth; this._skipFreq = from._skipFreq; this._cachedPath = null == from._cachedPath ? null : (GraphicsPath)from._cachedPath.Clone(); this._cachedFillPath = from._cachedFillPath; this._cachedFillBrush = null == from._cachedFillBrush ? null : (BrushX)from._cachedFillBrush.Clone(); this._parent = from._parent; if (!suppressChangeEvent) OnChanged(); }
protected void SetCachedValues() { _cachedPath = GetPath(this._shape, this._style, this._symbolSize); _cachedFillPath = _style == XYPlotScatterStyles.Style.Solid || _style == XYPlotScatterStyles.Style.Open || _style == XYPlotScatterStyles.Style.DotCenter; if (this._style != XYPlotScatterStyles.Style.Solid) _cachedFillBrush = new BrushX(Color.White); else if (this._pen.PenType == PenType.SolidColor) _cachedFillBrush = new BrushX(_pen.Color); else _cachedFillBrush = new BrushX(_pen.BrushHolder); }
public AxisLabelStyle(AxisLabelStyle from) { _font = null==from._font ? null : (Font)from._font.Clone(); _stringFormat = (StringFormat)from._stringFormat.Clone(); _horizontalAlignment = from._horizontalAlignment; _verticalAlignment = from._verticalAlignment; _brush = (BrushX)from._brush.Clone(); _automaticRotationShift = from._automaticRotationShift; _xOffset = from._xOffset; _yOffset = from._yOffset; _rotation = from._rotation; _backgroundStyle = null==from._backgroundStyle ? null : (IBackgroundStyle)from._backgroundStyle.Clone(); _labelFormatting = (ILabelFormatting)from._labelFormatting.Clone(); }
/// <summary> /// Draws the item to a specified location. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="brush">Brush used to draw the item.</param> /// <param name="font">Font used to draw the item.</param> /// <param name="strfmt">String format.</param> /// <param name="item">The item to draw.</param> /// <param name="morg">The location where the item is drawn to.</param> public virtual void DrawItem(System.Drawing.Graphics g, BrushX brush, System.Drawing.Font font, System.Drawing.StringFormat strfmt, Altaxo.Data.AltaxoVariant item, PointF morg) { string text = FormatItem(item); g.DrawString(text, font, brush, morg, strfmt); }
public virtual void Draw(Graphics g, BrushX brush, PointF point) { var positionX = point.X + GetHorizontalOffset(); var positionY = point.Y + GetVerticalOffset(); for (int i = 0; i < _text.Length; ++i) { var posX = positionX; switch (_textBlockAligment) { case StringAlignment.Center: posX += (_size.X - _stringSize[i].X) * 0.5; break; case StringAlignment.Far: posX += (_size.X - _stringSize[i].X); break; } g.DrawString(_text[i], GdiFontManager.ToGdi(_font), brush, new PointF((float)posX, (float)positionY), _strfmt); positionY += _stringSize[i].Y * _lineSpacing; } }
public void ApplyGroupStyles(PlotGroupStyleCollection externalGroups, PlotGroupStyleCollection localGroups) { // IgnoreMissingDataPoints is the same for all sub plot styles IgnoreMissingDataPointsGroupStyle.ApplyStyle(externalGroups, localGroups, (ignoreMissingDataPoints) => this._ignoreMissingDataPoints = ignoreMissingDataPoints); // LineConnectionStyle is the same for all sub plot styles LineConnection2DGroupStyle.ApplyStyle(externalGroups, localGroups, (lineConnection, connectCircular) => { this._connectionStyle = lineConnection; this._connectCircular = connectCircular; }); if (ColorLinkage.Independent != _fillColorLinkage) { if (null == _fillBrush) _fillBrush = new BrushX(NamedColors.Black); if (_fillColorLinkage == ColorLinkage.Dependent) ColorGroupStyle.ApplyStyle(externalGroups, localGroups, delegate (NamedColor c) { _fillBrush.Color = c; }); else if (ColorLinkage.PreserveAlpha == _fillColorLinkage) ColorGroupStyle.ApplyStyle(externalGroups, localGroups, delegate (NamedColor c) { _fillBrush.Color = c.NewWithAlphaValue(_fillBrush.Color.Color.A); }); } if (ColorLinkage.Independent != _frameColorLinkage) { if (null == _framePen) ChildSetMember(ref _framePen, new PenX(NamedColors.Black)); if (_frameColorLinkage == ColorLinkage.Dependent) ColorGroupStyle.ApplyStyle(externalGroups, localGroups, delegate (NamedColor c) { _framePen.Color = c; }); else if (ColorLinkage.PreserveAlpha == _fillColorLinkage) ColorGroupStyle.ApplyStyle(externalGroups, localGroups, delegate (NamedColor c) { _framePen.Color = c.NewWithAlphaValue(_framePen.Color.Color.A); }); } // Shift the items ? _cachedLogicalShiftX = 0; _cachedLogicalShiftY = 0; if (!_independentOnShiftingGroupStyles) { var shiftStyle = PlotGroupStyle.GetFirstStyleToApplyImplementingInterface<IShiftLogicalXYGroupStyle>(externalGroups, localGroups); if (null != shiftStyle) { shiftStyle.Apply(out _cachedLogicalShiftX, out _cachedLogicalShiftY); } } }
public void BackgroundBrush_Initialize(BrushX brush) { this._cbColors.Brush = brush; }
public FilledRectangle(BrushX brush) { _brush = (BrushX)brush.Clone(); _brush.ParentObject = this; }
public void Draw(Graphics g, BrushX brush, RectangleD2D innerArea) { throw new NotImplementedException(); }
public void InitializeFillColor(BrushX sel) { m_cbLineFillColor.Brush = sel; }
public virtual void Draw(Graphics g, BrushX brush, PointF point) { g.DrawString(_text, GdiFontManager.ToGdi(_font), brush, point, _strfmt); }
public override object SetObjectData(object obj,System.Runtime.Serialization.SerializationInfo info,System.Runtime.Serialization.StreamingContext context,System.Runtime.Serialization.ISurrogateSelector selector) { base.SetObjectData(obj, info, context, selector); _text = info.GetString("Text"); _font = (Font)info.GetValue("Font", typeof(Font)); _textBrush = (BrushX)info.GetValue("Brush", typeof(BrushX)); _background = (IBackgroundStyle)info.GetValue("BackgroundStyle", typeof(IBackgroundStyle)); _lineSpacingFactor = info.GetSingle("LineSpacing"); _xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", typeof(XAnchorPositionType)); _yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", typeof(YAnchorPositionType)); return this; }
public override void DrawItem(Graphics g, BrushX brush, FontX font, StringFormat strfmt, Altaxo.Data.AltaxoVariant item, PointF morg) { string firstpart, middelpart, exponent; double mant; SplitInFirstPartAndExponent((double)item, out firstpart, out mant, out middelpart, out exponent); var gdiFont = GdiFontManager.ToGdi(font); SizeF size1 = g.MeasureString(_prefix + firstpart + middelpart, gdiFont, morg, strfmt); g.DrawString(_prefix + firstpart + middelpart, gdiFont, brush, morg, strfmt); var orginalY = morg.Y; morg.X += size1.Width; morg.Y += size1.Height / 3; FontX font2 = font.WithSize(font.Size * 2 / 3.0); var gdiFont2 = GdiFontManager.ToGdi(font2); g.DrawString(exponent, gdiFont2, brush, morg); if (!string.IsNullOrEmpty(_suffix)) { morg.X += g.MeasureString(exponent, gdiFont2, morg, strfmt).Width; morg.Y = orginalY; } if (!string.IsNullOrEmpty(_suffix)) { g.DrawString(_suffix, gdiFont, brush, morg, strfmt); } }
public override bool CopyFrom(object obj) { var isCopied = base.CopyFrom(obj); if (isCopied && !object.ReferenceEquals(this, obj)) { var from = obj as TextGraphic; if (from != null) { this._text = from._text; this._font = from._font; this._textBrush = from._textBrush == null ? null : (BrushX)from._textBrush.Clone(); if (null != _textBrush) _textBrush.ParentObject = this; this._background = from._background == null ? null : (IBackgroundStyle)from._background.Clone(); if (null != _background) _background.ParentObject = this; this._lineSpacingFactor = from._lineSpacingFactor; // don't clone the cached items this._isStructureInSync = false; this._isMeasureInSync = false; } } return isCopied; }
public virtual void Draw(Graphics g, BrushX brush, PointF point) { g.DrawString(_firstpart, GdiFontManager.ToGdi(_font1), brush, point, _strfmt); point.X += _size1.Width; point.Y += 0; g.DrawString(_exponent, GdiFontManager.ToGdi(_font2), brush, point, _strfmt); point.X += _size2.Width; g.DrawString(_lastpart, GdiFontManager.ToGdi(_font1), brush, point, _strfmt); }
/// <summary> /// Draws the item to a specified location. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="brush">Brush used to draw the item.</param> /// <param name="font">Font used to draw the item.</param> /// <param name="strfmt">String format.</param> /// <param name="item">The item to draw.</param> /// <param name="morg">The location where the item is drawn to.</param> public virtual void DrawItem(System.Drawing.Graphics g, BrushX brush, FontX font, System.Drawing.StringFormat strfmt, Altaxo.Data.AltaxoVariant item, PointF morg) { string text = _prefix + FormatItem(item) + _suffix; g.DrawString(text, GdiFontManager.ToGdi(font), brush, morg, strfmt); }
public DarkMarbel(NamedColor c) { Brush = new BrushX(c); }
public AxisLabelStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context) { if (null == context) context = PropertyExtensions.GetPropertyContextOfProject(); _font = context.GetValue(GraphDocument.PropertyKeyDefaultFont); var foreColor = context.GetValue(GraphDocument.PropertyKeyDefaultForeColor); _brush = new BrushX(foreColor) { ParentObject = this }; _automaticRotationShift = true; _suppressedLabels = new SuppressedTicks() { ParentObject = this }; _labelFormatting = new Gdi.LabelFormatting.NumericLabelFormattingAuto() { ParentObject = this }; SetStringFormat(); }
private void ResetCachedBrushes() { this._cachedShadowBrush = null; }
public virtual void Draw(Graphics g, BrushX brush, PointF point) { g.DrawString(_text, _font, brush, point, _strfmt); }
private void SetCachedBrushes() { switch (_brush.BrushType) { default: case BrushType.SolidBrush: this._cachedShadowBrush = new BrushX(Color.FromArgb(_brush.Color.A, 0, 0, 0)); break; case BrushType.HatchBrush: this._cachedShadowBrush = new BrushX(Color.FromArgb(_brush.Color.A, 0, 0, 0)); break; case BrushType.TextureBrush: this._cachedShadowBrush = new BrushX(Color.Black); break; case BrushType.LinearGradientBrush: case BrushType.PathGradientBrush: this._cachedShadowBrush = (BrushX)_brush.Clone(); this._cachedShadowBrush.Color = Color.FromArgb(_brush.Color.A, 0, 0, 0); this._cachedShadowBrush.BackColor = Color.FromArgb(_brush.BackColor.A, 0, 0, 0); break; } }
public ScatterPlotStyle() { this._shape = XYPlotScatterStyles.Shape.Square; this._style = XYPlotScatterStyles.Style.Solid; this._dropLine = new CSPlaneIDList(); this._pen = new PenX(Color.Black); this._independentColor = false; this._symbolSize = 8; this._relativePenWidth = 0.1f; this._skipFreq = 1; this._cachedFillPath = true; // since default is solid this._cachedFillBrush = new BrushX(Color.Black); this._cachedPath = GetPath(_shape, _style, _symbolSize); CreateEventChain(); }
public override void DrawItem(Graphics g, BrushX brush, Font font, StringFormat strfmt, Altaxo.Data.AltaxoVariant item, PointF morg) { string firstpart, exponent; SplitInFirstPartAndExponent((double)item, out firstpart, out exponent); SizeF size1 = g.MeasureString(firstpart, font, morg, strfmt); g.DrawString(firstpart, font, brush, morg, strfmt); morg.X += size1.Width; morg.Y += size1.Height / 3; using (Font font2 = new Font(font.FontFamily, (float)(font.Size * 2 / 3.0))) { g.DrawString(exponent, font2, brush, morg); } }
/// <summary> /// Paints one label. /// </summary> /// <param name="g"></param> /// <param name="label"></param> /// <param name="variableTextBrush">If not null, this argument provides the text brush that should be used now. If null, then the <see cref="_brush"/> is used instead.</param> /// <param name="variableBackBrush"></param> public void PaintOneItem(Graphics g, string label, double symbolSize, BrushX variableTextBrush, BrushX variableBackBrush) { var fontSize = _font.Size; var xpos = _offsetX_Points + (_offsetX_EmUnits * fontSize) + (_offsetX_SymbolSizeUnits * symbolSize / 2); var ypos = -(_offsetY_Points + (_offsetY_EmUnits * fontSize) + (_offsetY_SymbolSizeUnits * symbolSize / 2)); var gdiFont = GdiFontManager.ToGdi(_font); SizeF stringsize = g.MeasureString(label, gdiFont, PointF.Empty, _cachedStringFormat); if (this._backgroundStyle != null) { var x = xpos; var y = ypos; switch (_alignmentX) { case Alignment.Center: x -= stringsize.Width / 2; break; case Alignment.Far: x -= stringsize.Width; break; } switch (_alignmentY) { case Alignment.Center: y -= stringsize.Height / 2; break; case Alignment.Far: y -= stringsize.Height; break; } if (null == variableBackBrush) { this._backgroundStyle.Draw(g, new RectangleF((float)x, (float)y, stringsize.Width, stringsize.Height)); } else { this._backgroundStyle.Draw(g, variableBackBrush, new RectangleF((float)x, (float)y, stringsize.Width, stringsize.Height)); } } var brush = null != variableTextBrush ? variableTextBrush : _brush; brush.SetEnvironment(new RectangleF(new PointF((float)xpos, (float)ypos), stringsize), BrushX.GetEffectiveMaximumResolution(g, 1)); g.DrawString(label, gdiFont, brush, (float)xpos, (float)ypos, _cachedStringFormat); }
public virtual void Draw(Graphics g, BrushX brush, PointF point) { g.DrawString(_firstpart, _font1, brush, point, _strfmt); point.X += _size1.Width; point.Y += 0; g.DrawString(_exponent, _font2, brush, point, _strfmt); }
public FilledRectangle(Color c) { _brush = new BrushX(c); }
/// <summary> /// For deserialization only. Initializes a new instance of the <see cref="FillToCurvePlotStyle"/> class. /// </summary> /// <param name="info">Deserialization info.</param> protected FillToCurvePlotStyle(Altaxo.Serialization.Xml.IXmlDeserializationInfo info) { _cachedPaintOneRange = this.StraightConnection_PaintOneRange; FillBrush = new BrushX(NamedColors.Aqua); }
protected override void CopyFrom(GraphicBase bfrom) { TextGraphic from = bfrom as TextGraphic; if (from != null) { this._text = from._text; this._font = from._font == null ? null : (Font)from._font.Clone(); this._textBrush = from._textBrush == null ? null : (BrushX)from._textBrush.Clone(); this._background = from._background == null ? null : (IBackgroundStyle)from._background.Clone(); this._lineSpacingFactor = from._lineSpacingFactor; _xAnchorType = from._xAnchorType; _yAnchorType = from._yAnchorType; // don't clone the cached items this._cachedTextLines = null; this._isStructureInSync = false; this._isMeasureInSync = false; } base.CopyFrom(bfrom); }
public FillToCurvePlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context) { _cachedPaintOneRange = this.StraightConnection_PaintOneRange; FillBrush = new BrushX(NamedColors.Aqua); // Exception: do not use one of the colors of the default plot color set. Instead, use a light color. }
public TextGraphic(Altaxo.Main.Properties.IReadOnlyPropertyBag context) : base(new ItemLocationDirectAutoSize()) { if (null == context) context = PropertyExtensions.GetPropertyContextOfProject(); _font = context.GetValue(GraphDocument.PropertyKeyDefaultFont); _textBrush = new BrushX(context.GetValue(GraphDocument.PropertyKeyDefaultForeColor)) { ParentObject = this }; }
public DropAreaPlotStyle(ILineConnectionStyle connection, bool ignoreMissingDataPoints, bool connectCircular, CSPlaneID direction, BrushX fillBrush, ColorLinkage fillColorLinkage) { _connectionStyle = connection; _ignoreMissingDataPoints = ignoreMissingDataPoints; _connectCircular = connectCircular; _fillDirection = direction; _fillColorLinkage = fillColorLinkage; ChildCopyToMember(ref _fillBrush, fillBrush); ChildSetMember(ref _framePen, new PenX(NamedColors.Transparent, 1)); }
public FilledRectangle(BrushX brush) { _brush = brush.Clone(); _brush.ParentObject = this; }