void mainChartPaneAppearanceSchemeChangedEvent(ChartPane pane, AppearanceSchemeEnum scheme) { this.SetAppearanceScheme(scheme); this.Refresh(); }
/// <summary> /// Set one of the predefined appearance schemes. /// </summary> public void SetAppearanceScheme(AppearanceSchemeEnum scheme) { if (scheme == AppearanceSchemeEnum.Custom) {// Changes nothing return; } _appearanceScheme = scheme; _seriesItemMargin = 2; _seriesItemWidth = 6; _actualDrawingSpaceAreaBorderPen = Pens.Gray; _actualSpaceGrid.Visible = false; _axisLabelsFont = new Font("Tahoma", 8); _drawingSpaceGrid.Visible = true; _labelsFont = new Font("Tahoma", 8); _labelsMargin = 10; //_labelsTopMargin = 8; _showClippingRectangle = false; _titleFont = new Font("Tahoma", 10); Point gradientBrushPoint1 = new Point(); Point gradientBrushPoint2 = new Point(0, Screen.PrimaryScreen.Bounds.Height); foreach (ChartSeries series in _series) { if (series is ProviderTradeChartSeries) { ProviderTradeChartSeries providerSeries = (ProviderTradeChartSeries)series; providerSeries.FallingBarFill = (SolidBrush)Brushes.White; } } switch (scheme) { case AppearanceSchemeEnum.Trade: { _actualDrawingSpaceAreaFill = Brushes.Black; _xAxisLabelsFontBrush = Brushes.DarkGray; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = Brushes.Black; _labelsFill = Brushes.DarkGray; _labelsFontBrush = Brushes.Black; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.DarkGray; } break; case AppearanceSchemeEnum.TradeWhite: { foreach (ChartSeries series in _series) { if (series is ProviderTradeChartSeries) { ProviderTradeChartSeries providerSeries = (ProviderTradeChartSeries)series; providerSeries.FallingBarFill = (SolidBrush)Brushes.LightSalmon; } } _actualDrawingSpaceAreaFill = Brushes.WhiteSmoke; _xAxisLabelsFontBrush = Brushes.Gray; _yAxisLabelsFontBrush = Brushes.Gray; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = Brushes.WhiteSmoke; _labelsFill = null; _labelsFontBrush = Brushes.Black; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.DarkGray; } break; case AppearanceSchemeEnum.Fast: { _actualDrawingSpaceAreaFill = Brushes.Black; _xAxisLabelsFontBrush = Brushes.WhiteSmoke; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = Brushes.Black; _labelsFill = Brushes.Gainsboro; _labelsFontBrush = Brushes.Black; _selectionFill = null; _selectionPen = Pens.Gray; _titleFontBrush = Brushes.White; } break; case AppearanceSchemeEnum.Default: { _actualDrawingSpaceAreaFill = Brushes.Black; _xAxisLabelsFontBrush = Brushes.WhiteSmoke; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = Brushes.Black; _labelsFill = Brushes.Gainsboro; _labelsFontBrush = Brushes.Black; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.White; } break; case AppearanceSchemeEnum.Dark: { _actualDrawingSpaceAreaFill = new LinearGradientBrush(gradientBrushPoint1, gradientBrushPoint2, Color.FromArgb(52, 52, 64), Color.FromArgb(84, 77, 84)); _xAxisLabelsFontBrush = Brushes.Gainsboro; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = new SolidBrush(Color.FromArgb(53, 39, 54)); _labelsFill = new LinearGradientBrush(new Point(0, 0), new Point(0, 30), Color.Gainsboro, Color.FromArgb(53, 39, 54)); _labelsFontBrush = Brushes.Black; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.Gainsboro; } break; case AppearanceSchemeEnum.Light: { _actualDrawingSpaceAreaFill = new LinearGradientBrush(gradientBrushPoint1, gradientBrushPoint2, Color.FromArgb(255, 246, 254), Color.FromArgb(166, 177, 147)); _xAxisLabelsFontBrush = Brushes.WhiteSmoke; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = new SolidBrush(Color.FromArgb(122, 125, 112)); _labelsFill = new LinearGradientBrush(new Point(0, 0), new Point(0, 30), Color.Gainsboro, Color.FromArgb(122, 125, 112)); _labelsFontBrush = Brushes.Black; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.Black; } break; case AppearanceSchemeEnum.DarkNatural: { _actualDrawingSpaceAreaFill = new LinearGradientBrush(gradientBrushPoint1, gradientBrushPoint2, Color.FromArgb(93, 88, 70), Color.FromArgb(5, 41, 46)); _xAxisLabelsFontBrush = Brushes.LightGray; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = new LinearGradientBrush(gradientBrushPoint1, gradientBrushPoint2, Color.FromArgb(93, 88, 70), Color.FromArgb(5, 41, 46)); _labelsFill = null; _labelsFontBrush = Brushes.LightGray; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.LightGray; } break; case AppearanceSchemeEnum.LightNatural: case AppearanceSchemeEnum.LightNaturalFlat: { if (scheme == AppearanceSchemeEnum.LightNatural) { _actualDrawingSpaceAreaFill = new LinearGradientBrush(gradientBrushPoint1, gradientBrushPoint2, Color.FromArgb(223, 203, 164), Color.FromArgb(173, 165, 130)); } else { _actualDrawingSpaceAreaFill = new SolidBrush(Color.FromArgb(223, 203, 164)); } _xAxisLabelsFontBrush = Brushes.Black; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = _actualDrawingSpaceAreaFill; _labelsFill = null; _labelsFontBrush = Brushes.Black; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.Black; } break; case AppearanceSchemeEnum.Alfonsina: { _actualDrawingSpaceAreaFill = new LinearGradientBrush(gradientBrushPoint1, gradientBrushPoint2, Color.FromArgb(214, 201, 141), Color.FromArgb(171, 161, 118)); _xAxisLabelsFontBrush = Brushes.WhiteSmoke; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = new LinearGradientBrush(new Point(), new Point(0, 2000), Color.FromArgb(94, 90, 66), Color.FromArgb(5, 35, 40)); _labelsFill = null; _labelsFontBrush = Brushes.WhiteSmoke; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.Black; } break; case AppearanceSchemeEnum.Ground: { _actualDrawingSpaceAreaFill = new LinearGradientBrush(gradientBrushPoint1, gradientBrushPoint2, Color.FromArgb(173, 144, 110), Color.FromArgb(151, 120, 95)); _xAxisLabelsFontBrush = Brushes.WhiteSmoke; _yAxisLabelsFontBrush = _xAxisLabelsFontBrush; _drawingSpaceGrid.Pen = Pens.DimGray; _fill = new SolidBrush(Color.FromArgb(118, 85, 73)); _labelsFill = null; _labelsFontBrush = Brushes.WhiteSmoke; _selectionFill = new SolidBrush(Color.FromArgb(70, 15, 15, 15)); _selectionPen = Pens.Gray; _titleFontBrush = Brushes.WhiteSmoke; } break; default: break; } if (AppearanceSchemeChangedEvent != null) { AppearanceSchemeChangedEvent(this, scheme); } if (ParametersUpdatedEvent != null) { ParametersUpdatedEvent(this); } }
void _masterPane_AppearanceSchemeChangedEvent(ChartPane pane, AppearanceSchemeEnum scheme) { this.SetAppearanceScheme(scheme); this.Refresh(); //this.Invalidate(); }
public void RestoreState(SerializationInfoEx info, bool restoreCustomObjects) { this.Name = info.GetString("Name"); this.Height = info.GetInt32("Height"); _stateId = info.GetValue<Guid>("_stateId"); _titleFont = info.GetValue<Font>("_titleFont"); _titleFontBrush = info.GetValue<Brush>("_titleFontBrush"); _fill = info.GetValue<Brush>("_fill"); _axisLabelsFont = info.GetValue<Font>("_axisLabelsFont"); _xAxisLabelsFontBrush = info.GetValue<Brush>("_xAxisLabelsFontBrush"); _yAxisLabelsPosition = info.GetValue<YAxisLabelPosition>("_yAxisLabelsPosition"); _yAxisLabelsFontBrush = info.GetValue<Brush>("_yAxisLabelsFontBrush"); _xAxisLabelsFormat = info.GetString("_xAxisLabelsFormat"); _yAxisLabelsFormat = info.GetString("_yAxisLabelsFormat"); _labelsFont = info.GetValue<Font>("_labelsFont"); _labelsFontBrush = info.GetValue<Brush>("_labelsFontBrush"); _labelsFill = info.GetValue<Brush>("_labelsFill"); _labelsTopMargin = info.GetSingle("_labelsTopMargin"); _labelsMargin = info.GetSingle("_labelsMargin"); _showSeriesLabels = info.GetBoolean("_showSeriesLabels"); _showClippingRectangle = info.GetBoolean("_showClippingRectangle"); _unitUnificationOptimizationEnabled = info.GetBoolean("_unitUnificationOptimizationEnabled"); _smoothingMode = info.GetValue<SmoothingMode>("_smoothingMode"); _defaultAbsoluteSelectionMargin = info.GetSingle("_defaultAbsoluteSelectionMargin"); _scrollMode = info.GetValue<ScrollModeEnum>("_scrollMode"); _rightMouseButtonSelectionMode = info.GetValue<SelectionModeEnum>("_rightMouseButtonSelectionMode"); _selectionPen = info.GetValue<Pen>("_selectionPen"); _selectionFill = info.GetValue<Brush>("_selectionFill"); _additionalDrawingSpaceAreaMarginLeft = info.GetInt32("_additionalDrawingSpaceAreaMarginLeft"); _additionalDrawingSpaceAreaMarginRight = info.GetInt32("_additionalDrawingSpaceAreaMarginRight"); _actualDrawingSpaceAreaMarginLeft = info.GetInt32("_actualDrawingSpaceAreaMarginLeft"); _actualDrawingSpaceAreaMarginTop = info.GetInt32("_actualDrawingSpaceAreaMarginTop"); _actualDrawingSpaceAreaMarginRight = info.GetInt32("_actualDrawingSpaceAreaMarginRight"); _actualDrawingSpaceAreaMarginBottom = info.GetInt32("_actualDrawingSpaceAreaMarginBottom"); _actualDrawingSpaceAreaBorderPen = info.GetValue<Pen>("_actualDrawingSpaceAreaBorderPen"); _actualDrawingSpaceAreaFill = info.GetValue<Brush>("_actualDrawingSpaceAreaFill"); _limitedView = info.GetBoolean("_limitedView"); _seriesItemWidth = info.GetSingle("_seriesItemWidth"); _seriesItemMargin = info.GetSingle("_seriesItemMargin"); if (restoreCustomObjects && info.GetBoolean("customObjectsSaved")) {// Restore custom objects. _customObjectsManager.RestoreState(info); } else {// New clear custom objects. _customObjectsManager.Clear(); } _actualSpaceGrid = info.GetValue<ChartGrid>("_actualSpaceGrid"); _drawingSpaceGrid = info.GetValue<ChartGrid>("_drawingSpaceGrid"); _chartName = info.GetString("_chartName"); _appearanceScheme = info.GetValue<AppearanceSchemeEnum>("_appearanceScheme"); _autoScrollToEnd = info.GetBoolean("_autoScrollToEnd"); if (info.ContainsValue("_maximumXZoom")) { _maximumXZoom = info.GetSingle("_maximumXZoom"); } else { _maximumXZoom = null; } _xAxisLabelSpacing = info.GetSingle("_xAxisLabelSpacing"); if (AppearanceSchemeChangedEvent != null) { AppearanceSchemeChangedEvent(this, _appearanceScheme); } }