示例#1
0
        void LoadData()
        {
            //this.Controls.Clear();
            m_AttributeToolWindow.listLinkageWindowControl.Items.Clear();
            if (Window == null)
            {
                return;
            }

            this.Width          = Window.Width;
            this.Height         = Window.Height;
            panelTop.Height     = Window.TopPanelHeight;
            panelBottom.Height  = Window.BottomPanelHeight;
            panelLeft.Width     = Window.LeftPanelWidth;
            panelRight.Width    = Window.RightPanelWidth;
            panelTop.Visible    = Window.TopPanelVisible;
            panelBottom.Visible = Window.BottomPanelVisible;
            panelLeft.Visible   = Window.LeftPanelVisible;
            panelRight.Visible  = Window.RightPanelVisible;

            List <CBaseObject> lstWindowControl = Window.WindowControlMgr.GetList();

            foreach (CBaseObject obj in lstWindowControl)
            {
                CWindowControl WindowControl = (CWindowControl)obj;
                Panel          panel         = null;
                if (WindowControl.Dock == (int)DockStyle.Top)
                {
                    panel = panelTop;
                }
                else if (WindowControl.Dock == (int)DockStyle.Bottom)
                {
                    panel = panelBottom;
                }
                else if (WindowControl.Dock == (int)DockStyle.Left)
                {
                    panel = panelLeft;
                }
                else if (WindowControl.Dock == (int)DockStyle.Right)
                {
                    panel = panelRight;
                }
                else
                {
                    panel = panelFill;
                }


                //联动控件
                ListViewItem itemLT = new ListViewItem();
                itemLT.Text = WindowControl.Name;
                itemLT.Tag  = WindowControl;
                m_AttributeToolWindow.listLinkageWindowControl.Items.Add(itemLT);
                //

                if (WindowControl.CtrlType == ControlType.NavBar)
                {
                    UIToolbarEl toolbar = new UIToolbarEl();
                    toolbar.WindowControl = WindowControl;
                    toolbar.Tag           = WindowControl;
                    panel.Controls.Add(toolbar);
                    toolbar.Dock = DockStyle.Fill;

                    toolbar.MouseClick += new MouseEventHandler(ctrl_MouseClick);
                }
                else if (WindowControl.CtrlType == ControlType.TableGrid)
                {
                    if (WindowControl.TableInWindowControlMgr.GetList().Count == 0)
                    {
                        continue;
                    }
                    CTableInWindowControl TableInWindowControl = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj();
                    CTable table = (CTable)Program.Ctx.TableMgr.Find(TableInWindowControl.FW_Table_id);
                    if (table == null)
                    {
                        continue;
                    }

                    TableGridEl te = new TableGridEl();
                    te.WindowControl        = WindowControl;
                    te.Name                 = table.Code;
                    te.TableInWindowControl = TableInWindowControl;
                    te.ShowToolBar          = TableInWindowControl.ShowToolBar;
                    te.ShowTitleBar         = TableInWindowControl.ShowTitleBar;
                    te.CaptionText          = WindowControl.Name;
                    te.Tag = WindowControl;
                    panel.Controls.Add(te);
                    te.Dock = (DockStyle)WindowControl.Dock;
                    te.BringToFront();



                    te.tbTitle.MouseClick    += new MouseEventHandler(childCtrl_MouseClick);
                    te.toolStrip.MouseClick  += new MouseEventHandler(childCtrl_MouseClick);
                    te.dataGridView.GotFocus += new EventHandler(ctrl_GotFocus);
                }
                else if (WindowControl.CtrlType == ControlType.TableTree)
                {
                    TableTreeEl tt = new TableTreeEl();
                    tt.CaptionText   = WindowControl.Name;
                    tt.ShowTitleBar  = WindowControl.ShowTitleBar;
                    tt.WindowControl = WindowControl;
                    tt.Tag           = WindowControl;
                    panel.Controls.Add(tt);
                    tt.Dock = DockStyle.Fill;
                    tt.BringToFront();

                    tt.tbTitle.MouseClick       += new MouseEventHandler(childCtrl_MouseClick);
                    tt.treeView.GotFocus        += new EventHandler(ctrl_GotFocus);
                    tt.treeView.ContextMenuStrip = contextMenuStrip1;
                }
                else if (WindowControl.CtrlType == ControlType.TableTab)
                {
                    TableTabEl tab = new TableTabEl();
                    tab.WindowControl = WindowControl;
                    tab.CaptionText   = "TabCtrl";
                    tab.ShowTitleBar  = WindowControl.ShowTitleBar;
                    tab.Tag           = WindowControl;
                    panel.Controls.Add(tab);
                    tab.Dock = DockStyle.Fill;
                    tab.BringToFront();

                    tab.tabControl.MouseClick += new MouseEventHandler(childCtrl_MouseClick);
                }
                else if (WindowControl.CtrlType == ControlType.ComboBox)
                {
                    UIComboBoxEl cb = new UIComboBoxEl();
                    cb.CaptionText   = WindowControl.Name + ":";
                    cb.WindowControl = WindowControl;
                    cb.ShowTitleBar  = WindowControl.ShowTitleBar;
                    cb.Tag           = WindowControl;
                    panel.Controls.Add(cb);
                    cb.Dock = DockStyle.Top;
                    cb.BringToFront();

                    cb.lbTitle.MouseClick  += new MouseEventHandler(childCtrl_MouseClick);
                    cb.comboBox.MouseClick += new MouseEventHandler(childCtrl_MouseClick);
                }
                else if (WindowControl.CtrlType == ControlType.ListBox)
                {
                    UIListBoxEl listBox = new UIListBoxEl();
                    listBox.CaptionText   = WindowControl.Name;
                    listBox.WindowControl = WindowControl;
                    listBox.ShowTitleBar  = WindowControl.ShowTitleBar;
                    listBox.Tag           = WindowControl;
                    panel.Controls.Add(listBox);
                    listBox.Dock = DockStyle.Fill;
                    listBox.BringToFront();

                    listBox.tbTitle.MouseClick += new MouseEventHandler(childCtrl_MouseClick);
                    listBox.listBox.MouseClick += new MouseEventHandler(childCtrl_MouseClick);
                    listBox.ContextMenuStrip    = contextMenuStrip1;
                }
            }
        }
示例#2
0
        public void UpdatePropertyGrid()
        {
            if (m_AttrType == AttrType.WindowControl)
            {
                if (ControlEl == null || ControlEl.Tag == null)
                {
                    return;
                }
                IDesignEl designEl = (IDesignEl)ControlEl;
                if (designEl.GetCtrlType() == ControlType.NavBar)
                {
                    UIToolbarEl   toolbar = (UIToolbarEl)ControlEl;
                    UIToolbarProp Setting = new UIToolbarProp();

                    Setting.称  = toolbar.WindowControl.Name;
                    Setting.宽度 = toolbar.Width;
                    Setting.高度 = toolbar.Height;
                    Setting.停靠 = toolbar.Dock;
                    propertyGrid.SelectedObject = Setting;
                    propertyGrid.Refresh();
                }
                else if (designEl.GetCtrlType() == ControlType.TableGrid)
                {
                    TableGridEl   te      = (TableGridEl)ControlEl;
                    TableGridProp Setting = new TableGridProp();
                    Setting.称     = te.WindowControl.Name;
                    Setting.宽度    = te.Width;
                    Setting.高度    = te.Height;
                    Setting.停靠    = te.Dock;
                    Setting.工具栏显示 = te.ShowToolBar;
                    Setting.标题栏显示 = te.ShowTitleBar;
                    propertyGrid.SelectedObject = Setting;
                    propertyGrid.Refresh();
                }
                else if (designEl.GetCtrlType() == ControlType.TableTree)
                {
                    TableTreeEl   tree    = (TableTreeEl)ControlEl;
                    TableTreeProp Setting = new TableTreeProp();
                    Setting.称     = tree.WindowControl.Name;
                    Setting.宽度    = tree.Width;
                    Setting.高度    = tree.Height;
                    Setting.停靠    = tree.Dock;
                    Setting.标题栏显示 = tree.ShowTitleBar;
                    propertyGrid.SelectedObject = Setting;
                    propertyGrid.Refresh();
                }
                else if (designEl.GetCtrlType() == ControlType.ListBox)
                {
                    UIListBoxEl   list    = (UIListBoxEl)ControlEl;
                    UIListBoxProp Setting = new UIListBoxProp();
                    Setting.称     = list.WindowControl.Name;
                    Setting.宽度    = list.Width;
                    Setting.高度    = list.Height;
                    Setting.停靠    = list.Dock;
                    Setting.标题栏显示 = list.ShowTitleBar;
                    propertyGrid.SelectedObject = Setting;
                    propertyGrid.Refresh();
                }
                else if (designEl.GetCtrlType() == ControlType.ComboBox)
                {
                    UIComboBoxEl   combo   = (UIComboBoxEl)ControlEl;
                    UIComboBoxProp Setting = new UIComboBoxProp();
                    Setting.称     = combo.WindowControl.Name;
                    Setting.宽度    = combo.Width;
                    Setting.高度    = combo.Height;
                    Setting.停靠    = combo.Dock;
                    Setting.标题栏显示 = combo.ShowTitleBar;
                    propertyGrid.SelectedObject = Setting;
                    propertyGrid.Refresh();
                }
                else if (designEl.GetCtrlType() == ControlType.TableTab)
                {
                    TableTabEl   tab     = (TableTabEl)ControlEl;
                    TableGridEl  grid    = tab.GetCurTableGridEl();
                    TableTabProp Setting = new TableTabProp();
                    Setting.称     = tab.WindowControl.Name;
                    Setting.宽度    = tab.Width;
                    Setting.高度    = tab.Height;
                    Setting.停靠    = tab.Dock;
                    Setting.工具栏显示 = grid.ShowToolBar;
                    Setting.标题栏显示 = tab.ShowTitleBar;
                    propertyGrid.SelectedObject = Setting;
                    propertyGrid.Refresh();
                }
            }
            else
            {
                if (WindowEl == null || WindowEl.Window == null)
                {
                    return;
                }

                ChildenWindowProp Setting = new ChildenWindowProp();
                Setting.称  = WindowEl.Window.Name;
                Setting.宽度 = WindowEl.Width;
                Setting.高度 = WindowEl.Height;
                propertyGrid.SelectedObject = Setting;
                propertyGrid.Refresh();
            }
        }