Example #1
0
        private void ButtonSend_Click(object sender, EventArgs e)
        {
            if (ChatTextbox.Text == " ")
            {
                // It glitches the hell out when you send just spaces
            }
            else if (ChatTextbox.Text == "")
            {
                // It glitches the hell out when you send just spaces
            }
            else
            {
                if (InCodeMode == false) // Not in code mode
                {
                    // Send text here, I haven't added any code to actually send text through a network
                    TexttoSend = ChatTextbox.Text;
                    // For now, it stores the chat log in a textbox. We could use a string array instead, but listboxes are easier because we can see them at runtime.
                    listBox1.Items.Add(TexttoSend);
                    // Repaint the ChatPanel
                    this.Refresh();
                    // Clear textbox
                    ChatTextbox.Clear();
                }
                if (InCodeMode == true) // In code mode
                {
                    ChatTextbox.Size      = new Size(460, 22);
                    ChatPanel.Size        = new Size(460, 408);
                    ChatTextbox.Location  = new Point(12, 448);
                    InCodeMode            = false;
                    ChatTextbox.Multiline = false;

                    // Send text here, I haven't added any code to actually send text through a network
                    TexttoSend = "[Code]" + ChatTextbox.Text + "[/Code]";
                    // For now, it stores the chat log in a textbox. We could use a string array instead, but listboxes are easier because we can see them at runtime.
                    listBox1.Items.Add(TexttoSend);
                    // Repaint the ChatPanel
                    this.Refresh();
                    // Clear textbox
                    ChatTextbox.Clear();
                }
            }
        }
Example #2
0
 private void ButtonCode_Click(object sender, EventArgs e)
 {
     if (InCodeMode == true)
     {
         // Code mode off
         ChatTextbox.Clear();
         ChatTextbox.Size      = new Size(460, 22);
         ChatPanel.Size        = new Size(460, 408);
         ChatTextbox.Location  = new Point(12, 448);
         InCodeMode            = false;
         ChatTextbox.Multiline = false;
         this.Refresh();
     }
     else if (InCodeMode == false)
     {
         // Code mode
         ChatPanel.Size        = new Size(460, 251);
         InCodeMode            = true;
         ChatTextbox.Multiline = true;
         ChatTextbox.Location  = new Point(12, 291);
         ChatTextbox.Size      = new Size(460, 177);
         ChatTextbox.Text      = "";
     }
 }