X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Drawing.Design%2FSystem.Drawing.Design%2FFontNameEditor.cs;h=09ee3ece62c4ff0773a1d0f325b84938c3a7be61;hb=a0b5bd66266b689af0851c348d6efc2a7167d933;hp=db9297469966903eec6e2130956c175293391b00;hpb=e51a9b6ba1a93bc981639a706c93bee413099fd6;p=mono.git diff --git a/mcs/class/System.Drawing.Design/System.Drawing.Design/FontNameEditor.cs b/mcs/class/System.Drawing.Design/System.Drawing.Design/FontNameEditor.cs index db929746996..09ee3ece62c 100644 --- a/mcs/class/System.Drawing.Design/System.Drawing.Design/FontNameEditor.cs +++ b/mcs/class/System.Drawing.Design/System.Drawing.Design/FontNameEditor.cs @@ -57,10 +57,11 @@ namespace System.Drawing.Design G.FillRectangle (SystemBrushes.ActiveCaption, e.Bounds); // Draw the sample string - if (e.Value != null) - { - Font F = (Font) e.Value; - G.DrawString (PreviewString, F, SystemBrushes.ActiveCaptionText, e.Bounds); + string fontName = e.Value as string; + if (fontName != null && fontName.Length > 0) { + using (Font font = new Font (fontName, e.Bounds.Height, FontStyle.Regular, GraphicsUnit.Pixel)) { + G.DrawString (PreviewString, font, SystemBrushes.ActiveCaptionText, e.Bounds); + } } // Draw the border again to ensure it is not overlapped by the text