winform 程序 事件与事件 怎么处理?
点击 直线 按钮 后 开始画一条直线画直线要获得 2个点的坐标
这该怎么编码?
int x, y, x2, y2;
int Command=0;
//直线
private void btnCreateLine_Click(object sender, EventArgs e)
{
Command = 1;
}
//获得鼠标点的坐标
private void axDDVue_OnMouseDown(object sender, _DDDVueEvents_OnMouseDownEvent e)
{
if(Command == 1)
{
txtX.Text = e.lX.ToString();
txtY.Text = e.lY.ToString();
x = Convert.ToInt32(txtX.Text);
y =Convert.ToInt32(txtY.Text);
}
if(Command == 2)
{
MessageBox.Show("ss");
txtX2.Text = e.lX.ToString();
txtY2.Text = e.lY.ToString();
x2 = Convert.ToInt32(txtX2.Text);
y2 = Convert.ToInt32(txtY2.Text);
string str = "";
axDDVue.CreateLine(ref str, "modelspace", x, y, 0, x2, y2, 0); //画直线的方法
}
} --------------------编程问答-------------------- int x, y, x2, y2;
int Command=0;
//直线
private void btnCreateLine_Click(object sender, EventArgs e)
{
Command = 1;
}
//获得鼠标点的坐标
private void axDDVue_OnMouseDown(object sender, _DDDVueEvents_OnMouseDownEvent e)
{
if(Command == 1)
{
txtX.Text = e.lX.ToString();
txtY.Text = e.lY.ToString();
x = Convert.ToInt32(txtX.Text);
y =Convert.ToInt32(txtY.Text);
}
if(Command == 2)
{
MessageBox.Show("ss");
txtX2.Text = e.lX.ToString();
txtY2.Text = e.lY.ToString();
x2 = Convert.ToInt32(txtX2.Text);
y2 = Convert.ToInt32(txtY2.Text);
string str = "";
//axDDVue.CreateLine(ref str, "modelspace", x, y, 0, x2, y2, 0); //画直线的方法
}
axDDVue.CreateLine(ref str, "modelspace", x, y, 0, x2, y2, 0); //画直线的方法
} --------------------编程问答--------------------
第2个点 没有执行啊?
补充:.NET技术 , C#