internal static void DrawFontBoxItem(ListBoxDrawItemEventArgs e, RepositoryItemCustomFontEdit item, bool IsDrawStyle, string sCurrentFontName)
        {
            if (sCurrentFontName == string.Empty)
            {
                return;
            }
            using (SolidBrush foreBrush = new SolidBrush(e.Appearance.ForeColor), backBrush = new SolidBrush(e.Appearance.BackColor))
            {
                if (!FontItemPaintHelper.DrawItemBar(e, item as RepositoryItemComboBox))
                {
                    e.Graphics.FillRectangle(backBrush, e.Bounds);
                }
                using (FontFamily family = new FontFamily(sCurrentFontName))
                {
                    FontStyle currentStyle = FontStyle.Regular;
                    if (IsDrawStyle)
                    {
                        switch (e.Item.ToString())
                        {
                        case "Regular":
                            currentStyle = FontStyle.Regular;
                            break;

                        case "Italic":
                            currentStyle = FontStyle.Italic;
                            break;

                        case "Bold":
                            currentStyle = FontStyle.Bold;
                            break;

                        case "Bold Italic":
                            currentStyle = FontStyle.Bold | FontStyle.Italic;
                            break;

                        default:
                            break;
                        }
                    }
                    using (Font font = new Font(family, e.Appearance.Font.Size, currentStyle))
                    {
                        RepositoryItemCustomFontEdit.DrawFontName(e.Graphics, e.Item.ToString(), font, e.Appearance.Font, foreBrush, e.Bounds, true);
                        e.Handled = true;
                    }
                }
            }
        }
 // static constructor
 static CustomFontEdit()
 {
     RepositoryItemCustomFontEdit.RegisterCustomFontEdit();
 }
 private void listBoxControlFontStyle_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     RepositoryItemCustomFontEdit.DrawFontBoxItem(e, currentRepository, true, listBoxControlFontName.SelectedItem.ToString());
 }
 internal FontDialogCommonForm(RepositoryItemCustomFontEdit Owner)
 {
     InitializeComponent();
     currentRepository = Owner;
 }
 private void listBoxControlFontName_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     RepositoryItemCustomFontEdit.DrawFontBoxItem(e, currentRepository, false, e.Item.ToString());
 }