sonny_wu 发表于 2010-4-26 17:08:00

PromptPointOptions的问题求助

<p><strong>我想通过下列语句</strong></p><p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PromptPointOptions ppo = new PromptPointOptions("指定插入点\n:");<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double x = ed.GetPoint(ppo).Value.X;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double y = ed.GetPoint(ppo).Value.Y; </strong></p><p><strong>获取指定点的X值和Y值。</strong></p><p><strong>但是出现个问题,就是要点2次才能获得X,Y的值,我试过单独获取X值把double y = ed.GetPoint(ppo).Value.Y; 去掉,就只需点一下了。</strong></p><p><strong>有什么办法可以让我只点一下 就获取2个值?</strong></p>

sonny_wu 发表于 2010-4-26 17:24:00

我自己想到办法了,

carrot1983 发表于 2010-4-27 11:26:00

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PromptPointOptions pPtOpts = new PromptPointOptions("\n指定点: ");<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PromptPointResult pPtRes = ed.GetPoint(pPtOpts);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Point3d pt = pPtRes.Value;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double x = pt.X;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double y = pt.Y;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ed.WriteMessage("X值:" + "{0}" + " Y值:" + "{1}", x, y);
页: [1]
查看完整版本: PromptPointOptions的问题求助