chpmould 发表于 2010-11-25 00:33:00

保存和恢复图层设置

<p><font face="Verdana"><font face="Verdana">帮助文件中的<font color="#0000ff">保存</font>和<font color="#0000ff">恢复</font><font color="#000000">图层设置</font>是做什么用的,一般用在什么情况下?</font></font></p>

雪山飞狐_lzh 发表于 2010-11-25 09:47:00

哪里的,你直接把相关的内容贴过来吧

chpmould 发表于 2010-11-25 12:30:00

public static void SaveLayerColorAndLinetype()
{
document
Document acDoc = Application.DocumentManager.MdiActiveDocument;

LayerStateManager acLyrStMan;
acLyrStMan = acDoc.Database.LayerStateManager;

string sLyrStName = "ColorLinetype";

if (acLyrStMan.HasLayerState(sLyrStName) == false)
{
acLyrStMan.SaveLayerState(sLyrStName,
LayerStateMasks.Color |
LayerStateMasks.LineType,
ObjectId.Null);
}
}
public static void RestoreLayerState()
{
document
Document acDoc = Application.DocumentManager.MdiActiveDocument;

LayerStateManager acLyrStMan;
acLyrStMan = acDoc.Database.LayerStateManager;

string sLyrStName = "ColorLinetype";

if (acLyrStMan.HasLayerState(sLyrStName) == true)
{
acLyrStMan.RestoreLayerState(sLyrStName,
ObjectId.Null,
1,
LayerStateMasks.Color |
LayerStateMasks.LineType);
}
}

雪山飞狐_lzh 发表于 2010-11-25 12:42:00

<p>临时更改图层用途的时候可能会用到</p>
<p>不过如果正规作图很少有这种需求</p>

chpmould 发表于 2010-11-25 20:00:00

谢谢...
页: [1]
查看完整版本: 保存和恢复图层设置