コード例 #1
0
        internal MsgBox_RichTextBox(string message, string caption, string buttonText)
        {
            InitializeComponent();

            textBox2.Text = message;
            this.Text     = caption;
            button1.Text  = buttonText;

            #region ToolStrip Settings
            BoldButton.CheckOnClick    = true;
            BoldButton.CheckedChanged += BoldButton_CheckedChanged;

            ItalicsButton.CheckOnClick    = true;
            ItalicsButton.CheckedChanged += ItalicsButton_CheckedChanged;

            UnderlineButton.CheckOnClick    = true;
            UnderlineButton.CheckedChanged += UnderlineButton_CheckedChanged;

            Image textColorImage      = IndependentFunctions.FontColorImage(Color.Red);
            Image highlightColorImage = IndependentFunctions.HighlightColorImage(Color.Yellow);
            TextColorButton.Image      = textColorImage;
            HighlightColorButton.Image = highlightColorImage;

            FontFamily[] ffs = FontFamily.Families;
            ChooseFont.ComboBox.DataSource = ffs.Select(x => x.Name).ToList <string>();

            FontSizeChoose.ComboBox.DataSource = new List <int>()
            {
                8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72
            }.Select(x => x.ToString()).ToList <string>();
            #endregion
        }
コード例 #2
0
        private void HighlightColorButton_Click(object sender, EventArgs e)
        {
            ColorDialog cd = new ColorDialog();

            cd.AllowFullOpen = true;
            DialogResult dr = cd.ShowDialog();

            if (dr == DialogResult.OK)
            {
                HighlightColorButton.Image = IndependentFunctions.HighlightColorImage(cd.Color);
                HighlightColorButton.Text  = String.Format("({0},{1},{2})", cd.Color.R, cd.Color.G, cd.Color.B);

                richTextBox1.SelectionBackColor = cd.Color;
            }
        }