コード例 #1
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();
        }
コード例 #2
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();
        }