ArcEngine中sxd文档的保存方法

 

ContractedBlock.gif ExpandedBlockStart.gif 代码
 
     
// 打开自保存文档
IMemoryBlobStream mbStream = new MemoryBlobStreamClass();
IObjectStream objectStream
= new ObjectStreamClass();
objectStream.Stream
= mbStream;
IPersistStream persistStream
= axSceneControl1.Scene;

OPenFileDialog ofDialog
= new OpenFileDialog();
ofDialog.Title
= " 打开自保存Scene文档 " ;
ofDialog.Filter
= " 自定义Scene文档(*.csxd)|*.csxd " ;
sfDialog.ShowDialog();
string fileName = sfDialog.FileName;

mbStream 。LoadFromFile(fileName );
persistStream .Load(objectStream);

  自定义保存Scene场景文档,但是无法在ArcScene中打开……

 

ContractedBlock.gif ExpandedBlockStart.gif 代码
 
     
IMemoryBlobStream mbStream = new MemoryBlobStreamClass();
IObjectStream objectStream
= new ObjectStreamClass();
objectStream.Stream
= mbStream;
IPersistStream persistStream
= axSceneControl1.Scene;
persistStream.Save(objectStream,
1 );

SaveFileDialog sfDialog
= new SaveFileDialog();
sfDialog.Title
= " 保存Scene文档 " ;
sfDialog.Filter
= " 自定义Scene文档(*.csxd)|*.csxd " ;
sfDialog.ShowDialog();
string fileName = sfDialog.FileName;

if (fileName == string .Empty)
MessageBox.Show(
" 文档名称不能为空! " , " 名称不能为空 " , MessageBoxButtons.OK, MessageBoxIcon.Error);
else
mbStream.SaveToFile(fileName);

MessageBox.Show(
" 文档保存成功! " );

 

转载于:https://www.cnblogs.com/St_Dlng/archive/2010/08/30/1813047.html

你可能感兴趣的:(ArcEngine中sxd文档的保存方法)