Author: ivanz
Date: 2007-08-28 08:10:40 -0400 (Tue, 28 Aug 2007)
New Revision: 84946

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CursorConverter.cs
Log:
2007-08-27  Ivan N. Zlatev  <[EMAIL PROTECTED]>

        * CursorConverter.cs: Implement conversion to
        InstanceDescriptor.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-08-28 11:56:32 UTC (rev 84945)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-08-28 12:10:40 UTC (rev 84946)
@@ -1,5 +1,9 @@
 2007-08-27  Ivan N. Zlatev  <[EMAIL PROTECTED]>
 
+       * CursorConverter.cs: Implement conversion to InstanceDescriptor.
+
+2007-08-27  Ivan N. Zlatev  <[EMAIL PROTECTED]>
+
        * GridEntry.cs: Implement GetService.
 
 2007-08-27  Jonathan Pobst  <[EMAIL PROTECTED]>

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CursorConverter.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CursorConverter.cs   
    2007-08-28 11:56:32 UTC (rev 84945)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CursorConverter.cs   
    2007-08-28 12:10:40 UTC (rev 84946)
@@ -29,6 +29,7 @@
 using System.Drawing.Imaging;
 using System.Collections;
 using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
 using System.Globalization;
 using System.Reflection;
 using System.Runtime.InteropServices;
@@ -52,7 +53,7 @@
 
                public override bool CanConvertTo (ITypeDescriptorContext 
context, Type dest_type)
                {
-                       if (dest_type == typeof (byte []))
+                       if (dest_type == typeof (byte []) || dest_type == 
typeof (InstanceDescriptor))
                                return true;
                        return base.CanConvertTo (context, dest_type);
                }
@@ -93,6 +94,13 @@
                                ((ISerializable)c).GetObjectData(si, new 
StreamingContext(StreamingContextStates.Remoting));
 
                                return (byte[])si.GetValue("CursorData", 
typeof(byte[]));
+                       } else if (dest_type == typeof (InstanceDescriptor)) {
+                               PropertyInfo[] properties = typeof 
(Cursors).GetProperties ();
+                               foreach (PropertyInfo propInfo in properties) {
+                                       if (propInfo.GetValue (null, null) == 
value) {
+                                               return new InstanceDescriptor 
(propInfo, null);
+                                       }
+                               }
                        }
                        return base.ConvertTo (context, culture, value, 
dest_type);
                }

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

Reply via email to