Exemplo n.º 1
0
 private void SetLogItemImageIndex(ListViewItem item, IMAGE_KEYS index)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (ConvertLogLV.InvokeRequired)
     {
         SetLogItemImageIndexCallback d = new SetLogItemImageIndexCallback(SetLogItemImageIndex);
         ConvertLogLV.BeginInvoke(d, new object[] { item, index });
     }
     else
     {
         item.ImageIndex = (int)index;
         ConvertLogLV.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     }
 }
Exemplo n.º 2
0
 private void SetLogItemtext(ListViewItem item, string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (ConvertLogLV.InvokeRequired)
     {
         SetLogItemtextCallback d = new SetLogItemtextCallback(SetLogItemtext);
         ConvertLogLV.BeginInvoke(d, new object[] { item, text });
     }
     else
     {
         item.Text = text;
         ConvertLogLV.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     }
 }
Exemplo n.º 3
0
 private ListViewItem AddLogItem(string text)
 {
     if (ConvertLogLV.InvokeRequired)
     {
         AddLogItemCallback d      = new AddLogItemCallback(AddLogItem);
         IAsyncResult       result = ConvertLogLV.BeginInvoke(d, new object[] { text });
         result.AsyncWaitHandle.WaitOne();
         ListViewItem returnValue = (ListViewItem)this.EndInvoke(result);
         result.AsyncWaitHandle.Close();
         return(returnValue);
     }
     else
     {
         ListViewItem result = ConvertLogLV.Items.Add(text);
         ConvertLogLV.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
         ConvertLogLV.EnsureVisible(result.Index);
         return(result);
     }
 }