Example #1
0
        public ListBoxLog(MyListBox listBox, string messageFormat, int maxLinesInListbox)
        {
            this.disposed = false;

            this.listBox             = listBox;
            this.messageFormat       = messageFormat;
            this.maxEntriesInListBox = maxLinesInListbox;

            Paused = false;

            canAddLogEntry = listBox.IsHandleCreated;

            //this.listBox.SelectionMode = SelectionMode.MultiExtended;

            this.listBox.HandleCreated   += OnHandleCreated;
            this.listBox.HandleDestroyed += OnHandleDestroyed;

            this.listBox.DrawItem += DrawItemHandler;

            // this.listBox.KeyDown += KeyDownHandler;

            // MenuItem[] menuItems = new MenuItem[] { new MenuItem("Copy", new EventHandler(CopyMenuOnClickHandler)) };

            // this.listBox.ContextMenu = new ContextMenu(menuItems);
            // this.listBox.ContextMenu.Popup += new EventHandler(CopyMenuPopupHandler);

            this.listBox.DrawMode = DrawMode.OwnerDrawFixed;

            this.listBox.SelectionMode = SelectionMode.One;
            this.listBox.Enabled       = true;
        }
Example #2
0
        private void Dispose(bool disposing)
        {
            if (listBox != null)
            {
                canAddLogEntry = false;

                listBox.HandleCreated -= OnHandleCreated;
                listBox.HandleCreated -= OnHandleDestroyed;

                listBox.DrawItem -= DrawItemHandler;
                //listBox.KeyDown -= KeyDownHandler;

                //listBox.ContextMenu.MenuItems.Clear();
                //listBox.ContextMenu.Popup -= CopyMenuPopupHandler;
                listBox.ContextMenu = null;

                listBox.Items.Clear();
                listBox.DrawMode = DrawMode.Normal;
                listBox          = null;
            }
        }
Example #3
0
 public ListBoxLog(MyListBox listBox, string messageFormat) : this(listBox, messageFormat, DefaultLinesInTextBox)
 {
 }
Example #4
0
 public ListBoxLog(MyListBox listBox) : this(listBox, DefaualtMessageFormat, DefaultLinesInTextBox)
 {
 }