码迷,mamicode.com
首页 > Windows程序 > 详细

如何将Skyline66嵌入WPF中

时间:2018-06-09 16:41:34      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:bis   ade   lob   trie   word   sum   添加   mod   sas   

1.新建WPF项目;

2.添加引用

.net引用:System.Windows.Forms和WindowsFormsIntegration

skyline引用:AxInterop.TerraExplorerX和TerraExplorerX

3.代码如下:

/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
private SGWorld66 sgWorld = null;
public MainWindow()
{
InitializeComponent();

WindowsFormsHost host = new WindowsFormsHost();
AxTerraExplorerX.AxTE3DWindow axTE3DWindow1 = new AxTerraExplorerX.AxTE3DWindow();
host.Child = axTE3DWindow1;
this.globeWindow.Children.Add(host);

this.globeWindow.Loaded += GlobeWindow_Loaded;
}

private void GlobeWindow_Loaded(object sender, RoutedEventArgs e)
{
this.OpenProject();
}

private void OpenProject()
{
string tMsg = String.Empty;
// A. Set Project "Open" Method parameters
string tProjectUrl = @"D:\软件开发\Skyline\使用的Fly\Default.fly";

bool bIsAsync = false;
string tUser = String.Empty;
string tPassword = String.Empty;
// B. Instantiate Terra Explorer Globe and retrieve Project Interface

try
{
sgWorld = new SGWorld66();
// D. Open Project in synchronous mode
sgWorld.Project.Open(tProjectUrl, bIsAsync, tUser, tPassword);
}
catch (Exception ex)
{
tMsg = String.Format("OpenProjectButton_Click Exception: {0}", ex.Message);
MessageBox.Show(tMsg);
}
}

}

如何将Skyline66嵌入WPF中

标签:bis   ade   lob   trie   word   sum   添加   mod   sas   

原文地址:https://www.cnblogs.com/huangwei1992/p/9159720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!