Example #1
0
        public InsertCodeInsertForm()
        {
            InitializeComponent();

            foreach (var format in FormatFactory.GetFormats())
            {
                comboBoxLanguage.Items.Add(format);
            }

            Load += delegate {
                this.timer1.Start();
                richTextBox1.Focus();
                if (comboBoxLanguage.SelectedItem == null)
                {
                    comboBoxLanguage.SelectedIndex = 0;
                }
            };

            checkBoxLineNumbers.CheckedChanged             += delegate { Preview(); };
            checkBoxAlternateLineBackground.CheckedChanged += delegate { Preview(); };
            comboBoxLanguage.SelectedIndexChanged          += delegate { Preview(); };
            timer1.Tick += delegate { Preview(); };

            buttonCancel.Click += delegate {
                DialogResult = DialogResult.Cancel;
                Close();
            };

            buttonOK.Click += delegate {
                DialogResult = DialogResult.OK;
                Close();
            };
        }