Exemplo n.º 1
0
        private void SetSentMessage(ListViewItem item)
        {
            // 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 (this.lvwSentMessages.InvokeRequired)
            {
                SetSentMessageCallback d = new SetSentMessageCallback(SetSentMessage);
                this.Invoke(d, new object[] { item });
            }
            else
            {
                lvwSentMessages.Items.Add(item);
                lvwSentMessages.Items[lvwSentMessages.Items.Count - 1].Selected = true;
                lvwSentMessages.EnsureVisible(lvwSentMessages.Items.Count - 1);

                if (lvwSentMessages.Scrollable && colSentDateTime.Width >= 160)
                {
                    colSentDateTime.Width = 140;
                }
                else if (!lvwSentMessages.Scrollable && colSentDateTime.Width < 160)
                {
                    colSentDateTime.Width = 160;
                }
            }
        }
Exemplo n.º 2
0
        private void SetSentMessage(ListViewItem item)
        {
            // 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 (this.lvwSentMessages.InvokeRequired)
            {
                SetSentMessageCallback d = new SetSentMessageCallback(SetSentMessage);
                this.Invoke(d, new object[] { item });
            }
            else
            {
                lvwSentMessages.Items.Add(item);
                lvwSentMessages.Items[lvwSentMessages.Items.Count - 1].Selected = true;
                lvwSentMessages.EnsureVisible(lvwSentMessages.Items.Count - 1);

                if (lvwSentMessages.Scrollable && colSentDateTime.Width >= 160)
                {
                    colSentDateTime.Width = 140;
                }
                else if (!lvwSentMessages.Scrollable && colSentDateTime.Width < 160)
                {
                    colSentDateTime.Width = 160;
                }

            }
        }