المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : ListView control in Csharp smart device [modified]



C# Programming
04-02-2010, 08:31 PM
Hi,
I am a starter in developping applications with csharp smart device projects.I want to create a Form named PrincipalMenu where I have many icons that let me pass to other Forms.With the toolbox tool,I create my listView and i associated an imageList.I want now to show my icons(which are the nodes of my imagelist)when running the application and associate to anyone a code to let me pass to a form.
I write this code but it doesn't show me anything when running application:
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Essaie
{
public partial class Form1 : Form
{

private const int IMG_Traveaux = 0;
private const int IMG_Stock = 1;
private const int IMG_Energie = 2;
private const int IMG_Sync = 3;
private const int IMG_Info = 4;
private const int IMG_Quitter = 5;
private ListViewItem LVI_Traveaux;
private ListViewItem LVI_Stock;
private ListViewItem LVI_Energie;
private ListViewItem LVI_Sync;
private ListViewItem LVI_Info;
private ListViewItem LVI_Quitter;
public Form1()
{
InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)
{
ListView MaLV = new ListView();
MaLV.Parent = this;
MaLV.Dock = DockStyle.Fill;
MaLV.View = View.Details;
LVI_Traveaux = new ListViewItem("Travaux");
LVI_Traveaux.ImageIndex = IMG_Traveaux;
LVI_Stock = new ListViewItem("Stocks");
LVI_Stock.ImageIndex = IMG_Stock;
LVI_Energie = new ListViewItem("Energie");
LVI_Energie.ImageIndex = IMG_Energie;
LVI_Sync = new ListViewItem("Synchronisation");
LVI_Sync.ImageIndex = IMG_Sync;
LVI_Info = new ListViewItem("Informations");
LVI_Info.ImageIndex = IMG_Info;
LVI_Quitter = new ListViewItem("Quitter");
LVI_Quitter.ImageIndex = IMG_Quitter;
MaLV.Items.Add(LVI_Traveaux);
MaLV.Items.Add(LVI_Stock);
MaLV.Items.Add(LVI_Energie);
MaLV.Items.Add(LVI_Sync);
MaLV.Items.Add(LVI_Info);
MaLV.Items.Add(LVI_Quitter);
}
}

}Can someone tells me the error and gives me the code of any node of the listview
thanks for u help
modified on Friday, April 2, 2010 11:58 AM