如何添加列在C#中的Windows應用程序C#Windows應用程序
回答
使用。例如ListView,它有一個Columns屬性...你可以用ListViewItems的SubItems屬性添加列。雖然有其他的可能性(控制),但是(如DataGridView)。
也許你應該看看這個組件(=谷歌)。任何一本體面的書都會涵蓋它們。
感謝你對精神能力的懲罰 – 2010-06-11 13:55:26
+1。 – 2010-06-11 15:28:39
public class Coloumn : Control
{
}
//in your Form Load
for(int i=0;i<100;i++)
this.Controls.Add(new Coloumn());
//when the control comes here, your form is flooded with Coloumns..
我這樣做,因爲你的requirements are not clear
。
雅它的'罰款填充列 – 2010-06-11 13:54:22
像這樣:
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Net;
namespace WithColumns
{
public class FormWithColumns : Form
{
public FormWithColumns()
{
Label label1 = new Label();
Label label2 = new Label();
SuspendLayout();
WebRequest req = WebRequest.Create("http://www.bc.edu/bc_org/avp/cas/fnart/arch/greek/doric1.jpg");
WebResponse response = req.GetResponse();
Stream stream = response.GetResponseStream();
Image img = Image.FromStream(stream);
stream.Close();
ClientSize = new Size(img.Width * 3, img.Height);
label1.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
label1.Location = new System.Drawing.Point(0, 0);
label1.Size = img.Size;
label1.Image = img;
label2.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
label2.Location = new System.Drawing.Point(img.Width * 2, 0);
label2.Size = img.Size;
label2.Image = img;
Controls.Add(label1);
Controls.Add(label2);
Text = "Form With Columns";
BackColor = Color.White;
ResumeLayout(false);
}
}
}
+1 - 絕對天才 – 2010-06-11 13:38:14
+1感謝您的笑! – Odrade 2010-06-11 13:51:12
看到我需要datagridview列 – 2010-06-11 13:51:39
- 1. C#Windows應用程序attachmentFilename
- 2. C#Windows應用程序
- 3. Windows應用程序C
- 4. C#Windows應用程序
- 5. c#windows應用程序中的線程
- 6. 將C#(Windows應用程序)轉換爲commadline應用程序?
- 7. 從Windows窗體應用程序C控制檯應用程序#
- 8. 使用C#Windows窗體應用程序
- 9. 用C++開發Windows phone應用程序
- 10. C#windows phone 8應用程序段
- 11. iTextSharp C#windows store應用程序
- 12. 從C#.NET Windows應用程序
- 13. c#windows桌面應用程序.MVS
- 14. Windows 8應用程序全屏webview C#
- 15. Google Search in c#windows應用程序
- 16. 部署Release C#windows應用程序
- 17. C#MVC的Windows應用程序
- 18. 備份C#Windows應用程序數據
- 19. C#Windows應用程序部署
- 20. Windows 10 UWP應用程序c#打印
- 21. 爲Windows XP編譯C#應用程序
- 22. Windows應用程序廓 - C++埃克
- 23. C# - 捕獲Windows應用程序輸出
- 24. Windows 8/C#應用程序到PDF
- 25. 無法從Windows應用程序C#
- 26. C#控制檯和Windows應用程序
- 27. C#中的Windows應用程序?
- 28. 創建Windows窗體C#應用程序
- 29. C#Web服務與Windows應用程序
- 30. MongoDB for Windows C#.Net應用程序
你說的列是什麼意思? – rahul 2010-06-11 12:08:07
添加列到什麼? DataGridView,ListView等 – SwDevMan81 2010-06-11 12:08:27
嗨,歡迎來到Stack Overflow,但恐怕在發佈任何有意義的答案之前,您都必須發佈更多信息。 – 2010-06-11 12:08:34