// Peter Bartok pbartok@novell.com
//
+// If we ever need to support the Handle property, we should create a static ArrayList,
+// and store the ImageList object in it, and return the index as handle
+// That way, once we try to support P/Invokes, we can make the handle back to the object
+
// COMPLETE
namespace System.Windows.Forms {
[DefaultProperty("Images")]
- [Designer("System.Windows.Forms.Design.ImageListDesigner, " + Consts.AssemblySystem_Design)]
+ [Designer("System.Windows.Forms.Design.ImageListDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
[ToolboxItemFilter("System.Windows.Forms", ToolboxItemFilterType.Allow)]
- [TypeConverter("System.Windows.Forms.ImageListConverter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+ [TypeConverter("System.Windows.Forms.ImageListConverter, " + Consts.AssemblySystem_Windows_Forms)]
public sealed class ImageList : System.ComponentModel.Component {
#region Local Variables
private ColorDepth color_depth;
private Color transparency_color;
private Delegate handler;
private ImageListStreamer image_stream;
+ private IntPtr handle;
#endregion // Local Variables
#region Sub-classes
case ColorDepth.Depth8Bit: format=PixelFormat.Format8bppIndexed; break;
case ColorDepth.Depth16Bit: format=PixelFormat.Format16bppRgb555; break;
case ColorDepth.Depth24Bit: format=PixelFormat.Format24bppRgb; break;
- case ColorDepth.Depth32Bit: format=PixelFormat.Format32bppRgb; break;
- default: format=PixelFormat.Format32bppRgb; break;
+ case ColorDepth.Depth32Bit: format=PixelFormat.Format32bppArgb; break;
+ default: format=PixelFormat.Format32bppArgb; break;
}
// Check if we can add straight or if we have to resize
reformatted_image = new Bitmap(width, height, format);
g=Graphics.FromImage(reformatted_image);
- g.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, width, height, GraphicsUnit.Pixel);
+ g.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
g.Dispose();
return list.Add(reformatted_image);
transparency_color = Color.Transparent;
size = new Size(16, 16);
image_collection = new ImageCollection(this);
+ handle = IntPtr.Zero;
}
public ImageList(System.ComponentModel.IContainer container) : this ()
{
+ color_depth = ColorDepth.Depth8Bit;
+ transparency_color = Color.Transparent;
+ size = new Size(16, 16);
container.Add (this);
}
#endregion // Public Constructors
}
}
- [MonoTODO("Determine if we support HBITMAP handles, this would involve XplatUI")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IntPtr Handle {
get {
if (RecreateHandle!=null) RecreateHandle(this, EventArgs.Empty);
- return IntPtr.Zero;
+ handle = new IntPtr(1);
+ return handle;
}
}
- [MonoTODO("Determine if we support HBITMAP handles, this would involve XplatUI")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool HandleCreated {
get {
+ if (handle != IntPtr.Zero) {
+ return true;
+ }
return false;
}
}
set {
image_stream = value;
+
+ size = image_stream.ImageSize;
+ color_depth = image_stream.ImageColorDepth;
+ transparency_color = image_stream.BackColor;
+
+ image_collection.Clear ();
+
+ foreach (Image image in image_stream.Images)
+ image_collection.Add (image);
}
}
g.DrawImage(i, x, y, width, height);
}
- public override string ToString() {\r
- return "ImageList Size "+this.size.Width.ToString()+"x"+this.size.Height.ToString()+", Depth "+this.color_depth.ToString()+", Transparency color "+this.transparency_color.ToString();\r
+ public override string ToString() {
+ return base.ToString () + " Images.Count: " + Images.Count + ", ImageSize: " + ImageSize;\r
}
#endregion // Public Instance Methods