private void InitializeImageBoxNew(GraphBox MyImageBoxNew) { MyImageBoxNew.CoordinateSystem = Enums.TypeCoordinateSystem.Polar; MyImageBoxNew.X0_Pol = MyImageBoxNew.Width / 2; MyImageBoxNew.Y0_Pol = MyImageBoxNew.Height / 2; MyImageBoxNew.X0_Dec = MyImageBoxNew.Width / 2; MyImageBoxNew.Y0_Dec = MyImageBoxNew.Height; MyImageBoxNew.Degrees = 30; MyImageBoxNew.StepRadius = 0.2F; MyImageBoxNew.CountLineX = 10; MyImageBoxNew.CountLineY = 10; MyImageBoxNew.Coef_X_Cartesian = MyImageBoxNew.Width / 360F; MyImageBoxNew.Coef_Y_Cartesian = MyImageBoxNew.Height / 1F; MyImageBoxNew.Coef_X_Polar = MyImageBoxNew.Width / 360F; MyImageBoxNew.Coef_Y_Polar = MyImageBoxNew.Height / 2F; MyImageBoxNew.PenDrawGraph = new Pen(Color.Red, 2); }
//определение коориднат курсора мыши при движении по pictuareBox #region //функции для определения значений #region private void ShowCoordinateInLabel(Label lb1, Label lb2, string TextForLabel1, string TextForLabel2, GraphBox imageBoxNew, MouseEventArgs e, float CoefficientX, float CoefficientY) { if (imageBoxNew.CoordinateSystem == Enums.TypeCoordinateSystem.Cartesian) { lb1.Text = "По оси X " + imageBoxNew.CoordinateX(e.X, imageBoxNew.x0, CoefficientX).ToString(); lb2.Text = "По оси Y " + imageBoxNew.CoordinateY(e.Y, imageBoxNew.y0, CoefficientY).ToString("0.00"); } if (imageBoxNew.CoordinateSystem == Enums.TypeCoordinateSystem.Polar) { lb1.Text = TextForLabel1 + " " + imageBoxNew.CoordinateR(e.X, e.Y, imageBoxNew.x0, imageBoxNew.y0, CoefficientY).ToString("0.00"); lb2.Text = TextForLabel2 + " " + imageBoxNew.CoordinateFi(e.X, e.Y, imageBoxNew.x0, imageBoxNew.y0).ToString("0.00") + ", град"; } }
private void ShowCoordinateInLabels(Label label1, Label label2, string textForFirstCoordinate, string textForSecondCoordinate, GraphBox imageBoxNew, MouseEventArgs e, float CoefficientX, float CoefficientY) { GetTextForFirstCoordinate(); label1.Text = String.Format(textForFirstCoordinate, imageBoxNew.GetFirstCoordinate(e.X, e.Y).ToString("0.00")); label2.Text = String.Format(textForSecondCoordinate, imageBoxNew.GetSecondCoordinate(e.X, e.Y).ToString("0.00")); }