/// <summary> /// 制御点2Y /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ChangeControlPoint2Y(object sender, EventArgs e) { int num = CMath.ChageNomalPosY(numericUpDown6.Value); int num2 = m_CurvePointControl.SetControl2PointY(num); numericUpDown6.Value = CMath.ChageDecimalPosY(num2); if (!m_CurvePointControl.isMoveSelectPoint()) { pictureBox1.Refresh(); //再描画 } }
/// <summary> /// 終了点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ChangeEndPoint(object sender, EventArgs e) { int num = CMath.ChageNomalPosY(numericUpDown7.Value); int num2 = m_CurvePointControl.SetEndPoint(num);; numericUpDown7.Value = CMath.ChageDecimalPosY(num2); if (!m_CurvePointControl.isMoveSelectPoint()) { pictureBox1.Refresh(); //再描画 } bp = m_CurvePointControl.GetBezierPoint(); }
//保存されている点を描画 public void PaintGraph(PaintEventArgs e) { var pontcnt = m_list.Count(); for (int i = 0; i <= 100; i++) { int x = CMath.ChageNomalPosX((decimal)(0.01f * i)); int y = CMath.ChageNomalPosY(EvaluateY((decimal)(0.01f * i))); //保存されている点を描画 e.Graphics.FillEllipse(m_PointColor, x - m_cpSize / 2, y - m_cpSize / 2, m_cpSize, m_cpSize); } TestPrint(); }
/// <summary> /// 選択点Y /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ChangeSelectPointY(object sender, EventArgs e) { int num = CMath.ChageNomalPosY(numericUpDown4.Value); int num2 = m_CurvePointControl.SetStartPointY(num); numericUpDown4.Value = CMath.ChageDecimalPosY(num2); if (!m_CurvePointControl.isMoveSelectPoint()) { pictureBox1.Refresh(); //再描画 } //最初の開始点と同期を取る numericUpDown8.Value = CMath.ChageDecimalPosY(m_CurvePointControl.GetFirstStartPointY()); }
/// <summary> /// 文字列から座標に変換 /// </summary> /// <param name="values"></param> CurvePointControl.BezierPoint ToBezierPoint(string[] values) { //文字列を数値に変換 CurvePointControl.BezierPoint bp = new CurvePointControl.BezierPoint(); try { bp.startPoint.X = CMath.ChageNomalPosX(decimal.Parse(values[0])); bp.startPoint.Y = CMath.ChageNomalPosY(decimal.Parse(values[1])); bp.controlPoint1.X = CMath.ChageNomalPosX(decimal.Parse(values[2])); bp.controlPoint1.Y = CMath.ChageNomalPosY(decimal.Parse(values[3])); bp.controlPoint2.X = CMath.ChageNomalPosX(decimal.Parse(values[4])); bp.controlPoint2.Y = CMath.ChageNomalPosY(decimal.Parse(values[5])); bp.endPoint.X = CMath.ChageNomalPosX(decimal.Parse(values[6])); bp.endPoint.Y = CMath.ChageNomalPosY(decimal.Parse(values[7])); } catch (Exception e) { MessageBox.Show(e.Message); Console.WriteLine(e.Message); // エラーメッセージを表示 } return(bp); }