Skyline TEP5.1.3二次开发入门——初级(六)

6.6  IContainer2

主要用来设置TerraExplorer中的泡泡等弹出信息和超链接信息等,提供添加、删除、编辑指定容器及其内容的方法;

 

SetURL

设置超链接地址;

RemoveURL

移除URL;

BringToFront

将设置的URL文件在容器前端显示;

SetMessageBarText

设置Message Bar Container信息;

HTMLPopup

显示HTML浮动窗口,可以显示文本或者网页内容;

 

 

代码示例:

【C#】

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using TerraExplorerX;

 

namespace ExCodeIContainer

{

    public partial class Form1 : Form

    {

        private TerraExplorer TE;

        private ITerraExplorer51 TE51;

        private IContainer2 IContainer;

 

        public Form1()

        {

            InitializeComponent();

 

            this.TE = new TerraExplorerClass();

            this.TE51 = (ITerraExplorer51)TE;

            this.IContainer = (IContainer2)TE;

 

            TE51.Load(Application.StartupPath + "\\Default.fly");

        }

 

        private void btnStart_Click(object sender, EventArgs e)

        {

            if (this.btnStart.Text == "打开")

            {

                IContainer.HTMLPopup(MsgType.TYPE_TEXT, 1, 1, 300, 100, "Skyline", "感谢您对Skyline的支持!", 0, -1);

                this.btnStart.Text = "关闭";

            }

            else

            {

                IContainer.RemoveURL(5, "Skyline");

                this.btnStart.Text = "打开";

            }

        }

    }

}

【javascript】

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="IContainer2.aspx.cs" Inherits="ExCode_IContainer2" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Skyline二次开发教程【配套示例】</title>   

    <script type ="text/javascript">

        function Init() {

            var TE = _$SGCreateTEObj();

            var ITerraExplorer = TE.interface("ITerraExplorer51");

            ITerraExplorer.Load("D:\\2010售前演示系统\\WPFA-DEMO\\WPFA-DEMO\\bin\\Debug\\FLY\\Default.fly");

        }

        function Test(obj) {

            var TE = _$SGCreateTEObj();

            var IContainer = TE.interface("IContainer2");

            if (obj.value == "打开") {

                IContainer.HTMLPopup(0, 1, 1, 300, 100, "Skyline", "感谢您对Skyline的支持!", 0, -1);

                obj.value = "关闭";

            }

            else {

                IContainer.RemoveURL(5, "Skyline");

                obj.value = "打开";

            }

        }

        //------------------------------------------------------------

        // 创建三维对象 赵贺 2009.01.25.

        //------------------------------------------------------------

        function _$SGCreateTEObj() {

            var obj = window.document.getElementById("TE");

            if (obj == null) {

                obj = document.createElement('object');

                document.body.appendChild(obj);

                obj.name = "TE";

                obj.id = "TE";

                obj.classid = "CLSID:3a4f9191-65a8-11d5-85c1-0001023952c1";

            }

            return obj;

        }

    </script>

</head>

<body onload = "Init()">

    <form id="form1" runat="server">

    <div id = "Title">

    <input id="Button1" type="button" value="打开" onclick = "Test(this)" />

    </div>

    <div id="Main">

        <object id="TerraExplorer3DWindow" classid="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1"

            width="521" height="521">

        </object>

    </div>

    </form>

</body>

</html>

 

 

posted @ 2011-05-16 18:06  依尔根觉罗天赫  阅读(1979)  评论(0编辑  收藏  举报