Example #1
0
        public void OpenAttributeWindow(GISLayer layer)
        {
            AttributeForm AttributeWindow = null;

            //如果属性窗口之前已经存在了,就找到它,然后移除记录,稍后统一添加
            if (AllAttWnds.ContainsKey(layer))
            {
                AttributeWindow = AllAttWnds[layer];
                AllAttWnds.Remove(layer);
            }
            //如果属性窗口没有初始化 则初始化
            if (AttributeWindow == null)
            {
                AttributeWindow = new AttributeForm(layer, this);
            }
            //如果窗口资源被释放了 则初始化
            if (AttributeWindow.IsDisposed)
            {
                AttributeWindow = new AttributeForm(layer, this);
            }
            //添加属性窗口与图层的关联记录
            AllAttWnds.Add(layer, AttributeWindow);

            //显示窗口属性
            AttributeWindow.Show();
            //如果属性窗口最小化了 令他正常显示
            if (AttributeWindow.WindowState == FormWindowState.Minimized)
            {
                AttributeWindow.WindowState = FormWindowState.Normal;
            }
            //吧属性窗口放在最前端显示
            AttributeWindow.BringToFront();
        }