获取应用程序当前活动的窗口。

命名空间:  SuperMap.Desktop
程序集:  SuperMap.Desktop.Core (in SuperMap.Desktop.Core)
版本: dll

语法

C#
public static IForm ActiveForm { get; }

备注

如果应用程序当前活动的窗口对应的类没有实现 IForm 接口,则该属性值为空。

示例

CopyC#
// Application.ActiveForm 属性示例
void ActiveFormExample()
{
    IForm activeForm = SuperMap.Desktop.Application.ActiveForm;
    if (activeForm is IFormMap) // 当前激活的窗口是地图窗口
    {
        SuperMap.Mapping.Map map = (activeForm as IFormMap).MapControl.Map;
    }
    else if (activeForm is IFormScene) // 当前激活的窗口是场景窗口
    {
        SuperMap.Realspace.Scene scene = (activeForm as IFormScene).SceneControl.Scene;
    }
    else if (activeForm is IFormLayout) // 当前激活的窗口是布局窗口
    {
        SuperMap.Layout.MapLayout layout = (activeForm as IFormLayout).MapLayoutControl.MapLayout;
    }
    else if (activeForm is IFormTabular) // 当前激活的窗口是属性表窗口
    {
        SuperMap.Desktop.ITabularControl tabularControl = (this.FormClass as IFormTabular).TabularControl;
    }
    else // 当前激活的窗口是其他类型的窗口
    {
    }
}

请参见