2007-01-02 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / Hwnd.cs
index 0cecfbbc810b1bea067da396f381a7cfecaa7698..3a03e010af2bca3f14755a6126e2e4ae965d5ab1 100644 (file)
@@ -75,8 +75,10 @@ namespace System.Windows.Forms {
                internal bool           zombie; /* X11 only flag.  true if the X windows have been destroyed but we haven't been Disposed */
                internal Region         user_clip;
                internal static Bitmap  bmp = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+               internal static Graphics bmp_g = Graphics.FromImage (bmp);
                internal XEventQueue    queue;
                internal bool           no_activate;    // For Win32, popup windows will not steal focus
+               internal WindowExStyles initial_ex_style;
                #endregion      // Local Variables
 
                // locks for some operations (used in XplatUIX11.cs)
@@ -178,13 +180,8 @@ namespace System.Windows.Forms {
 
                        if (menu != null) {
                                int menu_height = menu.Rect.Height;
-                               if (menu_height == 0) {
-                                       Graphics g;
-
-                                       g = Graphics.FromImage(bmp);
-                                       menu_height = ThemeEngine.Current.CalcMenuBarSize(g, menu, client_rect.Width);
-                                       g.Dispose();
-                               }
+                               if (menu_height == 0)
+                                       menu_height = ThemeEngine.Current.CalcMenuBarSize(bmp_g, menu, client_rect.Width);
 
                                rect.Y -= menu_height;
                                rect.Height += menu_height;