private void KeyboardScrolling_Load(object sender, System.EventArgs e) { // Fill chart with random data Random random = new Random(); for (int pointIndex = 0; pointIndex < 150; pointIndex++) { chart1.Series["Default"].Points.AddY(random.Next(10, 3000)); } // Set focus chart1.Focus(); }
private void KeyboardZoomScroll_Load(object sender, System.EventArgs e) { // Fill chart with random data Random random = new Random(); for (int pointIndex = 0; pointIndex < 75; pointIndex++) { chart1.Series["Default"].Points.AddY(random.Next(10, 100)); } chart1.ChartAreas["Default"].CursorX.Position = 25; // Set focus chart1.Focus(); }
private void Create() { _form = new Form(); _form.Width = (int)(Screen.PrimaryScreen.Bounds.Width * 0.8); _form.Height = (int)(Screen.PrimaryScreen.Bounds.Height * 0.8); _form.Visible = false; //_form.FormClosing += (s, e) => { _form.Hide(); e.Cancel = true; }; //_form.FormClosing += form_FormClosing; _chart = new System.Windows.Forms.DataVisualization.Charting.Chart(); _form.Controls.Add(_chart); _chart.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right); _chart.SetBounds(0, 0, _form.Width, _form.Height - 50); //_chart.ChartAreas.Add(new ChartArea("Area1")); _chart.CursorPositionChanged += this.chart_CursorPositionChanged; _chart.KeyDown += this.chart_KeyDown; _chart.PreviewKeyDown += this.chart_PreviewKeyDown; _chart.MouseClick += _chart_MouseClick; _chart.Focus(); //_label = new Label(); //_form.Controls.Add(_label); //_label.Anchor = (AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right); //_label.Width = _form.Width - 50; //_label.Height = 30; //_label.Padding = new System.Windows.Forms.Padding(5); //_label.AutoSize = false; //_label.Enabled = true; //_label.Visible = true; //_label.TabIndex = 0; //_label.Location = new Point(0, 0); //_label.Name = "_label"; //_label.TextAlign = ContentAlignment.TopRight; //_labelBot = new Label(); //_form.Controls.Add(_labelBot); //_labelBot.Anchor = (AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right); //_labelBot.Width = _form.Width; //_labelBot.Enabled = true; ////_labelBot.Location = new Point(0, 10); //_labelBot.Visible = true; //_labelBot.Name = "_labelBot"; _form.Location = new Point(0, 20); IsAllowDispose = true; }
private void Chart1_Click(object sender, System.EventArgs e) { Chart1.Focus(); }