我正嘗試使用矩形數組創建字詞搜索並在Visual Studio中的標籤中顯示數組。字詞搜索拼圖標籤中的間距不均勻
到目前爲止,我有一個帶有ToString()方法的wordSearch類,它可以像搜索單詞一樣顯示數組。
當我點擊一個按鈕將標籤的文本作爲toString結果,但間距不相等時,我調用了toString。
這裏是我的ToString()方法:
public override string ToString()
{
string result ="";
for (int row = 0; row < puzzle.GetLength(0); row++)
{
for (int column = 0; column < puzzle.GetLength(1); column++)
{
result = result + string.Format("{0,-4}", puzzle[row, column]);
}
result = result + "\n";
}
return result;
自動調整大小是我真正的標籤和文本對齊設置爲左中。
這是什麼樣子:
https://www.flickr.com/photos/[email protected]/