本文整理汇总了C#中System.Windows.Forms.ListBox.ColumnWidth属性的典型用法代码示例。如果您正苦于以下问题:C# ListBox.ColumnWidth属性的具体用法?C# ListBox.ColumnWidth怎么用?C# ListBox.ColumnWidth使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.ListBox
的用法示例。
在下文中一共展示了ListBox.ColumnWidth属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Form1
//引入命名空间
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class Form1 : Form
{
private ListBox listBox1;
public Form1()
{
InitializeComponent();
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
private void InitializeComponent()
{
this.listBox1 = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.HorizontalScrollbar = true;
this.listBox1.Items.AddRange(new object[] {
"Item 1, column 1",
"Item 2, column 1",
"Item 3, column 1",
"Item 4, column 1",
"Item 5, column 1",
"Item 1, column 2",
"Item 2, column 2",
"Item 3, column 2"});
this.listBox1.Location = new System.Drawing.Point(0, 0);
this.listBox1.MultiColumn = true;
this.listBox1.Name = "listBox1";
this.listBox1.ScrollAlwaysVisible = true;
this.listBox1.Size = new System.Drawing.Size(120, 95);
this.listBox1.TabIndex = 0;
this.listBox1.ColumnWidth = 85;
//
// Form1
//
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.listBox1);
this.Name = "Form1";
this.ResumeLayout(false);
}
}