I'm creating a web browser with tabs. To enter the URL, I'm trying to set a MenuStrip with its ToolStripMenuItem
as a Textbox. I'm creating all the controls dynamically and I have 2 questions.
1). How can I insert a Textbox as the ToolStripMenuItem
from the code?
(for this screenshot only I added the MenuStrip at design time)
2). How can I change its width?
Thank you all.
You can use ToolStripTextBox
toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox();
toolStripTextBox1.Size = new System.Drawing.Size(100, 25);
toolStrip1.Items.Add(toolStripTextBox1);
Create the control:
var textBox = new System.Windows.Forms.ToolStripTextBox();
Set up some properties:
textBox.Name = "someName";
textBox.Size = new System.Drawing.Size(300, 25); // width, height
Add it to the ToolStrip
:
toolStrip.Items.Add(textBox);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.