本文整理汇总了C#中System.Windows.Forms.ListView.TileSize属性的典型用法代码示例。如果您正苦于以下问题:C# ListView.TileSize属性的具体用法?C# ListView.TileSize怎么用?C# ListView.TileSize使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.ListView
的用法示例。
在下文中一共展示了ListView.TileSize属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListViewTilingExample
//引入命名空间
using System;
using System.Drawing;
using System.Windows.Forms;
public class ListViewTilingExample : Form
{
private ImageList myImageList;
public ListViewTilingExample()
{
// Initialize myListView.
ListView myListView = new ListView();
myListView.Dock = DockStyle.Fill;
myListView.View = View.Tile;
// Initialize the tile size.
myListView.TileSize = new Size(400, 45);
// Initialize the item icons.
myImageList = new ImageList();
using (Icon myIcon = new Icon("book.ico"))
{
myImageList.Images.Add(myIcon);
}
myImageList.ImageSize = new Size(32, 32);
myListView.LargeImageList = myImageList;
// Add column headers so the subitems will appear.
myListView.Columns.AddRange(new ColumnHeader[]
{new ColumnHeader(), new ColumnHeader(), new ColumnHeader()});
// Create items and add them to myListView.
ListViewItem item0 = new ListViewItem( new string[]
{"Programming Windows",
"Petzold, Charles",
"1998"}, 0 );
ListViewItem item1 = new ListViewItem( new string[]
{"Code: The Hidden Language of Computer Hardware and Software",
"Petzold, Charles",
"2000"}, 0 );
ListViewItem item2 = new ListViewItem( new string[]
{"Programming Windows with C#",
"Petzold, Charles",
"2001"}, 0 );
ListViewItem item3 = new ListViewItem( new string[]
{"Coding Techniques for Microsoft Visual Basic .NET",
"Connell, John",
"2001"}, 0 );
ListViewItem item4 = new ListViewItem( new string[]
{"C# for Java Developers",
"Jones, Allen & Freeman, Adam",
"2002"}, 0 );
ListViewItem item5 = new ListViewItem( new string[]
{"Microsoft .NET XML Web Services Step by Step",
"Jones, Allen & Freeman, Adam",
"2002"}, 0 );
myListView.Items.AddRange(
new ListViewItem[] {item0, item1, item2, item3, item4, item5});
// Initialize the form.
this.Controls.Add(myListView);
this.Size = new System.Drawing.Size(430, 330);
this.Text = "ListView Tiling Example";
}
// Clean up any resources being used.
protected override void Dispose(bool disposing)
{
if (disposing)
{
myImageList.Dispose();
}
base.Dispose(disposing);
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new ListViewTilingExample());
}
}