• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ListViewItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ListViewItem的典型用法代码示例。如果您正苦于以下问题:C# ListViewItem类的具体用法?C# ListViewItem怎么用?C# ListViewItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ListViewItem类属于命名空间,在下文中一共展示了ListViewItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: HelloForm

    public HelloForm()
    {
        this.Text = "Hello Form";
        this.StartPosition = FormStartPosition.CenterScreen;
        this.FormBorderStyle = FormBorderStyle.FixedDialog;
        this.ControlBox = true;
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.BackColor = Color.Red;

        lv = new ListView();
        lv.Bounds = new Rectangle(new Point(10, 10), new Size(230, 200));

        lv.View = View.Details;
        lv.CheckBoxes = true;
        lv.GridLines = true;

        lv.Columns.Add("Column 1", -2, HorizontalAlignment.Left);
        lv.Columns.Add("Column 2", -2, HorizontalAlignment.Left);
        lv.Columns.Add("Column 3", -2, HorizontalAlignment.Left);
        lv.Columns.Add("Column 4", -2, HorizontalAlignment.Center);

        ListViewItem item1 = new ListViewItem("name", 0);
        item1.Checked = true;
        item1.SubItems.Add("1");
        item1.SubItems.Add("2");
        item1.SubItems.Add("3");
        lv.Items.Add(item1);

        this.Controls.Add(lv);
    }
开发者ID:dbremner,项目名称:hycs,代码行数:31,代码来源:listview.cs


示例2: RssGetting

        private void RssGetting()
        {
            string rssAddress = "http://www.lzbt.net/rss.php";//RSS地址

            XmlDocument doc = new XmlDocument();//创建文档对象
            try
            {
                doc.Load(rssAddress);//加载XML 包括 HTTP:// 和本地
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);//异常处理
            }

            XmlNodeList list = doc.GetElementsByTagName("item"); //获得项           

            foreach (XmlNode node in list) //循环每一项
            {
                XmlElement ele = (XmlElement)node;
                //添加到列表内
                ListViewItem item = new ListViewItem();
                item.Content=ele.GetElementsByTagName("title")[0].InnerText;//获得标题
                item.Tag = ele.GetElementsByTagName("link")[0].InnerText;//获得联接
                mainRssList.Items.Add(item);
                //添加结束
            }
        }
开发者ID:juyingnan,项目名称:VS,代码行数:27,代码来源:MainWindow.xaml.cs


示例3: adicionarProdutosNaLista

        private void adicionarProdutosNaLista(List<Pedido> pedidosNaoPagos)
        {
            this.lstListaDePedidos.Items.Clear();

            foreach (Pedido pedido in pedidosNaoPagos) {
                // 1. Adicionar o titulo do pedido
                ListViewItem listViewItemTituloPedido = new ListViewItem()
                {
                    //Text = String.Format("{0} - ({1})", pedido.Id.ToString(), pedido.HorarioEntrada),
                    Text = String.Format("[{0}]", pedido.HorarioEntrada),
                    Name = pedido.Id.ToString(),
                    Selected = true
                };
                this.lstListaDePedidos.Items.Add(listViewItemTituloPedido);

                // Adicionar produtos do pedido
                foreach (ItemPedido item in pedido.ItensPedidos) {
                    ListViewItem listViewItem = new ListViewItem()
                    {
                        Text = "-> " + item.Produto.Nome
                    };

                    listViewItem.SubItems.Add(item.QtdProduto.ToString());
                    listViewItem.SubItems.Add(item.Valor.ToString("C"));
                    this.lstListaDePedidos.Items.Add(listViewItem);
                }
            }

            this.txtValorTotalConta.Text = pedidosNaoPagos.Sum(p => p.ValorPedido).ToString("C");
        }
开发者ID:CarlosMax,项目名称:eserveur,代码行数:30,代码来源:FrmVerConta.cs


示例4: ListViewExam

    public ListViewExam()
    {
        this.Text = "ListView 예제";
        ListView lst = new ListView();
        lst.Parent = this;
        lst.Dock = DockStyle.Fill;
        lst.View = View.Details;        // 컬럼 정보가 출력

        // 컬럼 해더 추가
        lst.Columns.Add("국가", 70, HorizontalAlignment.Left);
        lst.Columns.Add("수도", 70, HorizontalAlignment.Center);
        lst.Columns.Add("대륙", 70, HorizontalAlignment.Right);

        // 데이터 추가
        ListViewItem lvi_korea = new ListViewItem("대한민국");
        lvi_korea.SubItems.Add("서울");
        lvi_korea.SubItems.Add("아시아");

        ListViewItem lvi_canada = new ListViewItem("캐나다");
        lvi_canada.SubItems.Add("오타와");
        lvi_canada.SubItems.Add("아메리카");

        ListViewItem lvi_france = new ListViewItem("프랑스");
        lvi_france.SubItems.Add("파리");
        lvi_france.SubItems.Add("유럽");

        lst.Items.Add(lvi_korea);
        lst.Items.Add(lvi_canada);
        lst.Items.Add(lvi_france);
    }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:30,代码来源:Program.cs


示例5: PercentageView

        public PercentageView(BiorhythmCalculator calculator)
        {
            this.calculator = calculator;
            calculator.Updated += new EventHandler(OnCalculatorUpdate);

            this.Title.Text = calculator.CurrentDate.ToShortDateString();

            birthDateListItem = new ListViewItem();
            daysOldListItem = new ListViewItem();
            physicalListItem = new ListViewItem();
            emotionalListItem = new ListViewItem();
            intellectualListItem = new ListViewItem();

            OnCalculatorUpdate(this, EventArgs.Empty);

            birthDateListItem.Description = "Your birthdate, tap to set";

            this.Items.Add(birthDateListItem);
            this.Items.Add(daysOldListItem);
            this.Items.Add(physicalListItem);
            this.Items.Add(emotionalListItem);
            this.Items.Add(intellectualListItem);

            this.Click += new EventHandler(OnClick);
        }
开发者ID:aprilix,项目名称:NeoRhythm,代码行数:25,代码来源:PercentageView.cs


示例6: cmdGet_Click

    private void cmdGet_Click(object sender, EventArgs e)
    {
        try
        {

            //execute the GetRssFeeds method in out
            //FeedManager class to retrieve the feeds
            //for the specified URL
            reader.Url = txtURL.Text;
            reader.getFeed();
            list = reader.rssItems;
            //list = reader
            //now populate out ListBox
            //loop through the count of feed items returned
            for (int i = 0; i < list.Count; i++)
            {
                //add the title, link and public date
                //of each feed item to the ListBox
                row = new ListViewItem();
                row.Text = list[i].Title;
                row.SubItems.Add(list[i].Link);
                row.SubItems.Add(list[i].Date.ToShortDateString());
                lstNews.Items.Add(row);
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }
开发者ID:LRB-Experiments,项目名称:RSS,代码行数:30,代码来源:Form1.cs


示例7: OnCreate

		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			int paramLength = this.Intent.GetIntExtra (AlarmClock.ExtraLength, 0);

			if (Log.IsLoggable (Tag, LogPriority.Debug))
				Log.Debug (Tag, "SetTimerActivity:onCreate=" + paramLength);
			
			if (paramLength > 0 && paramLength <= 86400) {
				long durationMillis = paramLength * 1000;
				SetupTimer (durationMillis);
				Finish ();
				return;
			}

			var res = this.Resources;
			for (int i = 0; i < NumberOfTimes; i++) {
				timeOptions [i] = new ListViewItem (
					res.GetQuantityString (Resource.Plurals.timer_minutes, i + 1, i + 1),
					(i + 1) * 60 * 1000);
			}

			SetContentView (Resource.Layout.timer_set_timer);

			// Initialize a simple list of countdown time options.
			wearableListView = FindViewById<WearableListView> (Resource.Id.times_list_view);
			wearableListView.SetAdapter (new TimerWearableListViewAdapter (this));
			wearableListView.SetClickListener (this);
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:30,代码来源:SetTimerActivity.cs


示例8: ListViewCommandEventArgs

        public ListViewCommandEventArgs(ListViewItem item, object commandSource, CommandEventArgs originalArgs)
            : base(originalArgs)
        {
            _item = item;
            _commandSource = commandSource;

            string cmdName = originalArgs.CommandName;
            if (String.Compare(cmdName, ListView.SelectCommandName, true, CultureInfo.InvariantCulture) == 0) {
                _commandType = ListViewCommandType.Select;
            }
            else if (String.Compare(cmdName, ListView.EditCommandName, true, CultureInfo.InvariantCulture) == 0) {
                _commandType = ListViewCommandType.Edit;
            }
            else if (String.Compare(cmdName, ListView.UpdateCommandName, true, CultureInfo.InvariantCulture) == 0) {
                _commandType = ListViewCommandType.Update;
            }
            else if (String.Compare(cmdName, ListView.CancelEditCommandName, true, CultureInfo.InvariantCulture) == 0) {
                _commandType = ListViewCommandType.CancelEdit;
            }
            else if (String.Compare(cmdName, ListView.DeleteCommandName, true, CultureInfo.InvariantCulture) == 0) {
                _commandType = ListViewCommandType.Delete;
            }
            else {
                _commandType = ListViewCommandType.Custom;
            }
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:26,代码来源:ListViewCommandEventArgs.cs


示例9: AddItem

 public void AddItem(ListViewItem Item)
 {
     if (ItemAdded != null)
     {
         ItemAdded(Item);
     }
     base.Items.Add(Item);
 }
开发者ID:systeminsights,项目名称:mtcdemoapp,代码行数:8,代码来源:MonitoredListView.cs


示例10: RemoveItem

    public void RemoveItem(ListViewItem Item)
    {
        if (ItemRemoved != null)
        {
            ItemRemoved();
        }

        base.Items.Remove(Item);
    }
开发者ID:systeminsights,项目名称:mtcdemoapp,代码行数:9,代码来源:MonitoredListView.cs


示例11: MainForm

	public MainForm ()
	{
		ListViewItem listViewItem1 = new ListViewItem (new string [] {
			"de Icaza",
			"Miguel",
			"Somewhere"}, -1);
		SuspendLayout ();
		// 
		// _listView
		// 
		_listView = new ListView ();
		_listView.Dock = DockStyle.Top;
		_listView.FullRowSelect = true;
		_listView.Height = 97;
		_listView.Items.Add (listViewItem1);
		_listView.TabIndex = 0;
		_listView.View = View.Details;
		Controls.Add (_listView);
		// 
		// _nameHeader
		// 
		_nameHeader = new ColumnHeader ();
		_nameHeader.Text = "Name";
		_nameHeader.Width = 75;
		_listView.Columns.Add (_nameHeader);
		// 
		// _firstNameHeader
		// 
		_firstNameHeader = new ColumnHeader ();
		_firstNameHeader.Text = "FirstName";
		_firstNameHeader.Width = 77;
		_listView.Columns.Add (_firstNameHeader);
		// 
		// _countryHeader
		// 
		_countryHeader = new ColumnHeader ();
		_countryHeader.Text = "Country";
		_countryHeader.Width = 108;
		_listView.Columns.Add (_countryHeader);
		// 
		// _bugDescriptionLabel
		// 
		_bugDescriptionLabel = new Label ();
		_bugDescriptionLabel.Location = new Point (8, 110);
		_bugDescriptionLabel.Size = new Size (280, 112);
		_bugDescriptionLabel.TabIndex = 2;
		_bugDescriptionLabel.Text = "The row in the listview should not have a focus rectangle drawn around it.";
		Controls.Add (_bugDescriptionLabel);
		// 
		// Form1
		// 
		AutoScaleBaseSize = new Size (5, 13);
		ClientSize = new Size (292, 160);
		StartPosition = FormStartPosition.CenterScreen;
		Text = "bug #79253";
		ResumeLayout (false);
	}
开发者ID:mono,项目名称:gert,代码行数:57,代码来源:MainForm.cs


示例12: MainForm_Load

	void MainForm_Load (object sender, EventArgs e)
	{
		for (int i = 0; i < 200; i++) {
			ListViewItem listViewItem = new ListViewItem (new string [] {
				"de Icaza",
				"Miguel",
				"Somewhere"}, 0);
			_listView.Items.Add (listViewItem);
		}
	}
开发者ID:mono,项目名称:gert,代码行数:10,代码来源:MainForm.cs


示例13: AddToList

 private void AddToList(ListViewItem lvItem)
 {
     if (this._MCForm.lvErrorCollector.InvokeRequired)
     {
         AddToListCB d = new AddToListCB(AddToList);
         this._MCForm.lvErrorCollector.Invoke(d, new object[] { lvItem });
     }
     else
     {
         this._MCForm.lvErrorCollector.Items.Insert(0, lvItem);
     }
 }
开发者ID:jpmarques,项目名称:mRemoteNC,代码行数:12,代码来源:Messages.Collector.cs


示例14: DiskImageProperies_Load

    private void DiskImageProperies_Load(System.Object sender, System.EventArgs e)
    {
        Hashtable props = _disk.Properties();
        ListViewItem li;

        foreach (DictionaryEntry de in props)
        {
            li = new ListViewItem((string)de.Key);
            li.SubItems.Add(string.Format("{0}", de.Value));
            UIPropList.Items.Add(li);
        }
    }
开发者ID:danlb2000,项目名称:Atari-Disk-Explorer,代码行数:12,代码来源:DiskImageProperies.cs


示例15: Main

	static void Main (string [] args)
	{
		ListView entryList = new ListView ();
		entryList.Sorting = System.Windows.Forms.SortOrder.Descending;

		entryList.BeginUpdate ();
		entryList.Columns.Add ("Type", 100, HorizontalAlignment.Left);

		ListViewItem item = new ListViewItem (new string [] { "A" });
		entryList.Items.Add (item);
		item = new ListViewItem (new string [] { "B" });
		entryList.Items.Add (item);
	}
开发者ID:mono,项目名称:gert,代码行数:13,代码来源:test.cs


示例16: btnAdd_Click

    private void btnAdd_Click(object sender, EventArgs e)
    {
        if (txtNewTitle.Text.Trim().Length == 0)
        {
            Program.showMessageBox("Error! New titles can't be blank.");
            return;
        }
        if(Program.ValidateSpecialChars(txtNewTitle.Text)){
            return;
        }

        ListViewItem item = new ListViewItem(txtNewTitle.Text.Trim());
        lvwNewNames.Items.Add(item);
    }
开发者ID:jocull,项目名称:SeasonRenamer,代码行数:14,代码来源:frmMain.cs


示例17: MForm8

    public MForm8()
    {
        Text = "ListView";
        Size = new Size(350, 300);

        List<Actress> actresses = new List<Actress>();

        actresses.Add(new Actress("Jessica Alba", 1981));
        actresses.Add(new Actress("Angelina Jolie", 1975));
        actresses.Add(new Actress("Natalie Portman", 1981));
        actresses.Add(new Actress("Rachel Weiss", 1971));
        actresses.Add(new Actress("Scarlett Johansson", 1984));

        ColumnHeader name = new ColumnHeader();
        name.Text = "Name";
        name.Width = -1;
        ColumnHeader year = new ColumnHeader();
        year.Text = "Year";

        SuspendLayout();

        ListView lv = new ListView();
        lv.Parent = this;
        lv.FullRowSelect = true;
        lv.GridLines = true;
        lv.AllowColumnReorder = true;
        lv.Sorting = SortOrder.Ascending;
        lv.Columns.AddRange(new ColumnHeader[] {name, year});
        lv.ColumnClick += new ColumnClickEventHandler(ColumnClick);

        foreach (Actress act in actresses) {
            ListViewItem item = new ListViewItem();
            item.Text = act.name;
            item.SubItems.Add(act.year.ToString());
            lv.Items.Add(item);
        }

        lv.Dock = DockStyle.Fill;
        lv.Click += new EventHandler(OnChanged);

        sb = new StatusBar();
        sb.Parent = this;
        lv.View = View.Details;

        ResumeLayout();

        CenterToScreen();
    }
开发者ID:sciruela,项目名称:MonoWinformsTutorial,代码行数:48,代码来源:listview.cs


示例18: method_0

 public void method_0(FileSystemEventArgs fileSystemEventArgs_0)
 {
     foreach (ListViewItem item2 in this.listView1.Items)
     {
         if (item2.ToolTipText.CompareIgnoreCase(fileSystemEventArgs_0.FullPath))
         {
             return;
         }
     }
     ListViewItem item = new ListViewItem(fileSystemEventArgs_0.Name, 0) {
         ToolTipText = fileSystemEventArgs_0.FullPath
     };
     item.SubItems.Add(fileSystemEventArgs_0.ChangeType.ToString());
     item.Tag = fileSystemEventArgs_0;
     this.listView1.Items.Add(item);
 }
开发者ID:nakijun,项目名称:FastDBEngine,代码行数:16,代码来源:FileChangedDialog.cs


示例19: GetColumnAt

            public ListViewColumn GetColumnAt(int x, int y, out ListViewItem item, out ListViewItem.ListViewSubItem subItem)
            {
                subItem = null;
                item = ListView.GetItemAt(x, y);
                if (item == null)
                    return null;

                subItem = item.GetSubItemAt(x, y);
                if (subItem == null)
                    return null;

                for (int i = 0; i < item.SubItems.Count; i++)
                {
                    if (item.SubItems[i] == subItem)
                        return GetColumn(i);
                }
                return null;
            }
开发者ID:zhushengwen,项目名称:example-zhushengwen,代码行数:18,代码来源:Class6.cs


示例20: InitializeComponent

        private void InitializeComponent()
        {
            this.Title.Text = "ListView example";

            ImageList imgList = new ImageList();
            imgList.Images.Add(base.GetType().Assembly, "HelloWorld.Properties.Resources.resources", "Happy");
            imgList.Images.Add(base.GetType().Assembly, "HelloWorld.Properties.Resources.resources", "Smile");
            imgList.Images.Add(base.GetType().Assembly, "HelloWorld.Properties.Resources.resources", "Tongue");
            this.ImageList = imgList;

            ListViewItem listItem1 = new ListViewItem("Example item 1", 0, "Example item 1 selected");
            ListViewItem listItem2 = new ListViewItem("Example item 2", 1, "Example item 2 selected");
            ListViewItem listItem3 = new ListViewItem("Example item 3", 2, "Example item 3 selected");

            Items.Add(listItem1);
            Items.Add(listItem2);
            Items.Add(listItem3);

            this.Click += new EventHandler(SettingsView_Click);
        }
开发者ID:aprilix,项目名称:helloworldn2,代码行数:20,代码来源:SettingsView.cs



注:本文中的ListViewItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ListViewModel类代码示例发布时间:2022-05-24
下一篇:
C# ListViewColumnSorter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap