private TextBox txtBoxDragPoint = new TextBox();
private void rtbLogicCode_MouseDown(object sender, MouseEventArgs e)
{
if (dragInfo.Item2 == true)
{
//MessageBox.Show("Works");
Point p = new Point(e.X, e.Y);
txtBoxDragPoint.Name = dragInfo.Item1;
txtBoxDragPoint.Text = dragInfo.Item1;
txtBoxDragPoint.Location = p;
txtBoxDragPoint.Size = new Size(100, 21);
txtBoxDragPoint.Show();
}
}
我有一個文本框應該顯示當用戶點擊RichTextBox。事件和布爾條件很好,因爲它顯示的是消息框,但它並不顯示文本框本身。還有什麼我需要做的嗎?C#文本框不顯示
編輯:正如在答覆中提到,我已經做了以下附錄,但文本仍未顯示:
txtBoxDragPoint.Name = dragInfo.Item1;
txtBoxDragPoint.Text = dragInfo.Item1;
txtBoxDragPoint.Location = p;
txtBoxDragPoint.Size = new Size(100, 21);
this.Controls.Add(txtBoxDragPoint);
txtBoxDragPoint.Show();
我不知道如果該信息的任何有關,但RTB添加爲一個tab控件的控件,其中tabcontrol被添加爲表單的控件。
你試圖將文本框添加到RTB,或形式? – Blorgbeard
我不認爲你可以將控件添加到RTB – Blorgbeard