//////////////////////////////////////////////////////////////////////////
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null) return value;
            NativePropProxy Proxy = context.Instance as NativePropProxy;
            if (Proxy == null || Proxy.NativeObject == null)
            {
                SystemSounds.Asterisk.Play();
                return value;
            }

            WUITiledImage OrigObj = value as WUITiledImage;

            TiledImgAssignForm dlg = new TiledImgAssignForm();
            dlg.Game = Proxy.NativeObject.Game;
            dlg.ParentForm = Form.ActiveForm;
            dlg.Filter = "Tiled images|*.image";
            if (OrigObj != null && OrigObj.Filename != null)
                dlg.Filename = OrigObj.Filename;

            DialogResult Res = dlg.ShowDialog();

            switch (Res)
            {
                case DialogResult.OK:
                    try
                    {
                        WUITiledImage NewObj = new WUITiledImage(Proxy.NativeObject.Game);
                        if (!NewObj.LoadFromFile(dlg.Filename))
                        {
                            NewObj.Dispose();
                            return value;
                        }
                        else return NewObj;
                    }
                    catch
                    {
                        return value;
                    }
                case DialogResult.Abort:
                    return null;
                default:
                    return value;
            }
        }
        //////////////////////////////////////////////////////////////////////////
        private void OnNewFile(object sender, EventArgs e)
        {
            if (!CanClose()) return;

            if(TiledImg != null)
            {
                TiledImg.ClaimOwnership();
                TiledImg.Dispose();
            }
            TiledImg = new WUITiledImage(Game);
            Filename = "";
            IsDirty = true;
            DisplayData();
        }
        //////////////////////////////////////////////////////////////////////////
        private void LoadFile(string Filename)
        {
            WUITiledImage NewImage = new WUITiledImage(Game);
            if (NewImage.LoadFromFile(Filename))
            {
                if (TiledImg != null)
                {
                    TiledImg.ClaimOwnership();
                    TiledImg.Dispose();
                }

                this.TiledImg = NewImage;
                this.Filename = Filename;
                this.IsDirty = false;
            }
            else MessageBox.Show("Error loading file.", Form.ActiveForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }