Skip to content

Commit 3ad57c8

Browse files
authored
v1.1.0
1 parent d5412bd commit 3ad57c8

27 files changed

+1015
-85
lines changed
12 KB
Binary file not shown.
0 Bytes
Binary file not shown.

QuickPictureViewer-Setup/QuickPictureViewer-Setup.vdproj

Lines changed: 655 additions & 13 deletions
Large diffs are not rendered by default.

quick-picture-viewer.sln

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29418.71
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "quick-picture-viewer", "quick-picture-viewer\quick-picture-viewer.csproj", "{53748C49-255E-424B-B789-5919CEFEF473}"
77
EndProject
8+
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "QuickPictureViewer-Setup", "QuickPictureViewer-Setup\QuickPictureViewer-Setup.vdproj", "{1A3EB8FC-3D7C-45B0-A41C-B9D6529A7804}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,8 @@ Global
1517
{53748C49-255E-424B-B789-5919CEFEF473}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{53748C49-255E-424B-B789-5919CEFEF473}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{53748C49-255E-424B-B789-5919CEFEF473}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{1A3EB8FC-3D7C-45B0-A41C-B9D6529A7804}.Debug|Any CPU.ActiveCfg = Debug
21+
{1A3EB8FC-3D7C-45B0-A41C-B9D6529A7804}.Release|Any CPU.ActiveCfg = Release
1822
EndGlobalSection
1923
GlobalSection(SolutionProperties) = preSolution
2024
HideSolutionNode = FALSE

quick-picture-viewer/MainForm.Designer.cs

Lines changed: 117 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quick-picture-viewer/MainForm.cs

Lines changed: 95 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,35 @@ private void openFile(string path)
4141
{
4242
try
4343
{
44-
originalImage = new Bitmap(path);
45-
pictureBox.Image = originalImage;
46-
47-
width = pictureBox.Image.Size.Width;
48-
height = pictureBox.Image.Size.Height;
49-
sizeLabel.Text = "Size: " + width.ToString() + " x " + height.ToString() + " px";
50-
pathLabel.Text = "File: " + path;
51-
52-
this.Text = Path.GetFileName(path) + " - Quick Picture Viewer";
53-
54-
zoomInButton.Enabled = true;
55-
zoomOutButton.Enabled = true;
44+
openImage(new Bitmap(path), path, Path.GetFileName(path));
5645
}
57-
catch (Exception)
46+
catch
5847
{
5948
MessageBox.Show("Unable to open this file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
6049
}
6150
}
6251

52+
private void openImage(Bitmap bitmap, string filePath, string fileName)
53+
{
54+
originalImage = bitmap;
55+
pictureBox.Image = originalImage;
56+
57+
width = pictureBox.Image.Size.Width;
58+
height = pictureBox.Image.Size.Height;
59+
sizeLabel.Text = "Size: " + width.ToString() + " x " + height.ToString() + " px";
60+
pathLabel.Text = "File: " + filePath;
61+
62+
this.Text = fileName + " - Quick Picture Viewer";
63+
64+
zoomInButton.Enabled = true;
65+
zoomOutButton.Enabled = true;
66+
flipVerticalButton.Enabled = true;
67+
flipHorizontalButton.Enabled = true;
68+
rotateLeftButton.Enabled = true;
69+
rotateRightButton.Enabled = true;
70+
saveAsButton.Enabled = true;
71+
}
72+
6373
private void zoomInButton_Click(object sender, EventArgs e)
6474
{
6575
zoomIn();
@@ -129,14 +139,84 @@ private void autoZoomButton_Click(object sender, EventArgs e)
129139
private void aboutButton_Click(object sender, EventArgs e)
130140
{
131141
if(MessageBox.Show(
132-
"Quick Picture Viewer\nv" + ProductVersion + "\n\nby Module Art\nAuthor: Jake Volynko\n\nVisit project web page?\nhttps://moduleart.github.io/quick-picture-viewer/",
142+
"Quick Picture Viewer\nv" + ProductVersion + "\n\nby Module Art\nAuthor: Jake Volynko\n\nVisit project web page?\nhttps://github.com/ModuleArt/quick-picture-viewer/",
133143
"About",
134144
MessageBoxButtons.YesNo,
135145
MessageBoxIcon.Asterisk
136146
) == DialogResult.Yes)
137147
{
138-
System.Diagnostics.Process.Start("https://moduleart.github.io/quick-picture-viewer/");
148+
System.Diagnostics.Process.Start("https://github.com/ModuleArt/quick-picture-viewer/");
139149
}
140150
}
151+
152+
private void flipVerticalButton_Click(object sender, EventArgs e)
153+
{
154+
originalImage.RotateFlip(RotateFlipType.RotateNoneFlipX);
155+
pictureBox.Image = originalImage;
156+
setAutoZoom(true);
157+
}
158+
159+
private void flipHorizontalButton_Click(object sender, EventArgs e)
160+
{
161+
originalImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
162+
pictureBox.Image = originalImage;
163+
setAutoZoom(true);
164+
}
165+
166+
private void rotateLeftButton_Click(object sender, EventArgs e)
167+
{
168+
originalImage.RotateFlip(RotateFlipType.Rotate270FlipNone);
169+
pictureBox.Image = originalImage;
170+
setAutoZoom(true);
171+
}
172+
173+
private void rotateRightButton_Click(object sender, EventArgs e)
174+
{
175+
originalImage.RotateFlip(RotateFlipType.Rotate90FlipNone);
176+
pictureBox.Image = originalImage;
177+
setAutoZoom(true);
178+
}
179+
180+
private void saveAsButton_Click(object sender, EventArgs e)
181+
{
182+
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
183+
{
184+
System.IO.FileStream fs = (System.IO.FileStream)saveFileDialog1.OpenFile();
185+
switch (saveFileDialog1.FilterIndex)
186+
{
187+
case 1:
188+
originalImage.Save(fs, System.Drawing.Imaging.ImageFormat.Png);
189+
break;
190+
case 2:
191+
originalImage.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
192+
break;
193+
case 3:
194+
originalImage.Save(fs, System.Drawing.Imaging.ImageFormat.Gif);
195+
break;
196+
case 4:
197+
originalImage.Save(fs, System.Drawing.Imaging.ImageFormat.Bmp);
198+
break;
199+
}
200+
fs.Close();
201+
}
202+
}
203+
204+
private void copyButton_Click(object sender, EventArgs e)
205+
{
206+
Clipboard.SetImage(originalImage);
207+
}
208+
209+
private void pasteButton_Click(object sender, EventArgs e)
210+
{
211+
if (Clipboard.ContainsImage())
212+
{
213+
openImage(new Bitmap(Clipboard.GetImage()), "From clipboard", "From clipboard");
214+
}
215+
else if (Clipboard.ContainsData(DataFormats.FileDrop))
216+
{
217+
string path = ((string[]) Clipboard.GetData(DataFormats.FileDrop))[0];
218+
openFile(path);
219+
}
220+
}
141221
}
142222
}

0 commit comments

Comments
 (0)