Exemplo n.º 1
0
        //添加单行数据
        public void AddListViewData(ListView list, Dictionary<string, string> data)
        {
            if (list.InvokeRequired)//不能访问就创建委托
            {
                ListViewDelegate d = new ListViewDelegate(AddListViewData);
                list.Invoke(d, new object[] { list, data });
            }
            else
            {
                list.BeginUpdate();
                ListViewItem list_item = new ListViewItem();
                bool need_init = true;
                foreach (KeyValuePair<string, string> cell in data)
                {
                    ListViewItem.ListViewSubItem list_sub_item = new ListViewItem.ListViewSubItem();
                    if (need_init)
                    {
                        list_item.Text = cell.Value;
                        need_init = false;
                    }
                    else
                    {
                        list_sub_item.Text = cell.Value;
                        list_item.SubItems.Add(list_sub_item);
                    }
                }
                list.Items.Add(list_item);
                list.EnsureVisible(list.Items.Count - 1);
                list.EndUpdate();

            }
        }
 public Form1()
 {
     rand = new Random();
     cookieContainer = new CookieContainer();
     progressDelegate = new ProgressDelegate(updateProgress);
     listViewDelegate = new ListViewDelegate(updateListView);
     statusDelegate = new StatusDelegate(updateStatus);
     InitializeComponent();
 }
Exemplo n.º 3
0
 public Form1()
 {
     rand             = new Random();
     cookieContainer  = new CookieContainer();
     progressDelegate = new ProgressDelegate(updateProgress);
     listViewDelegate = new ListViewDelegate(updateListView);
     statusDelegate   = new StatusDelegate(updateStatus);
     InitializeComponent();
 }
Exemplo n.º 4
0
 public void AddToListView(ListView Info, ListViewItem Item)
 {
     if (Info.InvokeRequired)
     {
         ListViewDelegate DDD = new ListViewDelegate(AddToListView);
         Info.Invoke(DDD, new object[] { Info, Item });
     }
     else
     {
         Info.Items.Add(Item);
     }
 }
Exemplo n.º 5
0
 private void ListView(string detail)
 {
     if (this.listView1.InvokeRequired == false)
     {
         for (int i = 0; i < Global.TotalNum; i++)
         {
             this.listView1.Items[i].SubItems[1].Text = Global.Result[i];
             if (Global.Result[i] == "OK")
             {
                 this.listView1.Items[i].SubItems[1].BackColor = System.Drawing.Color.Green;
             }
             else
             {
                 this.listView1.Items[i].SubItems[1].BackColor = System.Drawing.Color.Red;
             }
         }
     }
     else
     {
         ListViewDelegate LViewD = new ListViewDelegate(ListView);
         this.listView1.Invoke(LViewD, detail);
     }
 }
Exemplo n.º 6
0
 public GridView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
 {
     ptr_delegate = new ListViewDelegate(this);
 }
 public ExpandableListView(Context context, IAttributeSet attrs, int defStyle)
     : base(context, attrs, defStyle)
 {
     ptr_delegate = new ListViewDelegate(this);
 }