Add preview animation fwd/back buttons

This commit is contained in:
Tim Young 2017-09-19 08:35:00 -05:00
parent c0d1d1599d
commit 8067b91759
2 changed files with 81 additions and 32 deletions

View File

@ -49,6 +49,9 @@
this.lblCountSprites = new System.Windows.Forms.Label();
this.TCTabPages = new System.Windows.Forms.TabControl();
this.tpFromImage = new System.Windows.Forms.TabPage();
this.lblAnimationFwdBack = new System.Windows.Forms.Label();
this.btnAnimBack = new System.Windows.Forms.Button();
this.btnAnimFwd = new System.Windows.Forms.Button();
this.tpMirrorRotate = new System.Windows.Forms.TabPage();
this.cbMirrorH = new System.Windows.Forms.CheckBox();
this.cbMirrorV = new System.Windows.Forms.CheckBox();
@ -64,9 +67,8 @@
this.pbPreview = new System.Windows.Forms.PictureBox();
this.btnPreview = new System.Windows.Forms.Button();
this.btnReset = new System.Windows.Forms.Button();
this.btnAnimFwd = new System.Windows.Forms.Button();
this.btnAnimBack = new System.Windows.Forms.Button();
this.lblAnimationFwdBack = new System.Windows.Forms.Label();
this.btnPreviewAnimFwd = new System.Windows.Forms.Button();
this.btnPreviewAnimBack = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pbImageField)).BeginInit();
this.TCTabPages.SuspendLayout();
this.tpFromImage.SuspendLayout();
@ -279,6 +281,37 @@
this.tpFromImage.Text = "From Image";
this.tpFromImage.UseVisualStyleBackColor = true;
//
// lblAnimationFwdBack
//
this.lblAnimationFwdBack.AutoSize = true;
this.lblAnimationFwdBack.Location = new System.Drawing.Point(109, 88);
this.lblAnimationFwdBack.Name = "lblAnimationFwdBack";
this.lblAnimationFwdBack.Size = new System.Drawing.Size(74, 17);
this.lblAnimationFwdBack.TabIndex = 20;
this.lblAnimationFwdBack.Text = "Animation:";
//
// btnAnimBack
//
this.btnAnimBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAnimBack.Location = new System.Drawing.Point(189, 85);
this.btnAnimBack.Name = "btnAnimBack";
this.btnAnimBack.Size = new System.Drawing.Size(32, 23);
this.btnAnimBack.TabIndex = 19;
this.btnAnimBack.Text = "<";
this.btnAnimBack.UseVisualStyleBackColor = true;
this.btnAnimBack.Click += new System.EventHandler(this.btnAnimBack_Click);
//
// btnAnimFwd
//
this.btnAnimFwd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAnimFwd.Location = new System.Drawing.Point(227, 85);
this.btnAnimFwd.Name = "btnAnimFwd";
this.btnAnimFwd.Size = new System.Drawing.Size(32, 23);
this.btnAnimFwd.TabIndex = 18;
this.btnAnimFwd.Text = ">";
this.btnAnimFwd.UseVisualStyleBackColor = true;
this.btnAnimFwd.Click += new System.EventHandler(this.btnAnimFwd_Click);
//
// tpMirrorRotate
//
this.tpMirrorRotate.Controls.Add(this.cbMirrorH);
@ -403,20 +436,22 @@
//
// pbPreview
//
this.pbPreview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pbPreview.Location = new System.Drawing.Point(512, 31);
this.pbPreview.Name = "pbPreview";
this.pbPreview.Size = new System.Drawing.Size(91, 77);
this.pbPreview.Size = new System.Drawing.Size(91, 89);
this.pbPreview.TabIndex = 22;
this.pbPreview.TabStop = false;
//
// btnPreview
//
this.btnPreview.Location = new System.Drawing.Point(527, 114);
this.btnPreview.Location = new System.Drawing.Point(518, 126);
this.btnPreview.Name = "btnPreview";
this.btnPreview.Size = new System.Drawing.Size(75, 23);
this.btnPreview.TabIndex = 23;
this.btnPreview.Text = "Preview";
this.btnPreview.UseVisualStyleBackColor = true;
this.btnPreview.Click += new System.EventHandler(this.btnPreview_Click);
//
// btnReset
//
@ -427,36 +462,25 @@
this.btnReset.Text = "Reset";
this.btnReset.UseVisualStyleBackColor = true;
//
// btnAnimFwd
// btnPreviewAnimFwd
//
this.btnAnimFwd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAnimFwd.Location = new System.Drawing.Point(227, 85);
this.btnAnimFwd.Name = "btnAnimFwd";
this.btnAnimFwd.Size = new System.Drawing.Size(32, 23);
this.btnAnimFwd.TabIndex = 18;
this.btnAnimFwd.Text = ">";
this.btnAnimFwd.UseVisualStyleBackColor = true;
this.btnAnimFwd.Click += new System.EventHandler(this.btnAnimFwd_Click);
this.btnPreviewAnimFwd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnPreviewAnimFwd.Location = new System.Drawing.Point(561, 155);
this.btnPreviewAnimFwd.Name = "btnPreviewAnimFwd";
this.btnPreviewAnimFwd.Size = new System.Drawing.Size(32, 23);
this.btnPreviewAnimFwd.TabIndex = 25;
this.btnPreviewAnimFwd.Text = ">";
this.btnPreviewAnimFwd.UseVisualStyleBackColor = true;
//
// btnAnimBack
// btnPreviewAnimBack
//
this.btnAnimBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAnimBack.Location = new System.Drawing.Point(189, 85);
this.btnAnimBack.Name = "btnAnimBack";
this.btnAnimBack.Size = new System.Drawing.Size(32, 23);
this.btnAnimBack.TabIndex = 19;
this.btnAnimBack.Text = "<";
this.btnAnimBack.UseVisualStyleBackColor = true;
this.btnAnimBack.Click += new System.EventHandler(this.btnAnimBack_Click);
//
// lblAnimationFwdBack
//
this.lblAnimationFwdBack.AutoSize = true;
this.lblAnimationFwdBack.Location = new System.Drawing.Point(109, 88);
this.lblAnimationFwdBack.Name = "lblAnimationFwdBack";
this.lblAnimationFwdBack.Size = new System.Drawing.Size(74, 17);
this.lblAnimationFwdBack.TabIndex = 20;
this.lblAnimationFwdBack.Text = "Animation:";
this.btnPreviewAnimBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnPreviewAnimBack.Location = new System.Drawing.Point(518, 155);
this.btnPreviewAnimBack.Name = "btnPreviewAnimBack";
this.btnPreviewAnimBack.Size = new System.Drawing.Size(32, 23);
this.btnPreviewAnimBack.TabIndex = 26;
this.btnPreviewAnimBack.Text = "<";
this.btnPreviewAnimBack.UseVisualStyleBackColor = true;
//
// SpriteEntryForm
//
@ -465,6 +489,8 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(614, 347);
this.Controls.Add(this.btnPreviewAnimBack);
this.Controls.Add(this.btnPreviewAnimFwd);
this.Controls.Add(this.btnReset);
this.Controls.Add(this.btnPreview);
this.Controls.Add(this.pbPreview);
@ -546,5 +572,7 @@
private System.Windows.Forms.Button btnAnimBack;
private System.Windows.Forms.Button btnAnimFwd;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Button btnPreviewAnimFwd;
private System.Windows.Forms.Button btnPreviewAnimBack;
}
}

View File

@ -20,6 +20,8 @@ namespace SpriteLibrary
internal partial class SpriteEntryForm : Form
{
SpriteController MyController;
SpriteController PreviewController;
ResourceManager myResources = null;
List<SpriteInfo> SpriteInformation = new List<SpriteInfo>();
SpriteInfo TempInformation = null;
@ -34,6 +36,8 @@ namespace SpriteLibrary
ToolTip myToolTip = new ToolTip();
Sprite PreviewSprite = null;
internal SpriteEntryForm(SpriteDatabase theDatabase, List<SpriteInfo> ListToWorkOn, Size GridSize)
{
InitializeComponent();
@ -50,10 +54,17 @@ namespace SpriteLibrary
private void LocalSetup()
{
//set up the controller for the image-choice window
pbImageField.BackgroundImageLayout = ImageLayout.Stretch;
pbImageField.BackgroundImage = new Bitmap(600, 800);
MyController = new SpriteController(pbImageField);
//set up the sprite controller for the preview window
pbPreview.BackgroundImage = new Bitmap(400, 400);
Graphics.FromImage(pbPreview.BackgroundImage).Clear(Color.Gray);
pbPreview.BackgroundImageLayout = ImageLayout.Stretch;
PreviewController = new SpriteController(pbPreview);
myToolTip.AutoPopDelay = 5000;
myToolTip.AutomaticDelay = 500;
@ -431,5 +442,15 @@ namespace SpriteLibrary
UpdateMenu();
}
private void btnPreview_Click(object sender, EventArgs e)
{
//remove the old one
if (PreviewSprite != null) PreviewSprite.Destroy();
//Create a new one
PreviewSprite = TempInformation.CreateSprite(PreviewController, myDatabase);
PreviewSprite.PutBaseImageLocation(new Point(1, 1));
//PreviewSprite.SetSize(new Size(50, 50));
}
}
}