Ejemplo n.º 1
0
        //Received UI
        public ChatUI(string message, string date, Image contactPicture, int buffer, EmojiPanel emoji)
        {
            messageTab = new Panel();
            Panel           picturePanel    = new Panel();
            RoundPictureBox picture         = new RoundPictureBox();
            Panel           messageBoxPanel = new Panel();

            messageBox = new MyFixedRichTextBox(true);
            messageBox.setEmojiRef(emoji);//Update richtextbox to have a reference to the emojiPanel
            Label time = new Label();

            messageTab.Controls.Add(messageBoxPanel);
            messageTab.Controls.Add(time);
            messageTab.Controls.Add(picturePanel);
            messageTab.Dock    = DockStyle.Top;
            messageTab.Padding = new Padding(0, buffer, 0, 0);
            messageTab.Size    = new Size(767, 42 + buffer);

            picturePanel.BackColor = Color.White;
            picturePanel.Controls.Add(picture);
            picturePanel.Dock    = DockStyle.Left;
            picturePanel.Padding = new Padding(0, 0, 10, 0);
            picturePanel.Size    = new Size(52, 42);

            picture.BackColor             = Color.Transparent;
            picture.BackgroundImageLayout = ImageLayout.None;
            picture.Dock     = DockStyle.Top;
            picture.Image    = contactPicture;//Properties.Resources.user;
            picture.Size     = new Size(42, 42);
            picture.SizeMode = PictureBoxSizeMode.StretchImage;

            messageBoxPanel.Controls.Add(messageBox);
            messageBoxPanel.BackColor = Color.FromArgb(240, 244, 248);
            messageBoxPanel.ForeColor = Color.FromArgb(43, 43, 48);
            messageBoxPanel.Dock      = DockStyle.Fill;
            messageBoxPanel.Padding   = new Padding(14, 8, 50, 6);

            messageBox.BackColor    = Color.FromArgb(240, 244, 248);
            messageBox.ForeColor    = Color.FromArgb(43, 43, 48);
            messageBox.BorderStyle  = BorderStyle.None;
            messageBox.Dock         = DockStyle.Fill;
            messageBox.Font         = new Font("Segoe UI", 11F);
            messageBox.ReadOnly     = true;
            messageBox.WordWrap     = true;
            messageBox.Multiline    = true;
            messageBox.ScrollBars   = RichTextBoxScrollBars.None;
            messageBox.Text         = message;
            messageBox.GotFocus    += new EventHandler(messageBox_GotFocus);
            messageBox.TextChanged += (sender, e) => messageBox_SizeChanged(messageBox, buffer, messageTab, messageBoxPanel);
            messageBox.Resize      += (sender, e) => messageBox_SizeChanged(messageBox, buffer, messageTab, messageBoxPanel);

            time.ForeColor  = Color.FromArgb(102, 116, 134);
            time.Dock       = DockStyle.Right;
            time.Font       = new Font("Segoe UI", 8F);
            time.ImageAlign = ContentAlignment.TopCenter;
            time.Padding    = new Padding(50, 11, 0, 0);
            time.Size       = new Size(176, 42);
            time.Text       = date;// DateTime.Now.ToString("h:mm tt");
            time.TextAlign  = ContentAlignment.TopCenter;
        }
Ejemplo n.º 2
0
        //Sent UI
        public ChatUI(string message, int buffer, EmojiPanel emoji)
        {
            messageTab = new Panel();
            Panel messageBoxPanel = new Panel();

            messageBox = new MyFixedRichTextBox(true);
            messageBox.setEmojiRef(emoji);//Update richtextbox to have a reference to the emojiPanel
            Label time = new Label();

            messageTab.BackColor = Color.White;
            messageTab.Controls.Add(messageBoxPanel);
            messageTab.Controls.Add(time);
            messageTab.Dock    = DockStyle.Top;
            messageTab.Padding = new Padding(102, buffer, 0, 0);
            messageTab.Size    = new Size(808, 42 + buffer);

            messageBoxPanel.BackColor = Color.FromArgb(199, 237, 252);
            messageBoxPanel.Controls.Add(messageBox);
            messageBoxPanel.Dock    = DockStyle.Fill;
            messageBoxPanel.Padding = new Padding(14, 8, 50, 6);

            messageBox.BackColor    = Color.FromArgb(199, 237, 252);
            messageBox.ForeColor    = Color.FromArgb(43, 43, 48);
            messageBox.BorderStyle  = BorderStyle.None;
            messageBox.Font         = new Font("Segoe UI", 11F);
            messageBox.ReadOnly     = true;
            messageBox.WordWrap     = true;
            messageBox.Multiline    = true;
            messageBox.ScrollBars   = RichTextBoxScrollBars.None;
            messageBox.Text         = message;
            messageBox.Dock         = DockStyle.Fill;
            messageBox.GotFocus    += new EventHandler(messageBox_GotFocus);
            messageBox.TextChanged += (sender, e) => messageBox_SizeChanged(messageBox, buffer, messageTab, messageBoxPanel);
            messageBox.Resize      += (sender, e) => messageBox_SizeChanged(messageBox, buffer, messageTab, messageBoxPanel);

            time.ForeColor = Color.FromArgb(102, 116, 134);
            time.Dock      = DockStyle.Right;
            time.Font      = new Font("Segoe UI", 8F);
            time.Padding   = new Padding(0, 11, 0, 0);
            time.Size      = new Size(126, 42);
            time.Text      = DateTime.Now.ToString("h:mm tt");
            time.TextAlign = ContentAlignment.TopCenter;
        }
Ejemplo n.º 3
0
 public ClientForm()
 {
     InitializeComponent();
     emoji = new EmojiPanel(this);
     msgBox.setEmojiRef(emoji);//Update richtextbox to have a reference to the emojiPanel
 }