我有一個TableLayoutPanel和TableLayoutPanels作爲行。每個內部tableLayoutPanels有兩行。第二行是一個textBox
,顯示斜體的URL樣式。然而,url的高度被截斷,像'g'這樣的字符會丟失一些像素,'_'根本不會顯示。斜體字符在文本框中被截斷
所以我試圖改變文本框」的高度 - 沒有變化 - 試圖改變內TableLayoutPanel中的行大小 - 沒有變化 - 試圖改變內TableLayoutPanel中的大小本身 - 沒有改變...
諷刺在同一行中有另一個帶有斜體文本的標籤,它綁定到每個錨點的行底部,但即使我在文本框上使用了錨點,仍然會截斷。
相關的textBox代碼:
textBox2.Font = new System.Drawing.Font("Arial", 9.75F,
System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
textBox2.Location = new System.Drawing.Point(3, 21);
textBox2.Size = new System.Drawing.Size(454, 23);
內TLP代碼:
tableLayoutPanel2.RowStyles.Add(new
System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent,
80F));
tableLayoutPanel2.RowStyles.Add(new
System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute,
27F));
tableLayoutPanel2.Size = new System.Drawing.Size(607, 44);
是它在某種程度上可以顯示斜體下劃線:(最初8OG8vit_-WG)
編輯:將文本框放在它的外部組框和主窗體上。
System.Windows.Forms.TextBox textBox2 = new System.Windows.Forms.TextBox();
textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
textBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
textBox2.Font = new System.Drawing.Font("Arial", 9.75F,
System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
textBox2.Location = new System.Drawing.Point(100, 290);
textBox2.Name = "textBox2";
textBox2.ReadOnly = true;
textBox2.Size = new System.Drawing.Size(454, 15);
textBox2.Text = "8OG8vit_-Wg";
textBox2.BackColor = System.Drawing.Color.Coral;
groupBox1.Controls.Add(textBox2); // this.Controls.Add(textBox2);
嘗試設置背景色,以確保文本框的有效尺寸足夠大實際。 AlsO:請檢查所有填充和/或保證金值! – TaW
不錯的提示,BackColor使這更容易。可悲的是設置不同的文本框大小表明絕對沒有改變。也移動了文本框,沒有視覺差異。通過元素查看,代碼中沒有設置「填充」或「頁邊距」值。有沒有我需要介意的默認選項? – Kartoffel
_Are默認ones_是,通常3像素。直接放置在表單上的同一個文本框是否仍然被截斷? – TaW