Example #1
0
 public GraphCtrl()
 {
     this.InitializeComponent();
     this.gridX.PropertyChanged += new GraphCtrl.GraphGrid.PropertyChangedEventHandler(this.Graph_Changed);
     this.gridY.PropertyChanged += new GraphCtrl.GraphGrid.PropertyChangedEventHandler(this.Graph_Changed);
     this.scaleX.PropertyChanged += new GraphCtrl.GraphScale.PropertyChangedEventHandler(this.Graph_Changed);
     this.scaleY.PropertyChanged += new GraphCtrl.GraphScale.PropertyChangedEventHandler(this.Graph_Changed);
     this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     this.SetStyle(ControlStyles.ResizeRedraw, true);
     this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
     this.updateData = false;
     this.ColorBackground = Color.Black;
     this.ColorFrame = Color.Gray;
     this.ColorLine = Color.White;
     this.ColorText = Color.Gray;
     this.Type = GraphCtrl.eGraphType.Dot;
     this.History = 100;
     this.FrameFit = false;
     this.UpdateRate = 100;
     this.zoomOption = GraphCtrl.eZoomOption.None;
     this.zoomLeft = 0.0f;
     this.zoomRight = 0.0f;
     this.zoomTop = 0.0f;
     this.zoomBottom = 0.0f;
     this.ScaleX.Min = 0;
     this.ScaleX.Max = 100;
     this.ScaleX.Show = true;
     this.ScaleY.Min = 0;
     this.ScaleY.Max = 100;
     this.ScaleY.Show = true;
     this.GridX.Main = 0;
     this.GridX.Major = 25;
     this.GridX.Minor = 5;
     this.GridX.ShowMajor = true;
     this.GridX.ShowMinor = true;
     this.GridY.Main = 0;
     this.GridY.Major = 25;
     this.GridY.Minor = 5;
     this.GridY.ShowMajor = true;
     this.GridY.ShowMinor = true;
     this.Zoom = false;
     this.leftOffset = 0;
 }
Example #2
0
 private void checkBoxZoom_CheckedChanged(object sender, EventArgs e)
 {
     if (sender == this.checkBoxAutoScale)
     {
         if (this.checkBoxAutoScale.Checked)
         {
             this.checkBoxAutoScale.Image = (Image)Resources.AutoSelected;
             this.checkBoxZoomIn.Image = (Image)Resources.ZoomIn;
             this.checkBoxZoomOut.Image = (Image)Resources.ZoomOut;
             this.checkBoxHand.Image = (Image)Resources.Move;
             this.checkBoxZoomIn.Checked = false;
             this.checkBoxZoomOut.Checked = false;
             this.checkBoxHand.Checked = false;
             this.zoomOption = GraphCtrl.eZoomOption.AutoScale;
         }
         else
         {
             this.checkBoxAutoScale.Image = (Image)Resources.Auto;
             this.zoomOption = GraphCtrl.eZoomOption.None;
         }
     }
     else if (sender == this.checkBoxZoomIn)
     {
         if (this.checkBoxZoomIn.Checked)
         {
             this.checkBoxAutoScale.Image = (Image)Resources.Auto;
             this.checkBoxZoomIn.Image = (Image)Resources.ZoomInSelected;
             this.checkBoxZoomOut.Image = (Image)Resources.ZoomOut;
             this.checkBoxHand.Image = (Image)Resources.Move;
             this.checkBoxAutoScale.Checked = false;
             this.checkBoxZoomOut.Checked = false;
             this.checkBoxHand.Checked = false;
             this.zoomOption = GraphCtrl.eZoomOption.ZoomIn;
         }
         else
         {
             this.checkBoxZoomIn.Image = (Image)Resources.ZoomIn;
             this.zoomOption = GraphCtrl.eZoomOption.None;
         }
     }
     else if (sender == this.checkBoxZoomOut)
     {
         if (this.checkBoxZoomOut.Checked)
         {
             this.checkBoxAutoScale.Image = (Image)Resources.Auto;
             this.checkBoxZoomIn.Image = (Image)Resources.ZoomIn;
             this.checkBoxZoomOut.Image = (Image)Resources.ZoomOutSelected;
             this.checkBoxHand.Image = (Image)Resources.Move;
             this.checkBoxAutoScale.Checked = false;
             this.checkBoxZoomIn.Checked = false;
             this.checkBoxHand.Checked = false;
             this.zoomOption = GraphCtrl.eZoomOption.ZoomOut;
         }
         else
         {
             this.checkBoxZoomOut.Image = (Image)Resources.ZoomOut;
             this.zoomOption = GraphCtrl.eZoomOption.None;
         }
     }
     else if (sender == this.checkBoxHand)
     {
         if (this.checkBoxHand.Checked)
         {
             this.checkBoxAutoScale.Image = (Image)Resources.Auto;
             this.checkBoxZoomIn.Image = (Image)Resources.ZoomIn;
             this.checkBoxZoomOut.Image = (Image)Resources.ZoomOut;
             this.checkBoxHand.Image = (Image)Resources.MoveSelected;
             this.checkBoxAutoScale.Checked = false;
             this.checkBoxZoomIn.Checked = false;
             this.checkBoxZoomOut.Checked = false;
             this.zoomOption = GraphCtrl.eZoomOption.Hand;
         }
         else
         {
             this.checkBoxHand.Image = (Image)Resources.Move;
             this.zoomOption = GraphCtrl.eZoomOption.None;
         }
     }
     this.Refresh();
 }
Example #3
0
 private void checkBoxAutoScale_Click(object sender, EventArgs e)
 {
     int tickCount = Environment.TickCount;
     if (tickCount - this.previousClick <= SystemInformation.DoubleClickTime)
     {
         this.checkBoxAutoScale.Image = (Image)Resources.AutoSelected;
         this.checkBoxZoomIn.Image = (Image)Resources.ZoomIn;
         this.checkBoxZoomOut.Image = (Image)Resources.ZoomOut;
         this.checkBoxHand.Image = (Image)Resources.Move;
         this.checkBoxAutoScale.Checked = true;
         this.zoomOption = GraphCtrl.eZoomOption.AutoScale;
     }
     else if (this.checkBoxAutoScale.Checked)
     {
         this.checkBoxAutoScale.Checked = false;
         this.checkBoxAutoScale.Image = (Image)Resources.Auto;
         this.zoomOption = GraphCtrl.eZoomOption.None;
     }
     this.previousClick = tickCount;
 }