/// <summary> /// 制御点2X /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ChangeControlPoint2X(object sender, EventArgs e) { int num = CMath.ChageNomalPosX(numericUpDown3.Value); int num2 = m_CurvePointControl.SetControl2PointX(num); numericUpDown3.Value = CMath.ChageDecimalPosX(num2); if (!m_CurvePointControl.isMoveSelectPoint()) { pictureBox1.Refresh(); //再描画 } }
//保存されている点を描画 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> /// 文字列から座標に変換 /// </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); }