查看单个帖子
旧 2009-04-21, 06:26 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】请帮我看一下这段程序的问题出在哪里?

请帮我看一下这段程序的问题出在哪里?
www.dimcax.com
请帮我看一下这段程序的问题出在哪里?
在arx_all\samples\graphics下有个visualstyle,它用了acdbgetviewportvisualstyle()来获取当前viewport的样式,可.net里好像没有类似的功能。于是写了下面的程序,可是执行时出现奇怪的问题。就是,使用vscurrent设置样式后,它都能正确地返回当前的样式,可是用它来设置样式时,没有反应,而且用vscurrent并没有返回设置的样式。在database中的public objectidcollection getviewports( bool bgetpaperspacevports )中并不包含模型空间,那么在database中似乎只有viewporttableid可用了。另外想问一下,xfadectl控制的是什么值?应该怎样访问? public void setcurrentviewportvisualstyle() { database db = hostapplicationservices.workingdatabase; editor ed = acadapp.documentmanager.mdiactivedocument.editor; transaction trans = db.transactionmanager.starttransaction(); dbdictionary dict = (dbdictionary)trans.getobject(db.visualstyledictionaryid, openmode.forread); dbdictionaryentry[] entry = new dbdictionaryentry[dict.count]; viewporttable table = (viewporttable)trans.getobject(db.viewporttableid, openmode.forread); if (table.has("*active")) { viewporttablerecord vptrecord = (viewporttablerecord)trans.getobject(table["*active"], openmode.forwrite); dbvisualstyle dbstyle = (dbvisualstyle)trans.getobject(vptrecord.visualstyleid, openmode.forwrite); ed.writemessage("current visual style: {0}\n", dbstyle.description); promptkeywordoptions koptions = new promptkeywordoptions("enter an option: 2d wireframe/3d hidden/3d wireframe/conceptual/realistic"); koptions.keywords.add("2"); koptions.keywords.add("h"); koptions.keywords.add("3"); koptions.keywords.add("c"); koptions.keywords.add("r"); promptresult result = ed.getkeywords(koptions); if (result.status == promptstatus.ok) { string vsopt = null; switch (result.stringresult) { case "2": vsopt = "2dwireframe"; break; case "h": vsopt = "3d hidden"; break; case "3": vsopt = "3dwireframe"; break; case "c": vsopt = "conceptual"; break; case "r": vsopt = "realistic"; break; } if (vsopt != null) { vptrecord.visualstyleid = dict.getat(vsopt); } } } trans.commit(); }
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)