Changeset 4636 for trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/EnhancedChart.cs
- Timestamp:
- 10/21/10 14:45:44 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/EnhancedChart.cs
r4635 r4636 20 20 #endregion 21 21 22 using System; 22 23 using System.ComponentModel; 23 24 using System.Drawing; … … 31 32 EnableDoubleClickResetsZoom = true; 32 33 EnableMiddleClickPanning = true; 33 Customize ChartAreas();34 CustomizeAllChartAreas(); 34 35 } 35 36 … … 39 40 public bool EnableMiddleClickPanning { get; set; } 40 41 41 public void CustomizeChartAreas() { 42 public static void CustomizeChartArea(ChartArea chartArea) { 43 foreach (Axis axis in chartArea.Axes) { 44 axis.MajorGrid.LineColor = SystemColors.GradientInactiveCaption; 45 axis.MajorTickMark.TickMarkStyle = TickMarkStyle.AcrossAxis; 46 axis.ScrollBar.BackColor = Color.Transparent; 47 axis.ScrollBar.LineColor = Color.Transparent; 48 axis.ScrollBar.ButtonColor = SystemColors.GradientInactiveCaption; 49 axis.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; 50 axis.ScrollBar.Size = 12; 51 axis.TitleFont = new Font(axis.TitleFont.FontFamily, 10); 52 } 53 chartArea.CursorX.Interval = 0; 54 chartArea.CursorY.Interval = 0; 55 chartArea.CursorX.IsUserSelectionEnabled = true; 56 chartArea.CursorY.IsUserSelectionEnabled = true; 57 chartArea.CursorX.IsUserEnabled = false; 58 chartArea.CursorY.IsUserEnabled = false; 59 chartArea.CursorX.SelectionColor = SystemColors.GradientActiveCaption; 60 chartArea.CursorY.SelectionColor = SystemColors.GradientActiveCaption; 61 } 62 63 public void CustomizeAllChartAreas() { 42 64 foreach (ChartArea chartArea in ChartAreas) { 43 foreach (Axis axis in chartArea.Axes) { 44 axis.MajorGrid.LineColor = SystemColors.GradientInactiveCaption; 45 axis.MajorTickMark.TickMarkStyle = TickMarkStyle.AcrossAxis; 46 axis.ScrollBar.BackColor = Color.Transparent; 47 axis.ScrollBar.LineColor = Color.Transparent; 48 axis.ScrollBar.ButtonColor = SystemColors.GradientInactiveCaption; 49 axis.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; 50 axis.ScrollBar.Size = 12; 51 axis.TitleFont = new Font(axis.TitleFont.FontFamily, 12); 52 } 53 54 chartArea.CursorX.Interval = 0; 55 chartArea.CursorY.Interval = 0; 56 chartArea.CursorX.IsUserSelectionEnabled = true; 57 chartArea.CursorY.IsUserSelectionEnabled = true; 58 chartArea.CursorX.SelectionColor = SystemColors.GradientActiveCaption; 59 chartArea.CursorY.SelectionColor = SystemColors.GradientActiveCaption; 65 CustomizeChartArea(chartArea); 60 66 } 61 67 } … … 122 128 protected override void OnMouseMove(MouseEventArgs e) { 123 129 if (panning != null) { 124 panning.ChartArea.AxisX.ScaleView.Scroll(panning.ChartX(e.Location.X)); 125 panning.ChartArea.AxisY.ScaleView.Scroll(panning.ChartY(e.Location.Y)); 130 double x = panning.ChartX(e.Location.X); 131 double y = panning.ChartY(e.Location.Y); 132 if (panning.ChartArea.CursorX.Interval > 0) { 133 x = Math.Round(x * panning.ChartArea.CursorX.Interval) / panning.ChartArea.CursorX.Interval; 134 y = Math.Round(y * panning.ChartArea.CursorY.Interval) / panning.ChartArea.CursorY.Interval; 135 } 136 panning.ChartArea.AxisX.ScaleView.Scroll(x); 137 panning.ChartArea.AxisY.ScaleView.Scroll(y); 126 138 } 127 139 base.OnMouseMove(e);
Note: See TracChangeset
for help on using the changeset viewer.