Skip to content

Commit

Permalink
Add save option to image popup, some naming cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tfarley committed Jan 29, 2017
1 parent f2e94bd commit f735b86
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 27 deletions.
46 changes: 23 additions & 23 deletions aclogview/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions aclogview/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ private void checkBox_useHighlighting_CheckedChanged(object sender, EventArgs e)
updateText();
}

private void menuItem2_Click(object sender, EventArgs e) {
private void menuItem_ToolCount_Click(object sender, EventArgs e) {
FolderBrowserDialog openFolder = new FolderBrowserDialog();

if (openFolder.ShowDialog() != DialogResult.OK) {
Expand Down Expand Up @@ -699,7 +699,7 @@ private void menuItem2_Click(object sender, EventArgs e) {
popup.ShowDialog();
}

private void menuItem3_Click(object sender, EventArgs e) {
private void menuItem_ToolBad_Click(object sender, EventArgs e) {
FolderBrowserDialog openFolder = new FolderBrowserDialog();

if (openFolder.ShowDialog() != DialogResult.OK) {
Expand Down Expand Up @@ -761,7 +761,7 @@ private void menuItem3_Click(object sender, EventArgs e) {
}
}

private void menuItem4_Click(object sender, EventArgs e) {
private void menuItem_ToolHeatmap_Click(object sender, EventArgs e) {
FolderBrowserDialog openFolder = new FolderBrowserDialog();

if (openFolder.ShowDialog() != DialogResult.OK) {
Expand Down Expand Up @@ -804,7 +804,7 @@ private void menuItem4_Click(object sender, EventArgs e) {
}

ImagePopup popup = new ImagePopup();
popup.ClientSize = new Size(600, 600);
popup.ClientSize = new Size(512, 512);
popup.setImage(heatmapImg);
popup.ShowDialog();
}
Expand Down
26 changes: 26 additions & 0 deletions aclogview/ImagePopup.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions aclogview/ImagePopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -17,5 +18,25 @@ public ImagePopup() {
public void setImage(Bitmap image) {
pictureBox1.Image = image;
}

private void menuItem_Save_Click(object sender, EventArgs e) {
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Filter = "Images|*.png;*.bmp;*.jpg";
if (saveDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
System.Drawing.Imaging.ImageFormat imageFormat;
switch (Path.GetExtension(saveDialog.FileName)) {
case ".bmp":
imageFormat = System.Drawing.Imaging.ImageFormat.Bmp;
break;
case ".jpg":
imageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
break;
default:
imageFormat = System.Drawing.Imaging.ImageFormat.Png;
break;
}
pictureBox1.Image.Save(saveDialog.FileName, imageFormat);
}
}
}
}
3 changes: 3 additions & 0 deletions aclogview/ImagePopup.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

0 comments on commit f735b86

Please sign in to comment.