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); } } }
private static void ApplyOrUpdateShadow(DataPoint dataPoint, Canvas dataPointVisual, Line highLow, Line openLine, Line closeLine, Double dataPointWidth) { #region Apply Shadow Faces dpFaces = dataPoint.Faces; //dataPointVisual.Background = Graphics.GetRandomColor(); dpFaces.ClearList(ref dpFaces.ShadowElements); if (dataPoint.ShadowEnabled == true) { // Create High and Low Line Line highLowShadow = new Line() { IsHitTestVisible = false, X1 = dataPointVisual.Width / 2 + CandleStick._shadowDepth, X2 = dataPointVisual.Width / 2 + CandleStick._shadowDepth, Y1 = 0 + CandleStick._shadowDepth, Y2 = dataPointVisual.Height + CandleStick._shadowDepth, Stroke = CandleStick._shadowColor, StrokeThickness = (Double)dataPoint.BorderThickness.Left, StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString()) }; // Create Open Line Line openShadowLine = new Line() { IsHitTestVisible = false, X1 = openLine.X1 + CandleStick._shadowDepth, X2 = openLine.X2 + CandleStick._shadowDepth, Y1 = openLine.Y1 + CandleStick._shadowDepth, Y2 = openLine.Y2 + CandleStick._shadowDepth, Stroke = CandleStick._shadowColor, StrokeThickness = (Double)dataPoint.BorderThickness.Left, StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString()) }; // Create Close Line Line closeShadowLine = new Line() { IsHitTestVisible = false, X1 = closeLine.X1 + CandleStick._shadowDepth, X2 = closeLine.X2 + CandleStick._shadowDepth, Y1 = closeLine.Y1 + CandleStick._shadowDepth, Y2 = closeLine.Y2 + CandleStick._shadowDepth, Stroke = CandleStick._shadowColor, StrokeThickness = (Double)dataPoint.BorderThickness.Left, StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString()) }; // Add shadow elements to list of shadow elements dpFaces.ShadowElements.Add(highLowShadow); dpFaces.ShadowElements.Add(openShadowLine); dpFaces.ShadowElements.Add(closeShadowLine); // Add shadows dataPointVisual.Children.Add(highLowShadow); dataPointVisual.Children.Add(openShadowLine); dataPointVisual.Children.Add(closeShadowLine); } #endregion }
private static void ApplyOrUpdateShadow(DataPoint dataPoint, Canvas dataPointVisual, Line highLow, Line openLine, Line closeLine, Double dataPointWidth) { #region Apply Shadow if (!VisifireControl.IsMediaEffectsEnabled) { Faces dpFaces = dataPoint.Faces; dpFaces.ClearList(ref dpFaces.ShadowElements); if (dataPoint.ShadowEnabled == true) { // Create High and Low Line Line highLowShadow = new Line() { IsHitTestVisible = false, X1 = dataPointVisual.Width / 2 + CandleStick._shadowDepth, X2 = dataPointVisual.Width / 2 + CandleStick._shadowDepth, Y1 = 0 + CandleStick._shadowDepth, Y2 = dataPointVisual.Height + CandleStick._shadowDepth, Stroke = CandleStick._shadowColor, StrokeThickness = (Double)dataPoint.BorderThickness.Left, StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString()) }; // Create Open Line Line openShadowLine = new Line() { IsHitTestVisible = false, X1 = openLine.X1 + CandleStick._shadowDepth, X2 = openLine.X2 + CandleStick._shadowDepth, Y1 = openLine.Y1 + CandleStick._shadowDepth, Y2 = openLine.Y2 + CandleStick._shadowDepth, Stroke = CandleStick._shadowColor, StrokeThickness = (Double)dataPoint.BorderThickness.Left, StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString()) }; // Create Close Line Line closeShadowLine = new Line() { IsHitTestVisible = false, X1 = closeLine.X1 + CandleStick._shadowDepth, X2 = closeLine.X2 + CandleStick._shadowDepth, Y1 = closeLine.Y1 + CandleStick._shadowDepth, Y2 = closeLine.Y2 + CandleStick._shadowDepth, Stroke = CandleStick._shadowColor, StrokeThickness = (Double)dataPoint.BorderThickness.Left, StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString()) }; // Add shadow elements to list of shadow elements dpFaces.ShadowElements.Add(highLowShadow); dpFaces.ShadowElements.Add(openShadowLine); dpFaces.ShadowElements.Add(closeShadowLine); // Add shadows dataPointVisual.Children.Add(highLowShadow); dataPointVisual.Children.Add(openShadowLine); dataPointVisual.Children.Add(closeShadowLine); } } else { #if !WP if ((Boolean)dataPoint.ShadowEnabled) { dataPointVisual.Effect = ExtendedGraphics.GetShadowEffect(315, 4, 0.95); } else { dataPointVisual.Effect = null; } #endif } #endregion }