代码
// 打开自保存文档
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);
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中打开……
代码
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( " 文档保存成功! " );
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( " 文档保存成功! " );