public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(int))
            {
                return(value);
            }
            MapProperties mep = (MapProperties)context.Instance;
            CHRSelect     cs  = new CHRSelect(mep.mp, true);

            cs.StartPosition = FormStartPosition.CenterParent;
            cs.preselect     = (int)value;
            cs.dualpage      = dualpage;
            cs.sprite        = !dualpage;
            if (cs.ShowDialog() == DialogResult.OK)
            {
                if (cs.highlight >= 0 && cs.highlight < mep.mp.chr_count)
                {
                    value = cs.highlight;
                    if (dualpage)
                    {
                        value = (int)value & ~1;
                    }
                }
            }
            return(value);
        }
        public override void PaintIcon(PaintValueEventArgs e, Rectangle r)
        {
            MapProperties mep  = (MapProperties)e.Context.Instance;
            byte          tile = (byte)(int)e.Value;
            Bitmap        b    = mep.me.make_icon(tile, grey?4:(tile >> 6), false, 1);

            e.Graphics.DrawImage(b, r);
        }
        public override void PaintIcon(PaintValueEventArgs e, Rectangle r)
        {
            MapProperties mep    = (MapProperties)e.Context.Instance;
            byte          sprite = (byte)(0x81 + ((int)e.Value * 4));

            if (shop)
            {
                sprite += (8 * 4);
            }
            Bitmap b = mep.me.make_icon(sprite, 1, true, 1);

            e.Graphics.DrawImage(b, r);
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(int))
            {
                return(value);
            }
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                MapProperties          mep  = (MapProperties)context.Instance;
                CollectibleItemControl prop = new CollectibleItemControl(mep.me, shop, (int)value);
                edSvc.DropDownControl(prop);
                return(prop.result);
            }
            return(value);
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(int))
            {
                return(value);
            }
            MapProperties mep = (MapProperties)context.Instance;
            MapEditTile   et  = new MapEditTile(mep.me, mep.mp, true);

            et.StartPosition  = FormStartPosition.CenterParent;
            et.show_palselect = !grey;
            et.set_modal_tile(-1, -1, (int)value);
            if (et.ShowDialog() == DialogResult.OK)
            {
                value = (int)et.result;
                if (grey)
                {
                    value = (int)(et.result & 0x3F);
                }
            }
            return(value);
        }