using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Second_ver { public partial class Form1 : Form { public Form1() { InitializeComponent(); sphere.Visible = true; anillo_arriba.Visible = false; anillo_abajo.Visible = false; simulation.Visible = true; contador(); KeyPreview = false; } //Keypress event private void Form1_KeyPress(object sender, KeyPressEventArgs e) { //Variable for the moviment of the pictures int up_down, left_right; left_right = sphere.Location.X; up_down = sphere.Location.Y; if (e.KeyChar == 119) { //Wich picture is able to see sphere.Visible = false; anillo_arriba.Visible = true; anillo_abajo.Visible = false; //Points that are going to move the picture anillo_abajo.Location = new Point(left_right, up_down - 5); anillo_arriba.Location = new Point(left_right, up_down - 5); sphere.Location = new Point(left_right, up_down - 5); } if (e.KeyChar == 115) { //Wich picture is able to see sphere.Visible = false; anillo_arriba.Visible = false; anillo_abajo.Visible = true; //Points that are going to move the picture anillo_abajo.Location = new Point(left_right, up_down + 5); anillo_arriba.Location = new Point(left_right, up_down + 5); sphere.Location = new Point(left_right, up_down + 5); } double function(double x) { return (Math.Sin(x)); //Función de gráfica } chart1.ChartAreas[0].AxisY.ScaleView.Zoom(-10, 10); //Escala en Y chart1.ChartAreas[0].AxisX.ScaleView.Zoom(-5, 5);//Escala en X chart1.ChartAreas[0].CursorX.IsUserEnabled = true; chart1.ChartAreas[0].CursorY.IsUserEnabled = true; chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; chart1.ChartAreas[0].CursorY.IsUserSelectionEnabled = true; chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true; for (int i = -10; i < 10; i++) { chart1.Series[0].Points.AddXY(i, function(i)); chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)