public CustomTextbox(Action<string> callback, string placeHolder = null, int fontSize = 16) { this.callback = callback; customPlaceHolder = placeHolder; inputContainer = new BorderPanel(); inputContainer.Dock = DockStyle.Fill; input = new TextBox(); input.BorderStyle = BorderStyle.None; input.Font = new Font(CustomFonts.Fonts.Families[1], fontSize); input.HandleCreated += input_HandleCreated; input.KeyDown += input_KeyDown; inputContainer.BackColor = input.BackColor; inputContainer.Size = inputContainer.PreferredSize; inputContainer.GotFocus += (o, e) => input.Select(); inputContainer.Controls.Add(input); Controls.Add(inputContainer); Size = PreferredSize; }
public CustomTextbox(Action <string> callback, string placeHolder = null, int fontSize = 16) { this.callback = callback; customPlaceHolder = placeHolder; inputContainer = new BorderPanel(); inputContainer.Dock = DockStyle.Fill; input = new TextBox(); input.BorderStyle = BorderStyle.None; input.Font = new Font(CustomFonts.Fonts.Families[1], fontSize); input.HandleCreated += input_HandleCreated; input.KeyDown += input_KeyDown; inputContainer.BackColor = input.BackColor; inputContainer.Size = inputContainer.PreferredSize; inputContainer.GotFocus += (o, e) => input.Select(); inputContainer.Controls.Add(input); Controls.Add(inputContainer); Size = PreferredSize; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.chatFooter = new Panel(); this.uploadFile = new Button(); this.inputContainer = new BorderPanel(); this.textInput = new TextBox(); this.channelTitle = new Panel(); this.chatContent = new SelectablePanel(); this.chatFooter.SuspendLayout(); this.inputContainer.SuspendLayout(); this.SuspendLayout(); // // chatFooter // this.chatFooter.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; //this.chatFooter.BorderStyle = BorderStyle.Fixed3D; // this.chatFooter.Controls.Add(this.uploadFile); this.chatFooter.Controls.Add(this.inputContainer); this.chatFooter.Location = new Point(0, 722); this.chatFooter.Margin = new Padding(0); this.chatFooter.Name = "chatFooter"; this.chatFooter.Size = new Size(804, 64); this.chatFooter.TabIndex = 1; // // uploadFile // this.uploadFile.FlatStyle = FlatStyle.Flat; this.uploadFile.FlatAppearance.BorderColor = Color.FromArgb(0xe0, 0xe0, 0xe0); this.uploadFile.Location = new Point(21, 0); this.uploadFile.Margin = new Padding(0, 0, 1, 0); this.uploadFile.Name = "uploadFile"; this.uploadFile.Size = new Size(44, 41); this.uploadFile.TabIndex = 0; this.uploadFile.Text = ""; this.uploadFile.TextAlign = ContentAlignment.MiddleRight; this.uploadFile.UseVisualStyleBackColor = true; this.uploadFile.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom; uploadFile.ForeColor = Color.FromArgb(0xb8, 0xb9, 0xc0); uploadFile.MouseEnter += (o, e) => { uploadFile.ForeColor = Color.White; uploadFile.BackColor = Color.FromArgb(0xeb, 0x4d, 0x5c); }; uploadFile.MouseLeave += (o, e) => { uploadFile.ForeColor = Color.FromArgb(0xb8, 0xb9, 0xc0); uploadFile.BackColor = Color.White; }; // // inputContainer // this.inputContainer.BackColor = Color.Transparent; this.inputContainer.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top; //this.inputContainer.BorderStyle = BorderStyle.FixedSingle; this.inputContainer.Controls.Add(this.textInput); this.inputContainer.Location = new Point(21, 0); this.inputContainer.Margin = new Padding(64, 0, 24, 3); this.inputContainer.Name = "inputContainer"; this.inputContainer.Size = new Size(767, 41); inputContainer.Click += inputContainer_Click; inputContainer.Cursor = Cursor.Current = Cursors.IBeam; this.inputContainer.TabIndex = 0; // // textInput // this.textInput.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; this.textInput.BorderStyle = BorderStyle.None; //this.textInput.BorderStyle = BorderStyle.Fixed3D; // this.textInput.Font = new Font(CustomFonts.Fonts.Families[1], 12); this.textInput.TextChanged += textInput_TextChanged; this.textInput.KeyDown += textInput_KeyDown; this.textInput.Multiline = true; this.textInput.Location = new Point(52, 10); this.textInput.Margin = new Padding(8, 11, 32, 11); this.textInput.Name = "textInput"; this.textInput.Size = new Size(672, textInput.PreferredHeight); this.textInput.TabIndex = 1; this.textInput.ShortcutsEnabled = true; // // channelTitle // this.channelTitle.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; this.channelTitle.Location = new Point(0, 0); //this.channelTitle.BorderStyle = BorderStyle.Fixed3D; // this.channelTitle.Margin = new Padding(0); this.channelTitle.Name = "channelTitle"; this.channelTitle.Size = new Size(804, 53); this.channelTitle.TabIndex = 0; // // chatContent // this.chatContent.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top; this.chatContent.Location = new Point(21, 53); this.chatContent.Margin = new Padding(0); this.chatContent.Name = "chatContent"; this.chatContent.Size = new Size(783, 666); //this.chatContent.BorderStyle = BorderStyle.Fixed3D; // this.chatContent.AutoScroll = true; //this.chatContent.HorizontalScroll.Enabled = false; //this.chatContent.HorizontalScroll.Visible = false; this.chatContent.TabIndex = 2; // // ChatInterface // this.BackColor = Color.White; this.Controls.Add(this.chatContent); this.Controls.Add(this.chatFooter); this.Controls.Add(this.channelTitle); this.Margin = new Padding(0); this.Name = "ChatInterface"; this.Size = new Size(804, 786); this.chatFooter.ResumeLayout(false); this.inputContainer.ResumeLayout(false); this.inputContainer.PerformLayout(); this.ResumeLayout(false); }