public void ReadOptionsFromDialog()
        {
            try
            {
                // ColumnWidth = 110 - trackWidth.Value;
                MiniCodeColumnEnabled             = chkEnabled.Checked;       //AussieALF: Added so it saves the updated option
                WordDoubleClickEnabled            = chkWordHighlight.Checked; //AussieALF: Added so it saves the updated option
                ColumnBackgroundColor             = btnBackColor.BackColor;
                ColumnVisibleLinesColor           = btnVisibleRangeColor.BackColor;
                CodeColorNormalLine               = btnLineColor.BackColor;
                CodeColorCommentLine              = btnCommentColor.BackColor;
                ColumnBackgroundColorSelectedWord = btnColumnBackgroundColorSelectedWord.BackColor;
                CodeColorSelectedWord             = btnCodeColorSelectedWord.BackColor;

                CodeToolWindow.DisposeGraphicElements();
                panelSample.Refresh();
            }
            catch
            {
            }
        }
        private void panelSample_Paint(object sender, PaintEventArgs e)
        {
            CodeToolWindow.CreateGraphicElements();
            Graphics graphics = e.Graphics;

            Rectangle rect = new Rectangle(0, sampleHeader.Height, panelSample.Width, panelSample.Height - sampleHeader.Height);

            //SmoothingMode oldMode = graphics.SmoothingMode;
            try
            {
                // alle Zeilen holen
                List <Line> items = Line.SampleLines;

                graphics.FillRectangle(CodeToolWindow.ColumnBackgroundBrushCodeColumn, rect);


                int width_divisor = 2;
                // falls die Höhe nicht reicht, Teiler ermitteln
                int height_divisor = 1;

                // den sichtbaren Bereich markieren
                Rectangle visible_rect = new Rectangle(
                    rect.X, rect.Y + (6 / height_divisor),
                    panelSample.Width, (26 - 6) / height_divisor);
                graphics.FillRectangle(CodeToolWindow.ColumnBrushVisibleLines, visible_rect);


                int left  = rect.X;
                int start = 0;
                int end   = 0;
                for (int l = 0; l < items.Count; l++)
                {
                    Line line = items[l];

                    int y = l / height_divisor + rect.Y;
                    start = line.Start / width_divisor;
                    if (start > panelSample.Width)
                    {
                        start = panelSample.Width - 6;
                    }
                    end = line.End / width_divisor;
                    if (end > panelSample.Width)
                    {
                        end = panelSample.Width;
                    }

                    int start_of_comment = line.StartOfComment;
                    int end_of_comment   = -2;
                    if (start_of_comment >= 0)
                    {
                        start_of_comment = start_of_comment / width_divisor;
                        end_of_comment   = line.EndOfComment / width_divisor;
                        end = start_of_comment - 1;
                    }

                    if (start_of_comment < end_of_comment)
                    {
                        graphics.DrawLine(CodeToolWindow.CodePenCommentLine, new Point(left + start_of_comment, y), new Point(left + end_of_comment, y));
                    }

                    if (start < end)
                    {
                        graphics.DrawLine(CodeToolWindow.CodePenNormalLine, new Point(left + start, y), new Point(left + end, y));
                    }
                }

                int selected_double_click_length = 10;
                if (selected_double_click_length > 2)
                {
                    for (int l = 0; l < items.Count; l++)
                    {
                        Line line = items[l];
                        int  y    = l / height_divisor + rect.Y;
                        start = 0;
                        end   = 0;

                        if (line.HasWord)
                        {
                            int start_index = line.StartOfWords[0];
                            start = start_index / width_divisor;
                            if (start > panelSample.Width)
                            {
                                start = panelSample.Width - 6;
                            }
                            end = (start_index + selected_double_click_length) / width_divisor;
                            if (end > panelSample.Width)
                            {
                                end = panelSample.Width;
                            }
                            graphics.DrawLine(
                                CodeToolWindow.CodePenSelectedWord,
                                new Point(left + start, y),
                                new Point(left + end, y));
                        }
                    }
                }
            }
            catch
            {
            }
        }