private void CallFormResize(bool rescale)
        {
            using (SizeForm frm = new SizeForm())
            {
                frm.WidthSize  = _sprite.SpriteWidth;
                frm.HeightSize = _sprite.SpriteHeight;
                frm.UseScale   = rescale;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    _tilesetCtrl.ResizeTileset((short)frm.WidthSize, (short)frm.HeightSize, rescale);
                    for (short i = 0; i < _sprite.Images.Count; ++i)
                    {
                        _sprite.Images[i].Dispose();
                        _sprite.Images[i] = _tilesetCtrl.Tileset.Tiles[i].Graphic;
                    }
                    _sprite.SpriteWidth  = (short)frm.WidthSize;
                    _sprite.SpriteHeight = (short)frm.HeightSize;
                }
                SpriteDrawer.Content = (Bitmap)_sprite.GetImage(_selectedFrame.Index);
                UpdateControls();
                IsDirty = true;
            }

            // these method were made public to resize the contained image:
            FrameBaseEditor.UpdateCenterFrame();
            DirectionAnim.UpdateAnimPanel();
        }
Exemple #2
0
 private static void menuRescale_Click(object sender, EventArgs e)
 {
     using (SizeForm form = new SizeForm())
     {
         ImageEditView editor = PluginManager.Core.ActiveDocument as ImageEditView;
         form.WidthSize  = editor.Content.Width;
         form.HeightSize = editor.Content.Height;
         if (form.ShowDialog() == DialogResult.OK)
         {
             editor.Rescale(form.WidthSize, form.HeightSize, form.Mode);
         }
     }
 }
        /// <summary>
        /// 显示纸张大小
        /// </summary>
        /// <param name="from"></param>
        /// <returns></returns>
        public static string ShowPaperSize(this Form from, string paperSize)
        {
            var size        = string.Empty;
            var messageForm = new SizeForm()
            {
                Text         = "请输入纸张大小",
                FormType     = "PaperSize",
                DefaultValue = paperSize
            };
            var diaResult = messageForm.ShowDialog();

            if (diaResult == DialogResult.OK)
            {
                var width  = messageForm.textBox1.Text;
                var height = messageForm.textBox2.Text;
                size = width + "," + height;
                if (size == ",")
                {
                    size = "empty";
                }
            }
            return(size);
        }