Exemplo n.º 1
0
        /// <summary>
        /// Apply PlotAreaBevel
        /// </summary>
        internal void ApplyBevel(Double plankDepth, Double plankThickness)
        {
            if (_bevelCanvas != null)
            {
                BevelGrid.Children.Remove(_bevelCanvas);
                _bevelCanvas = null;
            }

            if (Bevel)
            {
                Chart chart = Chart as Chart;

                _bevelCanvas = ExtendedGraphics.Get2DRectangleBevel(this, BorderElement.Width - InternalBorderThickness.Left - InternalBorderThickness.Right// - plankDepth
                , BorderElement.Height - InternalBorderThickness.Top - InternalBorderThickness.Bottom //+ ((chart.PlotDetails.ChartOrientation == ChartOrientationType.Horizontal || chart.PlotDetails.ChartOrientation == ChartOrientationType.NoAxis) ? 0 : (-plankDepth - plankThickness))
                , Charts.Chart.BEVEL_DEPTH, Charts.Chart.BEVEL_DEPTH
                , Graphics.GetBevelTopBrush(BorderElement.Background)
                , Graphics.GetBevelSideBrush(0, BorderElement.Background)
                , Graphics.GetBevelSideBrush(180, BorderElement.Background)
                , Graphics.GetBevelSideBrush(90, BorderElement.Background));

                _bevelCanvas.SetValue(Canvas.LeftProperty, InternalBorderThickness.Left);
                _bevelCanvas.SetValue(Canvas.TopProperty, InternalBorderThickness.Top);

                _bevelCanvas.IsHitTestVisible = false;

                BevelGrid.Children.Add(_bevelCanvas);
            }
        }
Exemplo n.º 2
0
        internal static void ApplyOrRemoveBevel(DataPoint dataPoint, Double dataPointWidth)
        {
            // Removing parts of bevel
            Canvas    bevelCanvas   = null;
            Faces     faces         = dataPoint.Faces;
            Rectangle openCloseRect = faces.VisualComponents[1] as Rectangle;

            faces.ClearList(ref faces.BevelElements);

            // Create Bevel
            if (dataPoint.Parent.Bevel && dataPointWidth > 8 && openCloseRect.Height > 6)
            {
                Double reduceSize = openCloseRect.StrokeThickness;

                if (dataPoint.Parent.SelectionEnabled && dataPoint.BorderThickness.Left == 0)
                {
                    reduceSize = 1.5 + reduceSize;
                }

                if (openCloseRect.Width - 2 * reduceSize >= 0 && openCloseRect.Height - 2 * reduceSize >= 0)
                {
                    Brush color = GetOpenCloseRectangleFillbrush(dataPoint, (Brush)dataPoint.GetValue(DataPoint.ColorProperty));
                    bevelCanvas = ExtendedGraphics.Get2DRectangleBevel(dataPoint, openCloseRect.Width - 2 * reduceSize, openCloseRect.Height - 2 * reduceSize, 5, 5,
                                                                       Graphics.GetBevelTopBrush(color),
                                                                       Graphics.GetBevelSideBrush(((Boolean)dataPoint.LightingEnabled ? -70 : 0), color),
                                                                       Graphics.GetBevelSideBrush(((Boolean)dataPoint.LightingEnabled ? -110 : 180), color),
                                                                       Graphics.GetBevelSideBrush(90, color));

                    bevelCanvas.IsHitTestVisible = false;

                    bevelCanvas.SetValue(Canvas.TopProperty, (Double)openCloseRect.GetValue(Canvas.TopProperty) + reduceSize);
                    bevelCanvas.SetValue(Canvas.LeftProperty, reduceSize);

                    // Adding parts of bevel
                    foreach (FrameworkElement fe in bevelCanvas.Children)
                    {
                        dataPoint.Faces.BevelElements.Add(fe);
                    }

                    dataPoint.Faces.BevelElements.Add(bevelCanvas);

                    (dataPoint.Faces.Visual as Canvas).Children.Add(bevelCanvas);
                }
            }
        }