initialise projects
This commit is contained in:
26
advancedpictureviewer/Form1.Designer.cs
generated
26
advancedpictureviewer/Form1.Designer.cs
generated
@@ -30,6 +30,7 @@
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
|
||||
this.fileSizeLabel = new System.Windows.Forms.Label();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -41,7 +42,8 @@
|
||||
this.toolButton_flipX = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolButton_flipY = new System.Windows.Forms.ToolStripButton();
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.fileSizeLabel = new System.Windows.Forms.Label();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
this.toolStripContainer1.ContentPanel.SuspendLayout();
|
||||
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer1.SuspendLayout();
|
||||
@@ -70,6 +72,14 @@
|
||||
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1);
|
||||
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1);
|
||||
//
|
||||
// fileSizeLabel
|
||||
//
|
||||
this.fileSizeLabel.AutoSize = true;
|
||||
this.fileSizeLabel.Location = new System.Drawing.Point(337, 290);
|
||||
this.fileSizeLabel.Name = "fileSizeLabel";
|
||||
this.fileSizeLabel.Size = new System.Drawing.Size(0, 13);
|
||||
this.fileSizeLabel.TabIndex = 1;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
@@ -95,6 +105,7 @@
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.openToolStripMenuItem,
|
||||
this.saveToolStripMenuItem,
|
||||
this.exitToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
@@ -167,13 +178,12 @@
|
||||
//
|
||||
this.openFileDialog1.FileName = "openFileDialog1";
|
||||
//
|
||||
// fileSizeLabel
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
this.fileSizeLabel.AutoSize = true;
|
||||
this.fileSizeLabel.Location = new System.Drawing.Point(337, 290);
|
||||
this.fileSizeLabel.Name = "fileSizeLabel";
|
||||
this.fileSizeLabel.Size = new System.Drawing.Size(0, 13);
|
||||
this.fileSizeLabel.TabIndex = 1;
|
||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.saveToolStripMenuItem.Text = "Save";
|
||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
@@ -214,6 +224,8 @@
|
||||
private System.Windows.Forms.ToolStripButton toolButton_flipY;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||
private System.Windows.Forms.Label fileSizeLabel;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,21 @@ namespace advancedpictureviewer
|
||||
pictureBox1.Image = bitmap1;
|
||||
fileSizeLabel.Text = openFileDialog1.FileName.Length.ToString();
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if ( saveFileDialog1.ShowDialog() == DialogResult.OK )
|
||||
{
|
||||
int width = Convert.ToInt32(pictureBox1.Image.Width);
|
||||
int height = Convert.ToInt32(pictureBox1.Image.Height);
|
||||
using (Bitmap bmp = new Bitmap(width, height))
|
||||
{
|
||||
pictureBox1.DrawToBitmap( bmp, new Rectangle( 0,0, width, height ) );
|
||||
bmp.Save( saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
@@ -45,13 +60,13 @@ namespace advancedpictureviewer
|
||||
|
||||
private void toolButton_RotY_Click(object sender, EventArgs e)
|
||||
{
|
||||
bitmap1.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
||||
bitmap1.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
pictureBox1.Image = bitmap1;
|
||||
}
|
||||
|
||||
private void toolButton_RotL_Click(object sender, EventArgs e)
|
||||
{
|
||||
bitmap1.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
bitmap1.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
||||
pictureBox1.Image = bitmap1;
|
||||
}
|
||||
}
|
||||
|
@@ -187,4 +187,7 @@
|
||||
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>237, 17</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>376, 17</value>
|
||||
</metadata>
|
||||
</root>
|
Reference in New Issue
Block a user