1.读取文件内容,提取要显示的部分。
2.循环生成ListViewItem,加入ListView
2.循环生成ListViewItem,加入ListView
解决方案 »
- winform 的 定时器问题【在线等,急!!!】
- 一个关于在Gridview里显示数据的问题
- 请问C#中有没有树数据结构的类库
- C# 的BindingSource 或者 DataTable 或者 DataSet 有没有正在修改的事件的?或者有没有类似 Delphi 的AfterEdit 事件
- 从html中取出相关的数据,急求。
- 关于一个C#字符数组的问题
- 为什么if判断会显示无效的表达式项。。
- progressbar的Marquee我设置了怎么没有用啊
- 问题提出了四五天,没有人回答.请版主帮忙? 吐血 吐血 吐血 吐血
- 急!!如何获得类库的当前位置
- 给各位送点分,顺便问个小问题
- 高分请教DATATRIDVIEW问题!
是重複的出現。別人可能會懶得回答,或是看膩了相同問題,或是回答
過這種問題,您又問了一次所以懶得回答。如果一個討論區都是這樣
無趣無建設性,反而沒有人願意想再回答。 2.問的範圍盡量縮小,不要太大如『大老二怎麼寫?』,大概除了有菩薩
心腸的大善人之外應該不會有人回答您。(典故:有人在tw.bbs.comp.language
問這個問題,結果一堆善心人士用各種程式語言版本print大老二這三個字,
以後所有的範例『Hello world!』都改成『大老二』了。 3.什麼主題最爛?以下都是經典範例:如果您老是發表此主題,請趕快檢討。 (1) "急~~~~~~ " "急件!!" "急問" "急救" "急徵"
(2) "Help" "救命阿~~~~" "求救 "
(3) "請問一下?" "請問?" "請問大家"
(4) "幫幫忙" "請教我或幫我 "
(5) "糟了..... " "為什麼會這樣? "
(6) "問一個白痴問題...... "
1.發問者盡量以謙虛的態度發問,如回答者不如您想要的答案,也請在詳加
描述問題,最忌嗤之以鼻或不屑之聲。您問的越是謙虛,越是多人會想
回答您的問題。 2.切勿發表與該討論區相符的風格和主題。
3.描述問題最好能將您用什麼程式語言、版本和作業系統、版本,最好再
付上Source片段,執行時或編譯時發生時的錯誤訊息等等,越是詳細的
資訊越是容易判斷錯誤在哪裡。 4.當你提出的討論主題沒人回應,請先檢討自己。切勿再發表說『這裡沒人會嗎?』
因為越是高手的人越是想恥笑您,一笑你問小朋友問題,二笑誰鳥你是誰
幹麻回答你,三不恥回答這種沒建設性問題。so..趕快搜尋舊文章,練練
基礎功夫,切勿把沒人回的責任推給大家,畢竟沒人有義務幫您,只有
大家的熱心願不願意回答您。 5.當有熱心網友回應時,請您也適度的回應,對您的問題再作補充說明或對
熱心網友的協助表達謝意,以建立起良好的互動。
感谢你的回复,能不能再详细点,有没有代码什么的可以看看.
{
// Create a new ListView control.
ListView listView1 = new ListView();
listView1.Bounds = new Rectangle(new Point(10,10), new Size(300,200)); // Set the view to show details.
listView1.View = View.Details;
// Allow the user to edit item text.
listView1.LabelEdit = true;
// Allow the user to rearrange columns.
listView1.AllowColumnReorder = true;
// Display check boxes.
listView1.CheckBoxes = true;
// Select the item and subitems when selection is made.
listView1.FullRowSelect = true;
// Display grid lines.
listView1.GridLines = true;
// Sort the items in the list in ascending order.
listView1.Sorting = SortOrder.Ascending;
// Create three items and three sets of subitems for each item.
ListViewItem item1 = new ListViewItem("item1",0);
// Place a check next to the item.
item1.Checked = true;
item1.SubItems.Add("1");
item1.SubItems.Add("2");
item1.SubItems.Add("3");
ListViewItem item2 = new ListViewItem("item2",1);
item2.SubItems.Add("4");
item2.SubItems.Add("5");
item2.SubItems.Add("6");
ListViewItem item3 = new ListViewItem("item3",0);
// Place a check next to the item.
item3.Checked = true;
item3.SubItems.Add("7");
item3.SubItems.Add("8");
item3.SubItems.Add("9"); // Create columns for the items and subitems.
listView1.Columns.Add("Item Column", -2, HorizontalAlignment.Left);
listView1.Columns.Add("Column 2", -2, HorizontalAlignment.Left);
listView1.Columns.Add("Column 3", -2, HorizontalAlignment.Left);
listView1.Columns.Add("Column 4", -2, HorizontalAlignment.Center); //Add the items to the ListView.
listView1.Items.AddRange(new ListViewItem[]{item1,item2,item3}); // Create two ImageList objects.
ImageList imageListSmall = new ImageList();
ImageList imageListLarge = new ImageList(); // Initialize the ImageList objects with bitmaps.
imageListSmall.Images.Add(Bitmap.FromFile("C:\\MySmallImage1.bmp"));
imageListSmall.Images.Add(Bitmap.FromFile("C:\\MySmallImage2.bmp"));
imageListLarge.Images.Add(Bitmap.FromFile("C:\\MyLargeImage1.bmp"));
imageListLarge.Images.Add(Bitmap.FromFile("C:\\MyLargeImage2.bmp")); //Assign the ImageList objects to the ListView.
listView1.LargeImageList = imageListLarge;
listView1.SmallImageList = imageListSmall; // Add the ListView to the control collection.
this.Controls.Add(listView1);
}