public partial class Text_Box : TextBox { ListView listView1 = new System.Windows.Forms.ListView(); public Text_Box() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); } private void Text_Box_Enter(object sender, EventArgs e) { this.BackColor = Color.LightYellow; this.ForeColor = Color.Blue; } private void Text_Box_Leave(object sender, EventArgs e) { this.BackColor = Color.White; this.ForeColor = Color.Black ; } public void InitListView(ListView lstviw) { // this1.BorderStyle = BorderStyle.FixedSingle; lstviw.Dock = DockStyle.None; lstviw.Items.Clear(); lstviw.HeaderStyle = ColumnHeaderStyle.Nonclickable; lstviw.FullRowSelect = true; lstviw.GridLines = true; lstviw.MultiSelect = false; lstviw.AutoArrange = true; lstviw.Size = new System.Drawing.Size(292, 220); lstviw.Location = new Point(this.Location.X, this.Location.Y + 20); lstviw.View = View.Details; ColumnHeader[] columns = { new ColumnHeader(), new ColumnHeader() }; // this is what I'd like to shorten columns[0].Text = "Name"; columns[0].Width = 200; columns[1].Text = "City"; columns[1].Width = 100; lstviw.Columns.AddRange(columns); lstviw.Show(); //lstviw.Visible = true; //this.Controls.Add(lstviw); // listView1.KeyDown += new KeyEventHandler(listView1_KeyDown); } private void Text_Box_TextChanged(object sender, EventArgs e) { InitListView(listView1); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)