com下获取屏幕点取的点
private void 获取对象名称_Click(object sender, EventArgs e){
Microsoft.VisualBasic.Interaction.AppActivate(AcadApp.Caption);
object returnObj,pickPoint;
string pickPrompt = "选取物体对象!";
double[] pickPointArray;
AcadDoc.Utility.GetEntity(out returnObj, out pickPoint, pickPrompt);
AcadObject returnCADObj = (AcadObject)returnObj;
pickPointArray =(Double[])pickPoint;
MessageBox.Show("选取对象为:" + returnCADObj.ObjectName.ToString());
MessageBox.Show("点击位置:X=" + pickPointArray.ToString() + ",Y=" +
pickPointArray.ToString() + ",Z=" + pickPointArray.ToString());
Microsoft.VisualBasic.Interaction.AppActivate(this.Text);
}
书上的方法是这样的 但是当在屏幕空白处点击孤立点时就报错,请问如何获取屏幕空白处点选的点的坐标?
已经解决
object nullpt = Type.Missing;
pickPointArray=(double[]) AcadDoc.Utility.GetPoint( nullpt,"选择点"); 可以用try catch来捕捉错误吧
页:
[1]