1
動態創建標籤時,缺少一部分文本。這是因爲標籤的大小不夠寬,它會切割實際字符串的一部分。c#動態創建的標籤尺寸不夠寬
我該如何簡單地停止?我不想也沒有記得爲標籤設置尺寸。是不是應該繼續直到字符串是空的?
示例:value =「狂戰士的鐵斧」,它只顯示「狂戰士之鐵」,因爲我沒有將它的大小設置爲字符串的一部分。
PictureBox finalResult_pBox = new PictureBox {
Name = "finalResult_pBox" + i,
Size = new Size(64, 64),
Padding = new Padding(0),
BorderStyle = BorderStyle.FixedSingle,
ImageLocation = spidyApi_idByName_result.results[i].img.ToString(),
};
MessageBox.Show(spidyApi_idByName_result.results[i].name.ToString());
Label finalResult_itemName_label = new Label{
Name = "finalResult_itemName_label" + i,
Text = spidyApi_idByName_result.results[i].name,
};
FlowLayoutPanel finalResult_panel = new FlowLayoutPanel{
FlowDirection = FlowDirection.TopDown,
BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle,
Name = "result_flowLayoutPanel" + i,
Size = new System.Drawing.Size(790, 64),
TabIndex = i,
};
finalResult_panel.Controls.Add(finalResult_pBox);
finalResult_panel.Controls.Add(finalResult_itemName_label);
result_flowLayoutPanel.Controls.Add(finalResult_panel);
爲什麼會發生這種情況,我該如何解決這個問題?
@BillWoodger現在我沒發現它爲什麼只顯示一部分價值,因爲它的規模不夠大。現在的問題是,我如何將大小設置爲與文本一樣大?即時編輯我的問題 – 2015-04-04 13:54:54
@BillWoodger我編輯了這個問題。 – 2015-04-04 13:59:50
'finalResult_panel'是否足夠顯示全文? – TaW 2015-04-04 14:01:30