public void addItems(CustomListView customlistview, String[] _vaules)
        {
            customlistview.BeginUpdate();

            ListViewItem _item = new ListViewItem(_vaules);

            customlistview.Items.Add(_item);

            if (customlistview.Items.Count * 35 >= customlistview.Height)
            {
                customlistview.Columns[customlistview.Columns.Count - 1].Width = 0;
            }

            customlistview.EndUpdate();
        }
Exemple #2
0
        public void addWrite(CustomListView writeList, String path)
        {
            writeList.Items.Clear();

            try
            {
                foreach (String _word in File.ReadAllText(path,
                                                          System.Text.Encoding.Default).Split(new String[] { "----" }, StringSplitOptions.None))
                {
                    if (_word.Contains("제목 :"))
                    {
                        String _title   = Regex.Split(Regex.Split(_word, "제목 :")[1], "\n")[0].Trim();
                        String _subject = Regex.Split(_word, _title)[1].Trim();

                        writeList.BeginUpdate();

                        ListViewItem item = new ListViewItem("");
                        item.SubItems.Add(Convert.ToString(writeList.Items.Count + 1));
                        item.SubItems.Add(_title);
                        item.SubItems.Add(_subject);
                        writeList.Items.Add(item);

                        if (writeList.Items.Count >= 8)
                        {
                            writeList.Columns[1].Width = writeList.Columns[1].Width - 17;
                        }

                        if (writeList.Items.Count % 2 == 0)
                        {
                            writeList.Items[item.Index].BackColor = Color.FromArgb(26, 26, 23);
                        }
                        else
                        {
                            writeList.Items[item.Index].BackColor = Color.FromArgb(30, 32, 33);
                        }

                        writeList.EndUpdate();
                    }
                }
            }
            catch (IndexOutOfRangeException ex)
            {
                MessageBox.Show("잘못된 형식의 텍스트파일을 불러왔습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
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();
        }