直接看代码:
1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Windows.Forms; 9 using TerraExplorerX; 10 11 namespace Multi3DDemo 12 { 13 public partial class Form1 : Form 14 { 15 private SGWorld61 mainSGWorld; 16 private SGWorld61 MainSGWorld 17 { 18 get 19 { 20 if (mainSGWorld == null) 21 mainSGWorld = new SGWorld61Class(); 22 return mainSGWorld; 23 } 24 } 25 26 private SGWorld61 sgworldEx; 27 private SGWorld61 SGWorldEx 28 { 29 get 30 { 31 if (sgworldEx == null) 32 { 33 sgworldEx = (SGWorld61)axTE3DWindowEx1.CreateInstance("TerraExplorerX.SGWorld61"); 34 } 35 return sgworldEx; 36 } 37 } 38 39 public Form1() 40 { 41 InitializeComponent(); 42 } 43 44 private void toolStripButton1_Click(object sender, EventArgs e) 45 { 46 OpenFileDialog dialog = new OpenFileDialog(); 47 dialog.Filter = "Fly文件(*.fly)|*.fly|Mpt文件(*.mpt)|*.mpt"; 48 if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) 49 return; 50 51 MainSGWorld.Project.Open(dialog.FileName, true); 52 } 53 54 private void toolStripButton2_Click(object sender, EventArgs e) 55 { 56 OpenFileDialog dialog = new OpenFileDialog(); 57 dialog.Filter = "Fly文件(*.fly)|*.fly|Mpt文件(*.mpt)|*.mpt"; 58 if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) 59 return; 60 61 SGWorldEx.Project.Open(dialog.FileName, true); 62 } 63 64 private void toolStripButton3_Click(object sender, EventArgs e) 65 { 66 MainSGWorld.Application.Multiple3DWindows.SetAsLeader(); 67 68 MainSGWorld.Application.Multiple3DWindows.LinkPosition(SGWorldEx); 69 } 70 71 private void Form1_Load(object sender, EventArgs e) 72 { 73 74 } 75 } 76 }