Esempio n. 1
0
 private void OutputList_SelectAll(object sender, EventArgs e)
 {
     OutputList.BeginUpdate();
     for (int i = 0; i < OutputList.Items.Count; ++i)
     {
         OutputList.SetSelected(i, true);
     }
     OutputList.EndUpdate();
 }
Esempio n. 2
0
        private void OutputList_DeleteSelected(object sender, EventArgs e)
        {
            OutputList.BeginUpdate();
            var selectedIndices = new List <int>(OutputList.SelectedIndices.Cast <int>());
            // but first copy selected text to the clipboard
            var Selected = new StringBuilder("");

            selectedIndices.ForEach(index => Selected.Append(((Line)OutputList.Items[index]).Str + "\n"));
            String dest = String.Join("\r\n", Selected.ToString());

            if (dest != "")
            {
                Clipboard.SetText(dest);
                // now delete the items
                // Remove each item in reverse order to maintain integrity
                selectedIndices.Reverse();
                selectedIndices.ForEach(index => OutputList.Items.RemoveAt(index));

                OutputList.SelectedItem = -1;
            }
            OutputList.EndUpdate();
        }
Esempio n. 3
0
        public void OutputList_Add(string Str, Color color)
        {
            Line newLine;

            Invoke((MethodInvoker)(() => OutputList.BeginUpdate()));
            string[] strings = Str.Split('\n');
            foreach (var str in strings)
            {
                newLine = new Line(str, color);
                lines.Add(newLine);
                int testWidth = TextRenderer.MeasureText(str,
                                                         OutputList.Font, OutputList.ClientSize,
                                                         TextFormatFlags.NoPrefix).Width;
                if (testWidth > outputlist_width)
                {
                    outputlist_width = testWidth;
                }

                Invoke((MethodInvoker)(() => OutputList.HorizontalExtent = outputlist_width));
                Invoke((MethodInvoker)(() => OutputList.Items.Add(newLine)));
                Invoke((MethodInvoker)(() => OutputList_Scroll()));
                Invoke((MethodInvoker)(() => OutputList.EndUpdate()));
            }
        }