Beispiel #1
0
        /// <summary>Set up UI Elements</summary>
        private void SetupUI()
        {
            // Browse for log file
            m_btn_log_filepath.Click += (s, a) =>
            {
                OpenLogFile(null);
            };

            // Resize the log file path text box
            m_tb_log_filepath.AutoSize = false;
            m_ts.CanOverflow           = true;
            m_ts.Layout += (s, a) =>
            {
                m_tb_log_filepath.StretchToFit(250);
            };

            // Clear log
            m_btn_clear.ToolTip(m_tt, "Clear the log");
            m_btn_clear.Overflow = ToolStripItemOverflow.Never;
            m_btn_clear.Click   += (s, a) =>
            {
                Clear();
            };

            // Jump to the bottom of the log
            m_btn_tail.ToolTip(m_tt, "Jump to the last log entry");
            m_btn_tail.Overflow = ToolStripItemOverflow.Never;
            m_btn_tail.Click   += (s, a) =>
            {
                TailScroll();
            };

            // Line Wrap mode
            m_chk_line_wrap.Checked         = LineWrap;
            m_chk_line_wrap.Overflow        = ToolStripItemOverflow.Never;
            m_chk_line_wrap.CheckedChanged += (s, a) =>
            {
                LineWrap = m_chk_line_wrap.Checked;
            };
            SetLineWrap(LineWrap);

            // Set up the grid for displaying log entries
            m_view.AutoGenerateColumns         = false;
            m_view.ColumnHeadersVisible        = false;
            m_view.CellValueNeeded            += HandleCellValueNeeded;
            m_view.CellFormatting             += HandleCellFormatting;
            m_view.VisibleChanged             += DataGridView_.FitColumnsWithNoLineWrap;
            m_view.ColumnWidthChanged         += DataGridView_.FitColumnsWithNoLineWrap;
            m_view.RowHeadersWidthChanged     += DataGridView_.FitColumnsWithNoLineWrap;
            m_view.AutoSizeColumnsModeChanged += DataGridView_.FitColumnsWithNoLineWrap;
            m_view.SizeChanged += DataGridView_.FitColumnsWithNoLineWrap;
            m_view.Scroll      += DataGridView_.FitColumnsWithNoLineWrap;
            m_view.MouseDown   += DataGridView_.ColumnVisibility;
            m_view.VirtualMode  = true;
            m_view.ColumnCount  = 1;
            m_view.RowCount     = 0;
        }