Exemplo n.º 1
0
        /// <summary>
        /// This is overridden to display the editor dialog box and allows
        /// the user to edit the image map area coordinates in a more
        /// user-friendly fashion.
        /// </summary>
        /// <param name="context">The descriptor context</param>
        /// <param name="provider">The service provider</param>
        /// <param name="value">The image area coordinates</param>
        /// <returns>The edited image area coordinates</returns>
        /// <exception cref="ArgumentException">This is thrown if the area collection is not owned by an image
        /// map control.</exception>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService srv = null;

            // Get the forms editor service from the provider to display the form
            if (provider != null)
            {
                srv = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            }

            if (srv != null)
            {
                using (ImageMapAreaEditorDlg dlg = new ImageMapAreaEditorDlg())
                {
                    IImageMap im = ImageAreaCollectionEditor.Areas.ImageMapControl;

                    if (im == null)
                    {
                        throw new ArgumentException("The area collection is not owned by an ImageMap");
                    }

                    dlg.Image       = ((EWSoftware.ImageMaps.Windows.Forms.ImageMap)im).Image;
                    dlg.ImageHeight = im.ImageMapHeight;
                    dlg.ImageWidth  = im.ImageMapWidth;
                    dlg.Coordinates = (string)value;

                    if (srv.ShowDialog(dlg) == DialogResult.OK)
                    {
                        return(dlg.Coordinates);
                    }
                }
            }

            return(value);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Construct a collection from an enumerable list of <see cref="IImageArea"/> objects
 /// </summary>
 /// <param name="map">The image map control that owns the collection</param>
 /// <param name="areas">An enumerable list of <see cref="IImageArea"/> objects to add</param>
 public ImageAreaCollection(IImageMap map, IEnumerable <IImageArea> areas) : this(map)
 {
     this.AddRange(areas);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Construct an empty collection associated with the specified <see cref="IImageMap"/> control
 /// </summary>
 /// <param name="map">The image map control that owns the collection</param>
 public ImageAreaCollection(IImageMap map)
 {
     im = map;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Construct collection from an enumerable list of <see cref="IImageArea"/> objects
 /// </summary>
 /// <param name="map">The image map control that owns the collection</param>
 /// <param name="areas">An enumerable list of <see cref="IImageArea"/> objects</param>
 public WebImageAreaCollection(IImageMap map, IEnumerable <IImageArea> areas) : base(map, areas)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Construct an empty collection associated with the specified <see cref="IImageMap"/> control
 /// </summary>
 /// <param name="map">The image map control that owns the collection</param>
 public WebImageAreaCollection(IImageMap map) : base(map)
 {
 }
Exemplo n.º 6
0
 /// <summary>
 /// Construct collection from an enumerable list of <see cref="IImageArea"/> objects
 /// </summary>
 /// <param name="map">The image map control that owns the collection</param>
 /// <param name="areas">An enumerable list of <see cref="IImageArea"/> objects</param>
 public WebImageAreaCollection(IImageMap map, IEnumerable<IImageArea> areas)
     : base(map, areas)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Construct an empty collection associated with the specified <see cref="IImageMap"/> control
 /// </summary>
 /// <param name="map">The image map control that owns the collection</param>
 public WebImageAreaCollection(IImageMap map)
     : base(map)
 {
 }