Ejemplo n.º 1
0
        private void SetupZOrder(List <DockingControl> dockingControls)
        {
            System.Diagnostics.Debug.Assert(dockingControls.Count == _splitters.Count + 1);

            for (int dockingControlIndex = 0; dockingControlIndex < dockingControls.Count; dockingControlIndex += 1)
            {
                DockingControl control = dockingControls[dockingControlIndex];
                control.BringToFront();

                if (dockingControlIndex < _splitters.Count)
                {
                    Splitter splitter = _splitters[dockingControlIndex];
                    splitter.BringToFront();
                }
            }
        }
Ejemplo n.º 2
0
        void CreateSplitter()
        {
            this.SuspendLayout();

            System.Windows.Forms.Splitter splitter = new Splitter();
            splitter.Dock      = DockStyle.Top;
            splitter.BackColor = SystemColors.ControlDark;
            splitter.Enabled   = false;
            splitter.Height    = 1;

            this.Controls.Add(splitter);

            this.ResumeLayout();

            splitter.BringToFront();
            this.dataGrid1.BringToFront();
        }
Ejemplo n.º 3
0
        public void RenderDataTable(IScriptEditor editor, DataTable tbl)
        {
            if (IsExecutingAsync)
            {
                throw new Exception("Query is already executing!");
            }

            _tables.Add(tbl);
            PragmaDataGridView grd = new PragmaDataGridView();

            grd.StatusAlwaysVisible = true;

            if (editor != null)
            {
                editor.PrepareAddInSupportForResultContextMenu(grd.PopupMenu.Items);
            }

            pan.Controls.Add(grd);
            grd.Parent = pan;
            grd.Height = _gridHeight;

            grd.Left = 0;
            grd.Top  = Int32.MaxValue - 100;
            grd.Dock = DockStyle.Top;
            grd.RenderDataTable(tbl);
            grd.Enter += new EventHandler(grd_Enter);
            _grids.Add(grd);
            grd.BringToFront();
            Splitter splt = null;

            if (true)
            {
                splt = new Splitter();
                splt.SplitterMoved  += new SplitterEventHandler(splt_SplitterMoved);
                splt.SplitterMoving += new SplitterEventHandler(splt_SplitterMoving);
                splt.BackColor       = _splitterBackColor;
                splt.MinExtra        = 15;
                splt.MinSize         = 15;
                pan.Controls.Add(splt);
                splt.Dock = DockStyle.Top;
                splt.BringToFront();
            }

            pan.Height += grd.Height + (splt != null ? splt.Height : 0);
        }
Ejemplo n.º 4
0
        private void AddSplitter(DockStyle ds)
        {
            Splitter sl = new Splitter();

            sl.Dock = ds;
            this.Controls.Add(sl);
            sl.BringToFront();
            lst.Add(sl);
            sl.MouseDown += (object send, MouseEventArgs e) =>
            {
                sl.Tag     = "True";
                enterPoint = Control.MousePosition;
            };
            sl.MouseMove += (object send, MouseEventArgs e) =>
            {
                if (sl.Tag != null && sl.Tag.ToString() == "True")
                {
                    {
                        Point p = Control.MousePosition;
                        #region   面代码可能可以用更好的方式进行实现
                        switch (ds)
                        {
                        case DockStyle.Left:
                            if (sl.Cursor == System.Windows.Forms.Cursors.SizeWE)
                            {
                                MoveLeft(p);
                            }
                            else if (sl.Cursor == System.Windows.Forms.Cursors.SizeNWSE)        //左上角
                            {
                                MoveLeftTop(p);
                            }
                            else if (sl.Cursor == System.Windows.Forms.Cursors.SizeNESW)        //左下角
                            {
                                MoveLeftBottom(p);
                            }
                            break;

                        case DockStyle.Right:
                            if (sl.Cursor == System.Windows.Forms.Cursors.SizeWE)
                            {
                                MoveRight(p);
                            }
                            else if (sl.Cursor == System.Windows.Forms.Cursors.SizeNESW)        //右上角
                            {
                                MoveRightTop(p);
                            }
                            else if (sl.Cursor == System.Windows.Forms.Cursors.SizeNWSE)        //右下角
                            {
                                MoveRightBottom(p);
                            }
                            break;;

                        case DockStyle.Top:
                            if (sl.Cursor == System.Windows.Forms.Cursors.SizeNS)         //上
                            {
                                MoveTop(p);
                            }
                            else if (sl.Cursor == System.Windows.Forms.Cursors.SizeNWSE)        //左上角
                            {
                                MoveLeftTop(p);
                            }
                            else if (sl.Cursor == System.Windows.Forms.Cursors.SizeNESW)        //右上角
                            {
                                MoveRightTop(p);
                            }
                            break;

                        case DockStyle.Bottom:
                            if (sl.Cursor == System.Windows.Forms.Cursors.SizeNS)
                            {
                                MoveBottom(p);
                            }
                            else if (sl.Cursor == System.Windows.Forms.Cursors.SizeNWSE)        //右下角
                            {
                                MoveRightBottom(p);
                            }
                            else if (sl.Cursor == System.Windows.Forms.Cursors.SizeNESW)        //左下角
                            {
                                MoveLeftBottom(p);
                            }
                            break;
                        }
                        #endregion

                        lastMoveTime = DateTime.Now;   //记录上次移动的时间  这个为了防止经常刷新页面导致的 闪动  后期可以考虑重写onpaint方法
                    }
                }
                else
                {
                    //相对于panel 的鼠标位置
                    Point mouseToPanel = this.PointToClient(Control.MousePosition);

                    //必须DockStyle.None才允许脚上被选中
                    if (this.Dock == DockStyle.None)
                    {
                        //左上角和右下角
                        if (((mouseToPanel.X.Between(0, SplitterWidth) && mouseToPanel.Y.Between(0, SplitterWidth) && AllowExtendTop && AllowExtendLeft) || (mouseToPanel.X.Between(this.Width - SplitterWidth, this.Width) && mouseToPanel.Y.Between(this.Height - SplitterWidth, this.Height) && AllowExtendBottom && AllowExtendRight)))
                        {
                            sl.Cursor = System.Windows.Forms.Cursors.SizeNWSE;
                        }
                        //左下角和右上角
                        else if (((mouseToPanel.X.Between(0, SplitterWidth) && mouseToPanel.Y.Between(this.Height - SplitterWidth, this.Height) && AllowExtendBottom && AllowExtendLeft) || (mouseToPanel.X.Between(this.Width - SplitterWidth, this.Width) && mouseToPanel.Y.Between(0, SplitterWidth) && AllowExtendTop && AllowExtendRight)))
                        {
                            sl.Cursor = System.Windows.Forms.Cursors.SizeNESW;
                        }
                        else
                        {
                            switch (ds)
                            {
                            case DockStyle.Left:
                            case DockStyle.Right: sl.Cursor = System.Windows.Forms.Cursors.SizeWE; break;

                            case DockStyle.Top:
                            case DockStyle.Bottom: sl.Cursor = System.Windows.Forms.Cursors.SizeNS; break;
                            }
                        }
                    }
                    else if (this.Dock == DockStyle.Left && ds == DockStyle.Right)
                    {
                        sl.Cursor = System.Windows.Forms.Cursors.SizeWE;
                    }
                    else if (this.Dock == DockStyle.Right && ds == DockStyle.Left)
                    {
                        sl.Cursor = System.Windows.Forms.Cursors.SizeWE;
                    }
                    else if (this.Dock == DockStyle.Top && ds == DockStyle.Bottom)
                    {
                        sl.Cursor = System.Windows.Forms.Cursors.SizeNS;
                    }
                    else if (this.Dock == DockStyle.Bottom && ds == DockStyle.Top)
                    {
                        sl.Cursor = System.Windows.Forms.Cursors.SizeNS;
                    }
                    else
                    {
                        sl.Cursor = System.Windows.Forms.Cursors.Default;
                    }
                }
            };
            sl.MouseUp += (object send, MouseEventArgs e) =>
            {
                sl.Tag = "False";
            };
        }
Ejemplo n.º 5
0
        private void init_Control()
        {
            this.Padding         = App.FormBorder;
            this.BackColor       = App.ColorBorder;
            this.FormBorderStyle = FormBorderStyle.None;
            this.ClientSize      = new Size(App.Width, 555);

            ////////////////////////////////////////////////////

            #region [ === MENU === ]

            MenuStrip menu = new MenuStrip()
            {
                Dock = DockStyle.Top, BackColor = App.ColorBg
            };
            //ToolStripTextBox mn_DbSearch = new ToolStripTextBox() { Width = left_Width, BorderStyle = BorderStyle.FixedSingle, BackColor = Color.LightGray };
            lbl_Title = new ToolStripLabel()
            {
                Text = "// ... ", ForeColor = Color.White,
            };
            ToolStripMenuItem mn = new ToolStripMenuItem()
            {
                Text = "MODEL", ForeColor = Color.White, Alignment = ToolStripItemAlignment.Right,
            };
            var mn_ModelAdd = new ToolStripMenuItem()
            {
                Text = "Model Add"
            };
            mn_ModelAdd.Click += (se, ev) => model_Add();
            var mn_ModelConfig = new ToolStripMenuItem()
            {
                Text = "Model Config"
            };
            mn_ModelConfig.Click += (se, ev) => model_Config();
            var mn_ModelEdit = new ToolStripMenuItem()
            {
                Text = "Model Edit"
            };
            mn_ModelEdit.Click += (se, ev) => model_Edit();
            var mn_ModelRemove = new ToolStripMenuItem()
            {
                Text = "Model Remove"
            };
            mn_ModelRemove.Click += (se, ev) => model_Remove();
            var mn_ItemAdd = new ToolStripMenuItem()
            {
                Text = "Item Add"
            };
            mn_ItemAdd.Click += (se, ev) => item_Add();
            mn.DropDownItems.AddRange(new ToolStripItem[] { mn_ModelAdd, mn_ModelConfig, mn_ModelEdit, mn_ModelRemove, mn_ItemAdd });
            ToolStripItem mn_Hide = new ToolStripMenuItem()
            {
                Text = "HIDE", ForeColor = Color.White, Alignment = ToolStripItemAlignment.Right
            };
            ToolStripItem mn_Exit = new ToolStripMenuItem()
            {
                Text = "EXIT", ForeColor = Color.White, Alignment = ToolStripItemAlignment.Right,
            };
            mn_Hide.Click += (se, ev) => { this.Hide(); };
            mn_Exit.Click += (se, ev) => { if (OnExit != null)
                                           {
                                               OnExit();
                                           }
            };
            menu.Items.AddRange(new ToolStripItem[] { lbl_Title, mn_Exit, mn_Hide, mn, });
            menu.MouseDown += Label_MouseDown;
            this.Controls.Add(menu);

            #endregion

            ////////////////////////////////////////////////////

            #region [ === FORM - BOX LEFT === ]

            Panel box_Left = new Panel()
            {
                Dock = DockStyle.Left, Width = App.col_Left_Width, BackColor = Color.White, Margin = new Padding(0), Padding = new Padding(0),
            };
            TextBox txt_Search = new TextBox()
            {
                Dock = DockStyle.Top, BackColor = App.ColorControl, Width = 100, Height = 20, Margin = new Padding(10, 10, 0, 0), Text = "", BorderStyle = BorderStyle.FixedSingle
            };

            CustomScrollbar scrollbar1 = new CustomScrollbar()
            {
                Dock = DockStyle.Left,

                ActiveBackColor = Color.White,
                BackColor       = Color.White,

                LargeChange = 10,
                Location    = new Point(306, 12),
                Maximum     = 99,
                Minimum     = 0,
                Size        = new Size(13, 303),
                SmallChange = 1,
                TabIndex    = 1,
                ThumbStyle  = CustomScrollbar.ThumbStyleEnum.Auto,
                Value       = 0,
                Margin      = new Padding(0),
                Padding     = new Padding(0),
            };
            //ScrollbarStyleHelper.ApplyStyle(scrollbar1, ScrollbarStyleHelper.StyleTypeEnum.Blue);
            ScrollbarStyleHelper.ApplyStyle(scrollbar1, ScrollbarStyleHelper.StyleTypeEnum.Black);

            listDB = new CustomListView(true)
            {
                Dock        = DockStyle.Fill,
                BorderStyle = BorderStyle.None,
                BackColor   = Color.WhiteSmoke,

                HeaderStyle   = ColumnHeaderStyle.None,
                FullRowSelect = true,
                //HideSelection = false,
                //Location = new Point(12, 12),
                MultiSelect = false,
                //Size = new Size(288, 303),
                UseCompatibleStateImageBehavior = false,
                View       = View.Details,
                VScrollbar = new ScrollbarCollector(scrollbar1),
            };
            listDB.Columns.AddRange(new ColumnHeader[] { new ColumnHeader()
                                                         {
                                                             Text = "", Width = App.col_Left_Width
                                                         } });

            box_Left.Controls.AddRange(new Control[] {
                txt_Search,
                listDB,
                scrollbar1,
            });

            listDB.BeginUpdate();
            for (int x = 0; x < dbName.Length; x++)
            {
                listDB.Items.Add(dbName[x]);
            }
            //for (int x = dbName.Length; x < 999; x++) listDB.Items.Add("Auto test " + x.ToString());
            listDB.EndUpdate();

            this.Controls.Add(box_Left);
            scrollbar1.BringToFront();

            #endregion

            ////////////////////////////////////////////////////

            #region [ === FORM - BOX RIGHT === ]

            Splitter splitter = new Splitter()
            {
                Dock = DockStyle.Left, BackColor = App.ColorBg, Width = App.col_Splitter_Width
            };

            Panel box_Right = new Panel()
            {
                Dock = DockStyle.Fill, BackColor = Color.White,
            };
            tab = new TabControlCustom()
            {
                Dock = DockStyle.Fill
            };

            Panel box_Footer = new Panel()
            {
                Dock = DockStyle.Bottom, Height = 20, Padding = new Padding(1, 1, 1, 0), BackColor = App.ColorBg
            };
            box_Footer.MouseDown += Label_MouseDown;

            ButtonCustom btn_ModelAdd = new ButtonCustom()
            {
                Text = "Tab Add", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White,
            };
            ButtonCustom btn_ModelEdit = new ButtonCustom()
            {
                Text = "Tab Edit", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White,
            };
            ButtonCustom btn_ModelRemove = new ButtonCustom()
            {
                Text = "Tab Remove", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White,
            };

            ButtonCustom btn_ItemAdd = new ButtonCustom()
            {
                Text = "Item Add", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White,
            };
            ButtonCustom btn_ItemEdit = new ButtonCustom()
            {
                Text = "Item Edit", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White,
            };
            ButtonCustom btn_ItemRemove = new ButtonCustom()
            {
                Text = "Item Remove", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White,
            };

            box_Footer.Controls.AddRange(new Control[] {
                btn_ItemRemove,
                btn_ItemEdit,
                btn_ItemAdd,

                btn_ModelRemove,
                btn_ModelEdit,
                btn_ModelAdd,
            });

            box_Right.Controls.AddRange(new Control[] {
                tab,
                //box_Footer,
            });

            #endregion

            ////////////////////////////////////////////////////
            // LOAD CONTROL

            this.Controls.Add(box_Left);
            this.Controls.Add(splitter);
            this.Controls.Add(box_Right);
            box_Left.BringToFront();
            listDB.BringToFront();
            splitter.BringToFront();
            box_Right.BringToFront();

            ////////////////////////////////////////////////////

            listDB_Init();
        }
Ejemplo n.º 6
0
            public RichTextItem(Control parent, bool visible = false)
            {
                Key = Guid.NewGuid().ToString("N");

                Parent = parent;

                Spliter         = new Splitter();
                Spliter.Visible = false;

                BackGround         = new Panel();
                BackGround.Visible = false;

                Head         = new Button();
                Head.Width   = _headWidth;
                Head.Visible = false;

                Editor               = new RichTextBox();
                Editor.Visible       = false;
                Editor.HideSelection = false;

                BackGround.Name = Key;


                parent.Controls.Add(Spliter);
                Spliter.Cursor = Cursors.SizeNS;
                Spliter.Dock   = DockStyle.Top;
                Spliter.BringToFront();

                parent.Controls.Add(BackGround);
                BackGround.BorderStyle = BorderStyle.FixedSingle;
                BackGround.BackColor   = Color.Silver;
                BackGround.Dock        = DockStyle.Top;
                BackGround.BringToFront();

                BackGround.Left = -10000;
                BackGround.Top  = -10000;

                BackGround.Enter += DoEnterProcess;

                BackGround.Controls.Add(Head);
                Head.Dock = DockStyle.Left;

                Head.ImageAlign        = ContentAlignment.MiddleLeft;
                Head.TextAlign         = ContentAlignment.MiddleLeft;
                Head.TextImageRelation = TextImageRelation.ImageBeforeText;

                Head.Click += DoHeadClick;

                BackGround.Controls.Add(Editor);
                Editor.BorderStyle = BorderStyle.None;
                Editor.BringToFront();
                Editor.Dock = DockStyle.Fill;

                Editor.TextChanged += DoTextChanged;

                Editor.Visible = visible;
                Head.Visible   = visible;

                BackGround.Visible = visible;
                Spliter.Visible    = visible;
            }
Ejemplo n.º 7
0
        private void init_Control()
        {
            this.Padding         = App.FormBorder;
            this.BackColor       = App.ColorBorder;
            this.FormBorderStyle = FormBorderStyle.None;
            this.ClientSize      = new Size(App.Width, 555);

            ////////////////////////////////////////////////////

            #region [ === MENU === ]

            MenuStrip menu = new MenuStrip()
            {
                Dock = DockStyle.Top, BackColor = App.ColorBg
            };
            //ToolStripTextBox mn_DbSearch = new ToolStripTextBox() { Width = left_Width, BorderStyle = BorderStyle.FixedSingle, BackColor = Color.LightGray };
            lbl_User = new ToolStripLabel()
            {
                Text = "[" + App.UserCurrent + "]", ForeColor = Color.White,
            };
            lbl_Title = new ToolStripLabel()
            {
                Text = "// ... ", ForeColor = Color.White,
            };
            lbl_Title.Click += (se, ev) => listDB_BindData();
            ToolStripMenuItem mn = new ToolStripMenuItem()
            {
                Text = "MODEL", ForeColor = Color.White, Alignment = ToolStripItemAlignment.Right,
            };
            var mn_ModelAdd = new ToolStripMenuItem()
            {
                Text = "Model Add"
            };
            mn_ModelAdd.Click += (se, ev) => model_Add();
            var mn_ModelEdit = new ToolStripMenuItem()
            {
                Text = "Model Edit"
            };
            mn_ModelEdit.Click += (se, ev) => model_Edit();
            var mn_ModelRemove = new ToolStripMenuItem()
            {
                Text = "Model Remove"
            };
            mn_ModelRemove.Click += (se, ev) => model_Remove();
            var mn_ModelTruncate = new ToolStripMenuItem()
            {
                Text = "Model Truncate"
            };
            mn_ModelTruncate.Click += (se, ev) => model_Truncate();
            var mn_ItemAdd = new ToolStripMenuItem()
            {
                Text = "Item Add"
            };
            mn_ItemAdd.Click += (se, ev) => item_Add();
            var mn_ItemEdit = new ToolStripMenuItem()
            {
                Text = "Item Edit"
            };
            mn_ItemEdit.Click += (se, ev) => item_Edit();
            var mn_ItemRemove = new ToolStripMenuItem()
            {
                Text = "Item Remove"
            };
            mn_ItemRemove.Click += (se, ev) => item_Remove();
            mn.DropDownItems.AddRange(new ToolStripItem[] { mn_ModelAdd, mn_ModelEdit, mn_ModelRemove, mn_ModelTruncate, mn_ItemAdd, mn_ItemEdit, mn_ItemRemove });
            ToolStripItem mn_Hide = new ToolStripMenuItem()
            {
                Text = "HIDE", ForeColor = Color.White, Alignment = ToolStripItemAlignment.Right
            };
            ToolStripItem mn_Exit = new ToolStripMenuItem()
            {
                Text = "EXIT", ForeColor = Color.White, Alignment = ToolStripItemAlignment.Right,
            };
            mn_Hide.Click += (se, ev) => { this.Hide(); };
            mn_Exit.Click += (se, ev) => { if (OnExit != null)
                                           {
                                               OnExit();
                                           }
            };
            menu.Items.AddRange(new ToolStripItem[] {
                lbl_User,
                lbl_Title, mn_Exit, mn_Hide, mn,
            });
            menu.MouseDown += Form_MouseDown;
            this.Controls.Add(menu);

            #endregion

            ////////////////////////////////////////////////////

            #region [ === FORM - BOX LEFT === ]

            Panel box_Left = new Panel()
            {
                Dock = DockStyle.Left, Width = App.col_Left_Width, BackColor = Color.White, Margin = new Padding(0), Padding = new Padding(0),
            };

            box_Left.Controls.AddRange(new Control[] {
                // mui_modelSearchTextBox,
                mui_modelTreeView,
            });

            this.Controls.Add(box_Left);

            #endregion

            ////////////////////////////////////////////////////

            #region [ === FORM - BOX RIGHT === ]

            Splitter splitter = new Splitter()
            {
                Dock = DockStyle.Left, BackColor = App.ColorBg, Width = App.col_Splitter_Width, MinSize = 0
            };

            Panel box_Right = new Panel()
            {
                Dock = DockStyle.Fill, BackColor = Color.White,
            };
            mui_tabModel = new TabControlCustom()
            {
                Dock = DockStyle.Fill
            };

            ////Panel box_Footer = new Panel() { Dock = DockStyle.Bottom, Height = 20, Padding = new Padding(1, 1, 1, 0), BackColor = App.ColorBg };
            ////box_Footer.MouseDown += Label_MouseDown;

            ////ButtonCustom btn_ModelAdd = new ButtonCustom() { Text = "Tab Add", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White, };
            ////ButtonCustom btn_ModelEdit = new ButtonCustom() { Text = "Tab Edit", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White, };
            ////ButtonCustom btn_ModelRemove = new ButtonCustom() { Text = "Tab Remove", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White, };

            ////ButtonCustom btn_ItemAdd = new ButtonCustom() { Text = "Item Add", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White, };
            ////ButtonCustom btn_ItemEdit = new ButtonCustom() { Text = "Item Edit", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White, };
            ////ButtonCustom btn_ItemRemove = new ButtonCustom() { Text = "Item Remove", Dock = DockStyle.Left, FlatStyle = System.Windows.Forms.FlatStyle.Flat, Width = 80, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, BackColor = App.ColorBg, ForeColor = Color.White, };

            ////box_Footer.Controls.AddRange(new Control[] {
            ////    btn_ItemRemove,
            ////    btn_ItemEdit,
            ////    btn_ItemAdd,

            ////    btn_ModelRemove,
            ////    btn_ModelEdit,
            ////    btn_ModelAdd,
            ////});

            box_Right.Controls.AddRange(new Control[] {
                mui_tabModel,
                //box_Footer,
            });

            #endregion

            ////////////////////////////////////////////////////
            // LOAD CONTROL

            this.Controls.Add(box_Left);
            this.Controls.Add(splitter);
            this.Controls.Add(box_Right);
            box_Left.BringToFront();
            mui_modelTreeView.BringToFront();
            splitter.BringToFront();
            box_Right.BringToFront();

            ////////////////////////////////////////////////////

            mui_modelTreeView_BindData();
        }
Ejemplo n.º 8
0
        public void Init(Control controlParent)
        {
            _gcScontrino  = new DevExpress.XtraGrid.GridControl();
            _dgvScontrino = new DevExpress.XtraGrid.Views.Grid.GridView();
            ((System.ComponentModel.ISupportInitialize)(_gcScontrino)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(_dgvScontrino)).BeginInit();

            InitCombo(controlParent, cboTipoDoc);
            InitCombo(controlParent, cboListinoPrezzi);

            Splitter splitter = new Splitter();

            splitter.Dock = DockStyle.Top;
            controlParent.Controls.Add(splitter);
            splitter.BringToFront();



            //
            // _gridControlScontrino
            //
            _gcScontrino.Location = new System.Drawing.Point(8, 0);
            _gcScontrino.MainView = _dgvScontrino;
            _gcScontrino.Name     = "_gridControlScontrino";
            _gcScontrino.Size     = new System.Drawing.Size(411, 244);
            _gcScontrino.TabIndex = 0;
            _gcScontrino.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
                _dgvScontrino
            });
            _gcScontrino.Dock = System.Windows.Forms.DockStyle.Fill;
            //
            // gridView1
            //
            _dgvScontrino.GridControl    = _gcScontrino;
            _dgvScontrino.ShowingEditor += _dgvScontrino_ShowingEditor;
            _dgvScontrino.RowStyle      += _dgvScontrino_RowStyle;
            _dgvScontrino.Name           = "gridView1";
            _dgvScontrino.Appearance.FocusedRow.Font = new System.Drawing.Font("Tahoma", 20, System.Drawing.FontStyle.Bold);
            controlParent.Controls.Add(_gcScontrino);
            _gcScontrino.BringToFront();
            ((System.ComponentModel.ISupportInitialize)(_gcScontrino)).EndInit();

            ((System.ComponentModel.ISupportInitialize)(_dgvScontrino)).EndInit();
            UtilityView.InitGridDev(_dgvScontrino);
            _dgvScontrino.OptionsBehavior.Editable      = true;
            _dgvScontrino.OptionsView.ShowAutoFilterRow = false;


            emptyEditor = new RepositoryItemButtonEdit();
            emptyEditor.Buttons.Clear();
            emptyEditor.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
            _gcScontrino.RepositoryItems.Add(emptyEditor);


            Reffreshlist();
            _dgvScontrino.OptionsCustomization.AllowSort = false;

            var rp = new RepositoryItemTextEdit();

            rp.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;


            rp.Mask.EditMask = "P0";
            _gcScontrino.RepositoryItems.Add(rp);
            var col = _dgvScontrino.Columns["ScontoPerc"];


            col.ColumnEdit = rp;
            col.OptionsColumn.AllowEdit    = true;
            col.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            col.DisplayFormat.FormatString = "{0:n0} %";

            col            = _dgvScontrino.Columns["IvaPerc"];
            col.ColumnEdit = rp;
            col.OptionsColumn.AllowEdit    = true;
            col.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            col.DisplayFormat.FormatString = "{0:n0} %";

            _dgvScontrino.Columns["TipoRigaScontrino"].Visible = false;

            _dgvScontrino.Columns["Articolo"].Visible = false;
            _dgvScontrino.CustomDrawCell += _dgvScontrino_CustomDrawCell;

            InitTipoDoc();
            InitListinoPrezzi();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 初始化一个新Page
        /// </summary>
        /// <param name="Title">标题</param>
        /// <param name="Name">key名称</param>
        /// <param name="Grid">加载的数据</param>
        public ComponentDataGrid InitializeNewTabPage(string Title, string Name, DataTable Grid)
        {
            //如果存在相同名称Page
            if (TabCtrl.TabPages.ContainsKey(Name))
            {
                ComponentDataGrid finGrid = TabCtrl.TabPages[Name].Controls.OfType <ComponentDataGrid>().FirstOrDefault();
                finGrid.DataSource = Grid;
                return(finGrid);
            }

            TabPage page = ControlsHelper.NewPage(Title, Name);

            TabCtrl.TabPages.Add(page);

            ComponentToolbar toolstrip = ControlsHelper.NewToolStrip(Name);

            page.Controls.Add(toolstrip);
            toolstrip.BringToFront();

            DataTable dtColInfo = DBHelper.GetDataTable($@"select * from T_InterfaceColums where fInterfacename='{Name}'");

            bool bgenTree = false;

            if (!_mbMain)
            {
                goto NoTreeGeneral;
            }

            if (dtColInfo != null && dtColInfo.Rows.Count > 0)
            {
                DataRow[] rows = dtColInfo.Select("fInterFaceColIsTree = 1", "fnum");

                bgenTree = rows.Count() > 0
                  ? true
                  : false;

                if (bgenTree)
                {
                    Tree      = new ComponentTree();
                    Tree.Dock = DockStyle.Left;
                    page.Controls.Add(Tree);

                    ControlsHelper.CreateTree(Tree, rows, Grid);

                    EventHelper helper = new EventHelper();
                    helper.BindingTreeNodeOnClick(Tree);

                    Tree.ExpandAll();

                    Tree.BringToFront();

                    Splitter splitter = new Splitter();
                    page.Controls.Add(splitter);
                    splitter.BringToFront();
                    splitter.Dock = DockStyle.Left;
                }
            }

            //没有树结构
NoTreeGeneral:


            ComponentDataGrid dgv = ControlsHelper.NewDataGrid(Grid, dtColInfo);

            dgv.Name = Name;
            page.Controls.Add(dgv);
            dgv.Dock = DockStyle.Fill;
            dgv.BringToFront();

            dgv.BindingToolBar(toolstrip);
            dgv.BindingTabPage(page);

            toolstrip.BindingDataGrid(dgv);
            toolstrip.BindingTabPage(page);


            if (bgenTree)
            {
                Tree.BindingDataGrid(dgv);
                Tree.BindingTabPage(page);

                dgv.BindingTree(Tree);

                _mbMain = false;
            }

            return(dgv);
        }