Nes Nametable viewer - context menu with screenshot & refresh menu items

This commit is contained in:
andres.delikat 2011-09-15 00:29:26 +00:00
parent 36055f2644
commit 62a2b7fad3
3 changed files with 52 additions and 1 deletions

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -62,6 +63,9 @@
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.NameTableView = new BizHawk.MultiClient.NameTableViewer();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.screenshotAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.refreshImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
@ -69,6 +73,7 @@
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
@ -391,6 +396,7 @@
// NameTableView
//
this.NameTableView.BackColor = System.Drawing.Color.Transparent;
this.NameTableView.ContextMenuStrip = this.contextMenuStrip1;
this.NameTableView.Location = new System.Drawing.Point(17, 19);
this.NameTableView.Name = "NameTableView";
this.NameTableView.Size = new System.Drawing.Size(512, 480);
@ -398,6 +404,28 @@
this.NameTableView.MouseLeave += new System.EventHandler(this.NameTableView_MouseLeave);
this.NameTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.NameTableView_MouseMove);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.screenshotAsToolStripMenuItem,
this.refreshImageToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(167, 70);
//
// screenshotAsToolStripMenuItem
//
this.screenshotAsToolStripMenuItem.Name = "screenshotAsToolStripMenuItem";
this.screenshotAsToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
this.screenshotAsToolStripMenuItem.Text = "Screenshot As...";
this.screenshotAsToolStripMenuItem.Click += new System.EventHandler(this.screenshotAsToolStripMenuItem_Click);
//
// refreshImageToolStripMenuItem
//
this.refreshImageToolStripMenuItem.Name = "refreshImageToolStripMenuItem";
this.refreshImageToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
this.refreshImageToolStripMenuItem.Text = "Refresh Image";
this.refreshImageToolStripMenuItem.Click += new System.EventHandler(this.refreshImageToolStripMenuItem_Click);
//
// NESNameTableViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -428,6 +456,7 @@
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).EndInit();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -469,5 +498,8 @@
private System.Windows.Forms.ToolStripMenuItem screenshotToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem screenshotAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem refreshImageToolStripMenuItem;
}
}

View File

@ -255,6 +255,11 @@ namespace BizHawk.MultiClient
}
private void screenshotToolStripMenuItem_Click(object sender, EventArgs e)
{
ScreenshotAs();
}
private void ScreenshotAs()
{
var sfd = new SaveFileDialog();
sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + "-nametable";
@ -267,7 +272,7 @@ namespace BizHawk.MultiClient
Global.Sound.StartSound();
if (result != DialogResult.OK)
return;
var file = new FileInfo(sfd.FileName);
Bitmap b = new Bitmap(NameTableView.Width, NameTableView.Height);
Rectangle rect = new Rectangle(new Point(0, 0), NameTableView.Size);
@ -288,5 +293,16 @@ namespace BizHawk.MultiClient
b.Save(file.FullName, i);
}
private void screenshotAsToolStripMenuItem_Click(object sender, EventArgs e)
{
ScreenshotAs();
}
private void refreshImageToolStripMenuItem_Click(object sender, EventArgs e)
{
UpdateValues();
NameTableView.Refresh();
}
}
}

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>