代码的合并
我现在要将一段独立的画圆的代码合并到程序里,但是在合并过程中许多关键字出错
在合并的时候应该注意些什么问题啊?才接触C#不久,所以很多地方知道。麻烦大虾门指教。下面就是独立的画圆的代码
public Rectangle GetEllopse(Point p_CenterPoint, int p_Radius)
{
int _X = p_CenterPoint.X - p_Radius;
int _Y = p_CenterPoint.Y - p_Radius;
return new Rectangle(_X, _Y, p_Radius * 2, p_Radius * 2);
}
public void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (m_Panit)
{
Graphics _Graphics = pictureBox1.CreateGraphics();
_Graphics.Clear(pictureBox1.BackColor);
int _RadiusW = m_Point.X - e.X;
int _RadiusH = m_Point.Y - e.Y;
_RadiusH = Math.Abs(_RadiusH);
_RadiusW = Math.Abs(_RadiusW);
if (_RadiusW > _RadiusH) _RadiusH = _RadiusW;
Rectangle _EllopseRectangle = GetEllopse(m_Point, _RadiusH);
_Graphics.DrawEllipse(new Pen(Brushes.Red, 2), _EllopseRectangle);
_Graphics.Dispose();
}
}
/// <summary>
/// 绘制标示
/// </summary>
public bool m_Panit = false;
/// <summary>
/// 开始坐标
/// </summary>
public Point m_Point = new Point(0, 0);
public void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
m_Panit = true;
m_Point.X = e.X;
m_Point.Y = e.Y;
}
public void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
m_Panit = false;
}