Esempio n. 1
0
        private void InitializePanelCenter()
        {
            this.tableLayoutPanel.ColumnStyles.Add(
                new ColumnStyle()
            {
                Width    = 240,
                SizeType = SizeType.Absolute
            });

            // panelCenter
            this.panelCenter = new Panel()
            {
                Location  = new Point(0, 0),
                Dock      = DockStyle.Fill,
                BackColor = Style.BackColorSecondary,
                Margin    = new Padding(1),
                //BorderStyle = BorderStyle.FixedSingle
            };
            this.tableLayoutPanel.Controls.Add(this.panelCenter, 1, 0);

            this.pictureBoxSearch = new PictureBox
            {
                Location = new Point(10, 18),
                Size     = new Size(25, 25),

                BackColor = Style.BackColorSecondary,
                TabStop   = false,
                Image     = Style.GetImage("search", false),
                SizeMode  = PictureBoxSizeMode.Zoom
            };
            this.pictureBoxSearch.MouseEnter += PictureBoxesEnterEvent;
            this.pictureBoxSearch.MouseLeave += PictureBoxesLeaveEvent;
            //this.pictureBoxSearch.Click += this.PictureBoxSearchClickEvent;
            this.panelCenter.Controls.Add(pictureBoxSearch);

            // textBoxSearch
            this.textBoxSearch = new TextBox()
            {
                Location = new Point(45, 15),
                Anchor   = AnchorStyles.Right | AnchorStyles.Top,
                Size     = new Size((int)this.tableLayoutPanel.ColumnStyles[1].Width - 30 - 25, 76 - 30),

                BackColor   = Color.FromArgb(36, 47, 61),
                Text        = "Search...",
                Font        = new Font(Resources.FontName, 11.8F, FontStyle.Regular, GraphicsUnit.Point, 204),
                ForeColor   = Style.ForeColorSecondary,
                BorderStyle = BorderStyle.FixedSingle,
                //Multiline = true,
                AcceptsReturn = true,
                TabStop       = false
            };
            //this.textBoxSearch.TextChanged += this.TextBoxSearchTextChanged;
            this.textBoxSearch.KeyDown   += this.TextBoxSearchTextChanged;
            this.textBoxSearch.Enter     += this.TextBoxSearchEnterEvent;
            this.textBoxSearch.GotFocus  += this.TextBoxSearchGotFocus;
            this.textBoxSearch.LostFocus += this.TextBoxSearchLostFocus;
            this.textBoxSearch.KeyDown   += this.TextBoxSearchKeyDownEvent;
            this.panelCenter.Controls.Add(this.textBoxSearch);

            this.labelSearchQuestion = new Label
            {
                Location = new Point(this.textBoxSearch.Location.X,
                                     this.textBoxSearch.Location.Y + this.textBoxSearch.Height),
                Size        = this.textBoxSearch.Size,
                MinimumSize = this.textBoxSearch.Size,
                MaximumSize = this.textBoxSearch.Size,
                BackColor   = Color.FromArgb(36, 47, 61),
                Font        = new Font(Resources.FontName, 13.8F, FontStyle.Regular, GraphicsUnit.Point, 204),
                ForeColor   = Style.ForeColorSecondary,
                BorderStyle = BorderStyle.FixedSingle,
                TabStop     = false,
                Visible     = false
            };
            this.labelSearchQuestion.Click += this.LabelSearchQuestionClickEvent;
            this.panelCenter.Controls.Add(this.labelSearchQuestion);


            //PanelContactsBox
            var contacts = new List <Contact>
            {
                new Contact("artem"),
                new Contact("grisha"),
                new Contact("julia"),
                new Contact("vova")
            };

            foreach (var c in contacts)
            {
                this.dictMessageHistory.Add(c.Id, new List <IMessage>());
            }

            this.panelContactsBox = new PanelContactsBox(contacts, this)
            {
                Location   = new Point(0, this.textBoxSearch.Height + 30),
                Width      = this.panelCenter.Width,
                Height     = 2000,
                Margin     = new Padding(0),
                BackColor  = Style.BackColorSecondary,
                AutoScroll = true
            };
            this.panelContactsBox.VerticalScroll.Minimum = 1;
            this.panelCenter.Controls.Add(this.panelContactsBox);
        }
Esempio n. 2
0
        public void InitializePanelCenter()
        {
            this.tableLayoutPanel.ColumnStyles.Add(
                new ColumnStyle()
            {
                Width    = 240,
                SizeType = SizeType.Absolute
            });

            // panelCenter
            this.panelCenter = new Panel()
            {
                Location  = new Point(0, 0),
                Dock      = DockStyle.Fill,
                BackColor = this.colorPanelCenter,
                Margin    = new Padding(1)
            };
            this.tableLayoutPanel.Controls.Add(this.panelCenter, 1, 0);

            // textBoxSearch
            this.textBoxSearch = new TextBox()
            {
                Location = new Point(15, 15),
                Anchor   = AnchorStyles.Right | AnchorStyles.Top,
                Size     = new Size((int)this.tableLayoutPanel.ColumnStyles[1].Width - 30, 76 - 30),

                BackColor   = Color.FromArgb(36, 47, 61),
                Text        = "Search...",
                Font        = new Font(Resources.FontName, 13.8F, FontStyle.Regular, GraphicsUnit.Point, 204),
                ForeColor   = this.foreColorTextBoxSearch,
                BorderStyle = BorderStyle.FixedSingle,
                //Multiline = true,
                //AcceptsReturn = true,
                TabStop = false
            };
            //this.textBoxSearch.TextChanged += new EventHandler(this.TextBoxSearchTextChanged);
            this.textBoxSearch.Enter     += new EventHandler(this.TextBoxSearchEnterEvent);
            this.textBoxSearch.GotFocus  += new EventHandler(this.TextBoxSearchGotFocus);
            this.textBoxSearch.LostFocus += new EventHandler(this.TextBoxSearchLostFocus);
            this.textBoxSearch.KeyDown   += new KeyEventHandler(this.TextBoxSearchKeyDownEvent);
            this.panelCenter.Controls.Add(this.textBoxSearch);

            this.labelSearchQuestion = new Label
            {
                Location    = new Point(this.textBoxSearch.Location.X, this.textBoxSearch.Location.Y + this.textBoxSearch.Height),
                Size        = this.textBoxSearch.Size,
                MinimumSize = this.textBoxSearch.Size,
                MaximumSize = this.textBoxSearch.Size,

                BackColor   = Color.FromArgb(36, 47, 61),
                Font        = new Font(Resources.FontName, 13.8F, FontStyle.Regular, GraphicsUnit.Point, 204),
                ForeColor   = this.foreColorTextBoxSearch,
                BorderStyle = BorderStyle.FixedSingle,
                TabStop     = false
            };
            this.labelSearchQuestion.Visible = false;
            this.labelSearchQuestion.Click  += new EventHandler(this.LabelSearchQuestionClickEvent);
            this.panelCenter.Controls.Add(this.labelSearchQuestion);


            //PanelContactsBox
            List <Contact> contacts = new List <Contact>
            {
                new Contact("alex"),
                new Contact("grisha"),
                new Contact("server")
            };

            foreach (Contact c in contacts)
            {
                this.dictMessageHistory.Add(c.Id, new List <IMessage>());
            }

            this.panelContactsBox = new PanelContactsBox(contacts, this)
            {
                Location = new Point(0, this.textBoxSearch.Height + 30),
                Width    = this.panelCenter.Width,
                Height   = 2000,

                BackColor = this.colorPanelCenter
            };
            this.panelCenter.Controls.Add(this.panelContactsBox);
        }