Hello!
Can someone help me, please? It's 6am, I don't have concentration,
feel desperate and I have a deadLine for my project (exam at my
university)..
How can I display ListView onMouse Click event?
Let's say that I just need a detailed view of columnHeaders. Somewhere
in my code there is already prepared array:
ArrayOfCharacte rs - definition of the columns of my ListView.
This is something I've done so far (I call function DrawTable
onMouseClick event):
public class GenDKA : System.Windows. Forms.UserContr ol
private System.Windows. Forms.ListView listViewDKA;
[... <cut> ...]
protected override void Dispose (bool disposing)
{
if (disposing)
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose (disposing);
}
private void InitializeCompo nent()
{
this.Name = "GenDKA";
this.Size = new System.Drawing. Size(504, 248);
this.listViewDK A = new System.Windows. Forms.ListView( );
this.listViewDK A.GridLines = true;
this.listViewDK A.HeaderStyle =
System.Windows. Forms.ColumnHea derStyle.Noncli ckable;
this.listViewDK A.Location = new System.Drawing. Point(8, 8);
this.listViewDK A.Name = "listViewDK A";
this.listViewDK A.Size = new System.Drawing. Size(488, 232);
this.listViewDK A.TabIndex = 0;
this.listViewDK A.View = System.Windows. Forms.View.Deta ils;
}
public void DrawTable()
{
ListView listViewDKA = new ListView();
listViewDKA.Ite ms.Clear();
ListViewItem item = new ListViewItem("N ewItem");
item.UseItemSty leForSubItems = false;
for (int i = 0; i < ArrayOfCharacte rs.Count; i++)
{
MessageBox.Show (ArrayOfCharact ers[i].ToString());
listViewDKA.Col umns.Add(new ColumnHeader()) ;
listViewDKA.Col umns[i].Text = ArrayOfCharacte rs[i].ToString();
listViewDKA.Col umns[i].Width = 25;
}
listViewDKA.Vie w = View.Details;
this.Controls.A dd(listViewDKA) ;
}
public GenDKA()
{
InitializeCompo nent();
}
}
Can someone help me, please? It's 6am, I don't have concentration,
feel desperate and I have a deadLine for my project (exam at my
university)..
How can I display ListView onMouse Click event?
Let's say that I just need a detailed view of columnHeaders. Somewhere
in my code there is already prepared array:
ArrayOfCharacte rs - definition of the columns of my ListView.
This is something I've done so far (I call function DrawTable
onMouseClick event):
public class GenDKA : System.Windows. Forms.UserContr ol
private System.Windows. Forms.ListView listViewDKA;
[... <cut> ...]
protected override void Dispose (bool disposing)
{
if (disposing)
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose (disposing);
}
private void InitializeCompo nent()
{
this.Name = "GenDKA";
this.Size = new System.Drawing. Size(504, 248);
this.listViewDK A = new System.Windows. Forms.ListView( );
this.listViewDK A.GridLines = true;
this.listViewDK A.HeaderStyle =
System.Windows. Forms.ColumnHea derStyle.Noncli ckable;
this.listViewDK A.Location = new System.Drawing. Point(8, 8);
this.listViewDK A.Name = "listViewDK A";
this.listViewDK A.Size = new System.Drawing. Size(488, 232);
this.listViewDK A.TabIndex = 0;
this.listViewDK A.View = System.Windows. Forms.View.Deta ils;
}
public void DrawTable()
{
ListView listViewDKA = new ListView();
listViewDKA.Ite ms.Clear();
ListViewItem item = new ListViewItem("N ewItem");
item.UseItemSty leForSubItems = false;
for (int i = 0; i < ArrayOfCharacte rs.Count; i++)
{
MessageBox.Show (ArrayOfCharact ers[i].ToString());
listViewDKA.Col umns.Add(new ColumnHeader()) ;
listViewDKA.Col umns[i].Text = ArrayOfCharacte rs[i].ToString();
listViewDKA.Col umns[i].Width = 25;
}
listViewDKA.Vie w = View.Details;
this.Controls.A dd(listViewDKA) ;
}
public GenDKA()
{
InitializeCompo nent();
}
}
Comment