Пример #1
0
        protected void InitializeColorControl(TextBoxBrowser control, Color color)
        {
            control.ReadOnly = true;
            control.Browse += (s, e) =>
            {
                using (var dialog = new ColorDialog())
                {
                    dialog.Color = (Color)control.Tag;

                    if (dialog.ShowDialog(this) == DialogResult.OK)
                        LoadColorControl(control, dialog.Color);
                }
            };

            LoadColorControl(control, color);
        }
Пример #2
0
        protected void InitializeFontControl(TextBoxBrowser control, Font font, bool fixedPitchOnly)
        {
            control.ReadOnly = true;
            control.Browse += (s, e) =>
            {
                using (var dialog = new FontDialog())
                {
                    dialog.Font = (Font)control.Tag;
                    dialog.FixedPitchOnly = fixedPitchOnly;

                    if (dialog.ShowDialog(this) == DialogResult.OK)
                        LoadFontControl(control, dialog.Font);
                }
            };

            LoadFontControl(control, font);
        }
Пример #3
0
 protected void InitializeFontControl(TextBoxBrowser control, Font font)
 {
     InitializeFontControl(control, font, false);
 }
Пример #4
0
 private void LoadFontControl(TextBoxBrowser control, Font font)
 {
     control.Tag = font;
     control.Text = String.Format(
         "{0}, {1}pt, {2}",
         font.FontFamily.Name,
         font.Size,
         GetFontStyle(font.Style)
     );
 }
Пример #5
0
 private void LoadColorControl(TextBoxBrowser control, Color color)
 {
     control.TextBox.BackColor = color;
     control.Tag = color;
     control.Text = String.Format("{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
 }