Author: spouliot
Date: 2006-07-20 08:52:03 -0400 (Thu, 20 Jul 2006)
New Revision: 62815

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
   trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs
Log:
2006-07-20  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * Graphics: Added implementation for ReleaseHDC by Jonathan Pobst 
        for NET_2_0 profile.



Modified: trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2006-07-20 
12:51:14 UTC (rev 62814)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2006-07-20 
12:52:03 UTC (rev 62815)
@@ -1,3 +1,8 @@
+2006-07-20  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * Graphics: Added implementation for ReleaseHDC by Jonathan Pobst 
+       for NET_2_0 profile.
+
 2006-07-06  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * Image.cs: Ensure we're setting the nativeObject to NULL before 

Modified: trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs   2006-07-20 
12:51:14 UTC (rev 62814)
+++ trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs   2006-07-20 
12:52:03 UTC (rev 62815)
@@ -52,6 +52,9 @@
                private bool disposed = false;
                private static float defDpiX = 0;
                private static float defDpiY = 0;
+#if NET_2_0
+               private IntPtr deviceContextHdc;
+#endif
 
 #if !NET_2_0
                [ComVisible(false)]
@@ -1771,6 +1774,9 @@
                {
                        IntPtr hdc;
                        GDIPlus.CheckStatus (GDIPlus.GdipGetDC 
(this.nativeObject, out hdc));
+#if NET_2_0
+                       deviceContextHdc = hdc;
+#endif
                        return hdc;
                }
 
@@ -2034,13 +2040,22 @@
                {
                        Status status = GDIPlus.GdipReleaseDC (nativeObject, 
hdc);
                        GDIPlus.CheckStatus (status);
+#if NET_2_0
+                       if (hdc == deviceContextHdc)
+                               deviceContextHdc = IntPtr.Zero;
+#endif
                }
+
 #if NET_2_0
-               public void ReleaseHdc()
+               public void ReleaseHdc ()
                {
-                     
+                       if (deviceContextHdc == IntPtr.Zero)
+                               throw new ArgumentException ("Invalid Handle");
+
+                       ReleaseHdc (deviceContextHdc);
                }
 #endif
+
                [MonoTODO]
 #if NET_2_0
                [EditorBrowsable (EditorBrowsableState.Never)]

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to