Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        private static BrushX GetShadowBrush(BrushX mainBrush)
        {
            BrushX cachedShadowBrush = null;

            switch (mainBrush.BrushType)
            {
            default:
            case BrushType.SolidBrush:
                cachedShadowBrush = new BrushX(NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0));
                break;

            case BrushType.HatchBrush:
                cachedShadowBrush = new BrushX(NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0));
                break;

            case BrushType.TextureBrush:
                cachedShadowBrush = new BrushX(NamedColors.Black);
                break;

            case BrushType.LinearGradientBrush:
            case BrushType.PathGradientBrush:
                cachedShadowBrush           = mainBrush.Clone();
                cachedShadowBrush.Color     = NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0);
                cachedShadowBrush.BackColor = NamedColor.FromArgb(mainBrush.BackColor.Color.A, 0, 0, 0);
                break;
            }
            return(cachedShadowBrush);
        }
Esempio n. 3
0
 public static BrushX GetDefaultBackgroundBrush(ColumnStyleType type)
 {
     if (type == ColumnStyleType.DataCell)
     {
         return((BrushX)_defaultNormalBackgroundBrush.Clone());
     }
     else
     {
         return((BrushX)_defaultHeaderBackgroundBrush.Clone());
     }
 }
Esempio n. 4
0
 public static BrushX GetDefaultTextBrush(ColumnStyleType type)
 {
     if (type == ColumnStyleType.DataCell || type == ColumnStyleType.PropertyCell)
     {
         return((BrushX)_defaultNormalTextBrush.Clone());
     }
     else
     {
         return(new BrushX(SystemColors.ControlText));
     }
 }
Esempio n. 5
0
 void Initialize()
 {
     if (_view != null)
     {
         if (_doc != null)
         {
             _view.Brush = _usage == UseDocument.Directly ? _doc : (BrushX)_doc.Clone();
         }
         else
         {
             _view.Brush = BrushX.Empty;
         }
     }
 }
Esempio n. 6
0
        public void Paint(System.Drawing.Graphics g, IPlotArea layer, Processed2DPlotData pdata, Processed2DPlotData prevItemData, Processed2DPlotData nextItemData)
        {
            if (null == pdata)
            {
                throw new ArgumentNullException(nameof(pdata));
            }

            PlotRangeList rangeList = pdata.RangeList;

            System.Drawing.PointF[] ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates;
            layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(0, 0), out var xleft, out var ybottom);
            layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(1, 1), out var xright, out var ytop);
            float xe = (float)xright;
            float ye = (float)ybottom;

            var path = new GraphicsPath();

            double globalBaseValue;

            if (_usePhysicalBaseValue)
            {
                globalBaseValue = layer.YAxis.PhysicalVariantToNormal(_baseValue);
                if (double.IsNaN(globalBaseValue))
                {
                    globalBaseValue = 0;
                }
            }
            else
            {
                globalBaseValue = _baseValue.ToDouble();
            }

            bool useVariableFillColor  = null != _fillBrush && null != _cachedColorForIndexFunction && !_independentFillColor;
            bool useVariableFrameColor = null != _framePen && null != _cachedColorForIndexFunction && !_independentFrameColor;

            var fillBrush = _fillBrush == null ? null : useVariableFillColor?_fillBrush.Clone() : _fillBrush;

            var framePen = _framePen == null ? null : useVariableFrameColor?_framePen.Clone() : _framePen;

            int j = -1;

            foreach (int originalRowIndex in pdata.RangeList.OriginalRowIndices())
            {
                j++;

                double xcn = _xOffsetLogical + layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalRowIndex));
                double xln = xcn - 0.5 * _xSizeLogical;
                double xrn = xcn + 0.5 * _xSizeLogical;

                double ycn    = layer.YAxis.PhysicalVariantToNormal(pdata.GetYPhysical(originalRowIndex));
                double ynbase = globalBaseValue;

                if (_startAtPreviousItem && pdata.PreviousItemData != null)
                {
                    double prevstart = layer.YAxis.PhysicalVariantToNormal(pdata.PreviousItemData.GetYPhysical(originalRowIndex));
                    if (!double.IsNaN(prevstart))
                    {
                        ynbase  = prevstart;
                        ynbase += Math.Sign(ynbase - globalBaseValue) * _previousItemYGap;
                    }
                }

                path.Reset();
                layer.CoordinateSystem.GetIsoline(path, new Logical3D(xln, ynbase), new Logical3D(xln, ycn));
                layer.CoordinateSystem.GetIsoline(path, new Logical3D(xln, ycn), new Logical3D(xrn, ycn));
                layer.CoordinateSystem.GetIsoline(path, new Logical3D(xrn, ycn), new Logical3D(xrn, ynbase));
                layer.CoordinateSystem.GetIsoline(path, new Logical3D(xrn, ynbase), new Logical3D(xln, ynbase));
                path.CloseFigure();

                if (null != fillBrush)
                {
                    if (useVariableFillColor)
                    {
                        fillBrush.Color = GdiColorHelper.ToNamedColor(_cachedColorForIndexFunction(originalRowIndex), "VariableColor");
                    }

                    fillBrush.SetEnvironment(path.GetBounds(), BrushX.GetEffectiveMaximumResolution(g, 1));
                    g.FillPath(fillBrush, path);
                }

                if (null != framePen)
                {
                    if (useVariableFrameColor)
                    {
                        framePen.Color = GdiColorHelper.ToNamedColor(_cachedColorForIndexFunction(originalRowIndex), "VariableColor");
                    }

                    framePen.SetEnvironment(path.GetBounds(), BrushX.GetEffectiveMaximumResolution(g, 1));
                    g.DrawPath(framePen, path);
                }
            }
        }
Esempio n. 7
0
 public FilledRectangle(BrushX brush)
 {
     _brush = (BrushX)brush.Clone();
 }
Esempio n. 8
0
 public FilledRectangle(BrushX brush)
 {
   _brush = (BrushX)brush.Clone();
 }
Esempio n. 9
0
		public FilledRectangle(BrushX brush)
		{
			_brush = (BrushX)brush.Clone();
			_brush.ParentObject = this;
		}
Esempio n. 10
0
		private static BrushX GetShadowBrush(BrushX mainBrush)
		{
			BrushX cachedShadowBrush = null;
			switch (mainBrush.BrushType)
			{
				default:
				case BrushType.SolidBrush:
					cachedShadowBrush = new BrushX(NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0));
					break;

				case BrushType.HatchBrush:
					cachedShadowBrush = new BrushX(NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0));
					break;

				case BrushType.TextureBrush:
					cachedShadowBrush = new BrushX(NamedColors.Black);
					break;

				case BrushType.LinearGradientBrush:
				case BrushType.PathGradientBrush:
					cachedShadowBrush = (BrushX)mainBrush.Clone();
					cachedShadowBrush.Color = NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0);
					cachedShadowBrush.BackColor = NamedColor.FromArgb(mainBrush.BackColor.Color.A, 0, 0, 0);
					break;
			}
			return cachedShadowBrush;
		}
Esempio n. 11
0
 public FilledRectangle(BrushX brush)
 {
     _brush = brush.Clone();
     _brush.ParentObject = this;
 }