diff --git a/.vs/quick-picture-viewer/v16/.suo b/.vs/quick-picture-viewer/v16/.suo index c4dbfbf1..dd1ed646 100644 Binary files a/.vs/quick-picture-viewer/v16/.suo and b/.vs/quick-picture-viewer/v16/.suo differ diff --git a/.vs/quick-picture-viewer/v16/Server/sqlite3/storage.ide b/.vs/quick-picture-viewer/v16/Server/sqlite3/storage.ide index c159c843..7dfbe62b 100644 Binary files a/.vs/quick-picture-viewer/v16/Server/sqlite3/storage.ide and b/.vs/quick-picture-viewer/v16/Server/sqlite3/storage.ide differ diff --git a/QuickPictureViewer-Setup/QuickPictureViewer-Setup.vdproj b/QuickPictureViewer-Setup/QuickPictureViewer-Setup.vdproj index 16acf856..1c44fc75 100644 --- a/QuickPictureViewer-Setup/QuickPictureViewer-Setup.vdproj +++ b/QuickPictureViewer-Setup/QuickPictureViewer-Setup.vdproj @@ -64,7 +64,7 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_9E165066DD6307D67C7B835ACD3F2087" + "OwnerKey" = "8:_602081345A8B570EE42EFE35A1D60858" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -76,7 +76,7 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_602081345A8B570EE42EFE35A1D60858" + "OwnerKey" = "8:_9E165066DD6307D67C7B835ACD3F2087" "MsmSig" = "8:_UNDEFINED" } } @@ -373,15 +373,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Quick Picture Viewer" - "ProductCode" = "8:{B2FA8817-26BA-4186-8202-EBD9C5CDAA99}" - "PackageCode" = "8:{4BE7925D-0139-4943-8C39-4527037F1F29}" + "ProductCode" = "8:{19C61DD7-1087-4392-863E-FAD2AA7B6A13}" + "PackageCode" = "8:{959BC8F3-0719-4893-AA01-A29F1C3B2554}" "UpgradeCode" = "8:{D9871B4D-DF1B-418F-A7BF-D5F44A9FCFCE}" "AspNetVersion" = "8:2.0.50727.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.9.4" + "ProductVersion" = "8:1.9.5" "Manufacturer" = "8:Module Art" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" @@ -389,7 +389,7 @@ "Subject" = "8:" "ARPCONTACT" = "8:Module Art" "Keywords" = "8:" - "ARPCOMMENTS" = "8:Lightweight picture viewer for Windows" + "ARPCOMMENTS" = "8:Lightweight desktop photo viewer for Windows" "ARPURLINFOABOUT" = "8:https://moduleart.github.io" "ARPPRODUCTICON" = "8:_C3E94029681345CDB595943F27D860BD" "ARPIconIndex" = "3:0" @@ -1827,7 +1827,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_4B597F9189B6419DBE3695587B370B9E" { - "SourcePath" = "8:..\\quick-picture-viewer\\obj\\Debug\\quick-picture-viewer.exe" + "SourcePath" = "8:..\\quick-picture-viewer\\obj\\Release\\quick-picture-viewer.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_259C1F6F99A84F81BA44246337DEBF66" diff --git a/QuickPictureViewer-Setup/Release/QuickPictureViewer-Setup.msi b/QuickPictureViewer-Setup/Release/QuickPictureViewer-Setup.msi index c4abd977..9ad05ac6 100644 Binary files a/QuickPictureViewer-Setup/Release/QuickPictureViewer-Setup.msi and b/QuickPictureViewer-Setup/Release/QuickPictureViewer-Setup.msi differ diff --git a/README.md b/README.md index 1d06c194..daa1f457 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@

Install

- Windows 7, 8.1, 10 | Size: 1.1 MB | v1.9.4 | Download
+ Windows 7, 8.1, 10 | Size: 1.1 MB | v1.9.5 | Download
Uses .Net 4.7.2

diff --git a/quick-picture-viewer/AboutForm.Designer.cs b/quick-picture-viewer/AboutForm.Designer.cs index 018788e2..b2c94f5b 100644 --- a/quick-picture-viewer/AboutForm.Designer.cs +++ b/quick-picture-viewer/AboutForm.Designer.cs @@ -261,6 +261,7 @@ private void InitializeComponent() this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "About"; + this.Load += new System.EventHandler(this.AboutForm_Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.AboutForm_KeyDown); ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); this.infoGroup.ResumeLayout(false); diff --git a/quick-picture-viewer/AboutForm.cs b/quick-picture-viewer/AboutForm.cs index 6450fa7f..ef4be542 100644 --- a/quick-picture-viewer/AboutForm.cs +++ b/quick-picture-viewer/AboutForm.cs @@ -11,13 +11,14 @@ partial class AboutForm : Form public AboutForm() { InitializeComponent(); + } + private void AboutForm_Load(object sender, EventArgs e) + { versionLabel.Text = String.Format("Version: {0}", Assembly.GetExecutingAssembly().GetName().Version.ToString().Substring(0, 5)); if (ThemeManager.isDarkTheme()) { - ThemeManager.enableDarkTitlebar(this.Handle); - this.BackColor = ThemeManager.BackColorDark; this.ForeColor = Color.White; @@ -34,6 +35,8 @@ public AboutForm() licenseLink.LinkColor = linkColor; okButton.BackColor = ThemeManager.SecondColorDark; + + ThemeManager.enableDarkTitlebar(this.Handle, true); } } diff --git a/quick-picture-viewer/InfoForm.cs b/quick-picture-viewer/InfoForm.cs index 3166262a..f80ff267 100644 --- a/quick-picture-viewer/InfoForm.cs +++ b/quick-picture-viewer/InfoForm.cs @@ -15,8 +15,6 @@ public InfoForm(Bitmap bitmap, string directoryName, string fileName) if (ThemeManager.isDarkTheme()) { - ThemeManager.enableDarkTitlebar(this.Handle); - this.BackColor = ThemeManager.BackColorDark; this.ForeColor = Color.White; @@ -64,6 +62,8 @@ public InfoForm(Bitmap bitmap, string directoryName, string fileName) modifiedTextBox.BackColor = ThemeManager.SecondColorDark; modifiedTextBox.ForeColor = Color.White; + + ThemeManager.enableDarkTitlebar(this.Handle, true); } if (directoryName != null) diff --git a/quick-picture-viewer/MainForm.Designer.cs b/quick-picture-viewer/MainForm.Designer.cs index 517870ac..ef173d04 100644 --- a/quick-picture-viewer/MainForm.Designer.cs +++ b/quick-picture-viewer/MainForm.Designer.cs @@ -75,6 +75,7 @@ private void InitializeComponent() this.printDialog1 = new System.Windows.Forms.PrintDialog(); this.printDocument1 = new System.Drawing.Printing.PrintDocument(); this.picturePanel = new quick_picture_viewer.CustomPanel(); + this.suggestionLabel = new System.Windows.Forms.Label(); this.pictureBox = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher1)).BeginInit(); this.toolStrip1.SuspendLayout(); @@ -297,24 +298,34 @@ private void InitializeComponent() this.zoomComboBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.zoomComboBox.Items.AddRange(new object[] { "Auto", + "2%", + "3%", + "4%", "5%", + "6%", + "7%", + "8%", "10%", + "13%", + "17%", + "20%", "25%", + "33%", "50%", - "75%", + "67%", "100%", - "125%", "150%", - "175%", "200%", - "250%", "300%", "400%", - "500%"}); + "500%", + "600%", + "800%", + "1000%"}); this.zoomComboBox.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.zoomComboBox.Name = "zoomComboBox"; this.zoomComboBox.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never; - this.zoomComboBox.Size = new System.Drawing.Size(55, 23); + this.zoomComboBox.Size = new System.Drawing.Size(60, 23); this.zoomComboBox.ToolTipText = "Zoom"; this.zoomComboBox.TextChanged += new System.EventHandler(this.zoomComboBox_TextChanged); // @@ -638,6 +649,7 @@ private void InitializeComponent() this.picturePanel.AutoScroll = true; this.picturePanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.picturePanel.BackColor = System.Drawing.Color.Transparent; + this.picturePanel.Controls.Add(this.suggestionLabel); this.picturePanel.Controls.Add(this.pictureBox); this.picturePanel.Location = new System.Drawing.Point(0, 35); this.picturePanel.Margin = new System.Windows.Forms.Padding(0); @@ -648,7 +660,22 @@ private void InitializeComponent() this.picturePanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picturePanel_MouseDown); this.picturePanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picturePanel_MouseMove); this.picturePanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picturePanel_MouseUp); - this.picturePanel.Resize += new System.EventHandler(this.MainForm_SizeChanged); + // + // suggestionLabel + // + this.suggestionLabel.AutoSize = true; + this.suggestionLabel.BackColor = System.Drawing.Color.Black; + this.suggestionLabel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.suggestionLabel.ForeColor = System.Drawing.Color.White; + this.suggestionLabel.Location = new System.Drawing.Point(9, 9); + this.suggestionLabel.Margin = new System.Windows.Forms.Padding(9); + this.suggestionLabel.Name = "suggestionLabel"; + this.suggestionLabel.Padding = new System.Windows.Forms.Padding(3); + this.suggestionLabel.Size = new System.Drawing.Size(72, 21); + this.suggestionLabel.TabIndex = 1; + this.suggestionLabel.Text = "Suggestion"; + this.suggestionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.suggestionLabel.Visible = false; // // pictureBox // @@ -688,12 +715,14 @@ private void InitializeComponent() this.DragDrop += new System.Windows.Forms.DragEventHandler(this.MainForm_DragDrop); this.DragEnter += new System.Windows.Forms.DragEventHandler(this.MainForm_DragEnter); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyDown); + this.Resize += new System.EventHandler(this.MainForm_Resize); ((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher1)).EndInit(); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); this.picturePanel.ResumeLayout(false); + this.picturePanel.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -749,6 +778,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripButton showFileButton; private System.Windows.Forms.ToolStripButton checkboardButton; private System.Windows.Forms.ToolStripButton saveAsButton; + private System.Windows.Forms.Label suggestionLabel; } } diff --git a/quick-picture-viewer/MainForm.cs b/quick-picture-viewer/MainForm.cs index 4ede7174..23b179f9 100644 --- a/quick-picture-viewer/MainForm.cs +++ b/quick-picture-viewer/MainForm.cs @@ -5,6 +5,7 @@ using System.Drawing; using System.IO; using System.Linq; +using System.Threading.Tasks; using System.Timers; using System.Windows.Forms; @@ -27,8 +28,10 @@ public partial class MainForm : Form private bool darkMode = false; private bool checkboardBackground = false; - System.Timers.Timer zoomInTimer = new System.Timers.Timer(); - System.Timers.Timer zoomOutTimer = new System.Timers.Timer(); + private System.Timers.Timer zoomInTimer = new System.Timers.Timer(); + private System.Timers.Timer zoomOutTimer = new System.Timers.Timer(); + + private Task suggestionTask = null; public bool printCenterImage = true; @@ -38,10 +41,10 @@ public MainForm(string openPath) this.openPath = openPath; zoomInTimer.Elapsed += new ElapsedEventHandler(zoomInTimer_Event); - zoomInTimer.Interval = 50; + zoomInTimer.Interval = 100; zoomOutTimer.Elapsed += new ElapsedEventHandler(zoomOutTimer_Event); - zoomOutTimer.Interval = 50; + zoomOutTimer.Interval = 100; } private void zoomInTimer_Event(Object source, ElapsedEventArgs e) @@ -64,18 +67,25 @@ private void openButton_Click_1(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e) { - if(!string.IsNullOrEmpty(openPath)) + try { - if(File.GetAttributes(openPath).HasFlag(FileAttributes.Directory)) - { - currentFolder = openPath; - openFirstFileInFolder(); - } - else + if (!string.IsNullOrEmpty(openPath)) { - openFile(openPath); + if (File.GetAttributes(openPath).HasFlag(FileAttributes.Directory)) + { + currentFolder = openPath; + openFirstFileInFolder(); + } + else + { + openFile(openPath); + } } } + catch + { + MessageBox.Show("Unable to open this file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } toolStrip1.Renderer = new ToolStripOverride(); @@ -271,6 +281,21 @@ private void zoomOut() setZoomText((zoomFactor - 5).ToString() + "%"); } + private void zoomToFit() + { + double zoomFactorX = picturePanel.Width / (double) originalImage.Width; + double zoomFactorY = picturePanel.Height / (double)originalImage.Height; + + if (zoomFactorX > zoomFactorY) + { + zoomFactor = Convert.ToInt32(zoomFactorY * 100); + } + else + { + zoomFactor = Convert.ToInt32(zoomFactorX * 100); + } + } + private void setZoomFactor(int newZoomFactor) { zoomFactor = newZoomFactor; @@ -340,7 +365,8 @@ private void autoZoomButton_Click(object sender, EventArgs e) { if (zoomComboBox.Text == "Auto") { - setZoomText("100%"); + zoomToFit(); + setZoomText(zoomFactor + "%"); } else { @@ -386,16 +412,16 @@ private void setCheckboardBackground(bool b, bool saveToDisk) { if (darkMode) { - pictureBox.BackgroundImage = Properties.Resources.checkboard_dark; + picturePanel.BackgroundImage = Properties.Resources.checkboard_dark; } else { - pictureBox.BackgroundImage = Properties.Resources.checkboard_light; + picturePanel.BackgroundImage = Properties.Resources.checkboard_light; } } else { - pictureBox.BackgroundImage = null; + picturePanel.BackgroundImage = null; } if (saveToDisk) @@ -471,6 +497,7 @@ private void saveAsButton_Click(object sender, EventArgs e) private void copyButton_Click(object sender, EventArgs e) { Clipboard.SetImage(originalImage); + showSuggestion("Image is copied to clipboard"); } private void pasteButton_Click(object sender, EventArgs e) @@ -590,6 +617,8 @@ private void setFullscreen(bool b) picturePanel.BackColor = Color.Black; setAlwaysOnTop(false, true); + + showSuggestion("Press Esc / F / Alt + Enter / F11 to exit fullscreen mode"); } else { @@ -607,7 +636,7 @@ private void zoomComboBox_TextChanged(object sender, EventArgs e) { if (zoomComboBox.Text == "Auto") { - setZoomFactor(100); + zoomToFit(); setAutoZoom(true); } else @@ -615,16 +644,16 @@ private void zoomComboBox_TextChanged(object sender, EventArgs e) string substr = zoomComboBox.Text.Replace("%", ""); int zoom = int.Parse(substr); - if (zoom < 5) + if (zoom < 2) { - zoom = 5; + zoom = 2; setZoomText(zoom.ToString() + "%"); } else { - if (zoom > 500) + if (zoom > 1000) { - zoom = 500; + zoom = 1000; setZoomText(zoom.ToString() + "%"); } else @@ -1035,8 +1064,6 @@ private void externalButton_Click(object sender, EventArgs e) private void applyDarkTheme() { - ThemeManager.enableDarkTitlebar(this.Handle); - ThemeManager.setDarkModeToControl(picturePanel.Handle); this.ForeColor = Color.White; @@ -1083,14 +1110,8 @@ private void applyDarkTheme() dateCreatedLabel.Image = Properties.Resources.white_clock; dateModifiedLabel.Image = Properties.Resources.white_history; hasChangesLabel.Image = Properties.Resources.white_erase; - } - private void MainForm_SizeChanged(object sender, EventArgs e) - { - if(!autoZoom) - { - updatePictureBoxLocation(); - } + ThemeManager.enableDarkTitlebar(this.Handle, true); } private void printButton_Click(object sender, EventArgs e) @@ -1213,5 +1234,36 @@ private void zoomInButton_MouseUp(object sender, EventArgs e) { zoomInTimer.Stop(); } + + private void MainForm_Resize(object sender, EventArgs e) + { + if (!autoZoom) + { + updatePictureBoxLocation(); + } + } + + private void showSuggestion(string text) + { + if (suggestionTask == null) + { + suggestionLabel.Text = text; + suggestionLabel.Visible = true; + suggestionTask = hideSuggestion(); + } + else + { + suggestionLabel.Text = text; + suggestionTask = hideSuggestion(); + } + } + + private async Task hideSuggestion() + { + await Task.Delay(3000); + suggestionLabel.Text = ""; + suggestionLabel.Visible = false; + suggestionTask = null; + } } } diff --git a/quick-picture-viewer/MainForm.resx b/quick-picture-viewer/MainForm.resx index d0ebc074..fbedcc7e 100644 --- a/quick-picture-viewer/MainForm.resx +++ b/quick-picture-viewer/MainForm.resx @@ -338,6 +338,71 @@ 477, 17 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAALJJREFUOE/Nks0JAjEQRnPwLihahgpeRQ/amj9YhAcbsABr0DbUClxR0PftBDES + ltmTPnhkZtl8E0jC37DGKz7xgXtsopsbdqwMDdzivOycaHIdddolvtHHOnSxsNLwBuziKpI9n00PD3Gt + IhswwjOu8IRjFEM8Yr/sjGzABqdWhgkqTLdxwUXsNURkA74ZoCbrBGKGGiJcAVUke/SQWla6aGNyjXrK + d1SqR/2bPKRfEcILB30+ElJnYjsAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAKVJREFUOE/Nkj0KAjEUBl9rqwiCl7ATxNJLeAqPIXgZrbyLXkAsxUJFUOfbRFhD + 8mK5A0N+md0i1jk2eMN34gVnWOWBwzD9QZETzpuVgy7m0L7+4IwLbZTwAl+v2ihRCrRx73iH2zj+FRjj + Po4p1cAID7jDI06xHasGerhsVmYrfKFiiipeDaRM4qio4m5AD6kfplkGeA/TPHrKT9RXcupsjZ3B7AP8 + ljJY5GqjGgAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAGZJREFUOE/VjzEKgDAQBO9bKtio//+FmvgI3REECRa5KwIOTJFiJ5y14vwwRC9X + GQpMcpOddAcY75IxuALlGKoDs2TM7W7ajt83jTJLbq/mCfBzksP9ckBgkaExEDgkkRAESn+B2QXamyDY + CyfAWwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAALVJREFUOE/V0r8OwVAUgPE7+rt6EBGC6ILRw5hsJJ7EK5DgEcTWxCLETAxWEgPf + 6bGd9LaVGHzJLz0d2t721v26AiY44oYDxsgjsSK2WKGNyue4xgZyc29TzHU0LSAr8XZCVUdTDfJa3u4o + 6Wgq46FjfDvUdTQ1sNcxvhGWOprkQyZ+gz5ekF2QleQgT061Cx1cMcAQIZ5I9R/0cIHseea6kItb0VnG + 5OIzmtHZF80Q6Pg/OfcGzhogaYnUQccAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAO5JREFUOE/N0j1qAlEYheEPiYJgq5B0UQT3YKULsNQuixAxVUSxdAsWNoFoYmGb + 1h3YmFjZBxHSpUre84k4OOOgjeTAA3MuzJ25P3aNPGKDKdIauCQdfKCEF7zj7EkGWCDrzSyBEebIaCAu + +vISt94OucEYr95ORC//ou4tnCK2u8dwnrDCA75QQTB3+ETL21H2a855MytDk9S8md1jjaa3o7Sh3dYX + gqlCk+iP9GddROYbhd1jKA1oT06+rLxhCB1VMDoFnUbPW0xSmGGCpAbIfs2RGxYV3TDdtGfkoT3p46Jo + Et35H2jdcf5FzP4AA64vkKyV2q0AAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAANpJREFUOE/F08EKAUEAh/E9kAPClfIeijwN8TZKilxR4gWEB6EIyUU5cxDff3a3 + 1TQ4yVe/ZqY0zc4u7xdVMcUZl2CcoIKPxdHDCjUUkAvGOtboIAZnfcyQNCu/RzCqFBbompWVjr1F2qyi + XjdQGexRNquXxtAx7ewNVBMjfxp1gp7VzrVBEUd/GnWDLtFOG4TCErj606h3J3DlPMG7O3DlvAPd6gb2 + W7DTW9ihZFZWbcyhH7nKYomWWTkKv0S9Zz1OHkpjAwd8/BLD9FENoaPeg3GAr/+Ff+R5T5lgLGc/X8aO + AAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAOZJREFUOE/F08+qAVEAx/EpVzaEnai7sOAZ1I2nId5GKbFHySOg+x63bv6EjbK2 + IL6/Y6ZmxplrFup+69PMGdNp5pzhvKuqe1QNjLHCCUfMUEdke1TQxxZNFJBHCS38QL9/4KkbzvhGRhfc + dN0rjQUGZhRKN8oOZV1w80+gstjgy4xiFJ5AdTB5nL7ONsEn9KSBLkg8TgN5r+afKAWtV6ADtNpxsj7B + FNqqOFnXQKv6C/8W2tIurFEzo1A9zKGbbOWwRNeMLCUxhPZZr1OE0rENfaGRX6I/77+gR726xxH+/C/8 + V45zBz6DLrd6wgPCAAAAAElFTkSuQmCC + + AAABAAUAYGAAAAEAIAColAAAVgAAAEBAAAABACAAKEIAAP6UAAAwMAAAAQAgAKglAAAm1wAAICAAAAEA @@ -1514,71 +1579,6 @@ 698, 17 - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAALJJREFUOE/Nks0JAjEQRnPwLihahgpeRQ/amj9YhAcbsABr0DbUClxR0PftBDES - ltmTPnhkZtl8E0jC37DGKz7xgXtsopsbdqwMDdzivOycaHIdddolvtHHOnSxsNLwBuziKpI9n00PD3Gt - IhswwjOu8IRjFEM8Yr/sjGzABqdWhgkqTLdxwUXsNURkA74ZoCbrBGKGGiJcAVUke/SQWla6aGNyjXrK - d1SqR/2bPKRfEcILB30+ElJnYjsAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAKVJREFUOE/Nkj0KAjEUBl9rqwiCl7ATxNJLeAqPIXgZrbyLXkAsxUJFUOfbRFhD - 8mK5A0N+md0i1jk2eMN34gVnWOWBwzD9QZETzpuVgy7m0L7+4IwLbZTwAl+v2ihRCrRx73iH2zj+FRjj - Po4p1cAID7jDI06xHasGerhsVmYrfKFiiipeDaRM4qio4m5AD6kfplkGeA/TPHrKT9RXcupsjZ3B7AP8 - ljJY5GqjGgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAGZJREFUOE/VjzEKgDAQBO9bKtio//+FmvgI3REECRa5KwIOTJFiJ5y14vwwRC9X - GQpMcpOddAcY75IxuALlGKoDs2TM7W7ajt83jTJLbq/mCfBzksP9ckBgkaExEDgkkRAESn+B2QXamyDY - CyfAWwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAALVJREFUOE/V0r8OwVAUgPE7+rt6EBGC6ILRw5hsJJ7EK5DgEcTWxCLETAxWEgPf - 6bGd9LaVGHzJLz0d2t721v26AiY44oYDxsgjsSK2WKGNyue4xgZyc29TzHU0LSAr8XZCVUdTDfJa3u4o - 6Wgq46FjfDvUdTQ1sNcxvhGWOprkQyZ+gz5ekF2QleQgT061Cx1cMcAQIZ5I9R/0cIHseea6kItb0VnG - 5OIzmtHZF80Q6Pg/OfcGzhogaYnUQccAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAO5JREFUOE/N0j1qAlEYheEPiYJgq5B0UQT3YKULsNQuixAxVUSxdAsWNoFoYmGb - 1h3YmFjZBxHSpUre84k4OOOgjeTAA3MuzJ25P3aNPGKDKdIauCQdfKCEF7zj7EkGWCDrzSyBEebIaCAu - +vISt94OucEYr95ORC//ou4tnCK2u8dwnrDCA75QQTB3+ETL21H2a855MytDk9S8md1jjaa3o7Sh3dYX - gqlCk+iP9GddROYbhd1jKA1oT06+rLxhCB1VMDoFnUbPW0xSmGGCpAbIfs2RGxYV3TDdtGfkoT3p46Jo - Et35H2jdcf5FzP4AA64vkKyV2q0AAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAANpJREFUOE/F08EKAUEAh/E9kAPClfIeijwN8TZKilxR4gWEB6EIyUU5cxDff3a3 - 1TQ4yVe/ZqY0zc4u7xdVMcUZl2CcoIKPxdHDCjUUkAvGOtboIAZnfcyQNCu/RzCqFBbompWVjr1F2qyi - XjdQGexRNquXxtAx7ewNVBMjfxp1gp7VzrVBEUd/GnWDLtFOG4TCErj606h3J3DlPMG7O3DlvAPd6gb2 - W7DTW9ihZFZWbcyhH7nKYomWWTkKv0S9Zz1OHkpjAwd8/BLD9FENoaPeg3GAr/+Ff+R5T5lgLGc/X8aO - AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAOZJREFUOE/F08+qAVEAx/EpVzaEnai7sOAZ1I2nId5GKbFHySOg+x63bv6EjbK2 - IL6/Y6ZmxplrFup+69PMGdNp5pzhvKuqe1QNjLHCCUfMUEdke1TQxxZNFJBHCS38QL9/4KkbzvhGRhfc - dN0rjQUGZhRKN8oOZV1w80+gstjgy4xiFJ5AdTB5nL7ONsEn9KSBLkg8TgN5r+afKAWtV6ADtNpxsj7B - FNqqOFnXQKv6C/8W2tIurFEzo1A9zKGbbOWwRNeMLCUxhPZZr1OE0rENfaGRX6I/77+gR726xxH+/C/8 - V45zBz6DLrd6wgPCAAAAAElFTkSuQmCC - - 834, 17 diff --git a/quick-picture-viewer/PrintForm.cs b/quick-picture-viewer/PrintForm.cs index 71aad69f..6796c136 100644 --- a/quick-picture-viewer/PrintForm.cs +++ b/quick-picture-viewer/PrintForm.cs @@ -11,10 +11,15 @@ public PrintForm(PrintDocument pd) { InitializeComponent(); + leftMarginTextBox.Text = pd.DefaultPageSettings.Margins.Left.ToString(); + topMarginTextBox.Text = pd.DefaultPageSettings.Margins.Top.ToString(); + rightMarginTextBox.Text = pd.DefaultPageSettings.Margins.Right.ToString(); + bottomMarginTextBox.Text = pd.DefaultPageSettings.Margins.Bottom.ToString(); + + printPreviewControl1.Document = pd; + if (ThemeManager.isDarkTheme()) { - ThemeManager.enableDarkTitlebar(this.Handle); - ThemeManager.setDarkModeToControl(printPreviewControl1.Handle); this.BackColor = ThemeManager.BackColorDark; @@ -43,14 +48,9 @@ public PrintForm(PrintDocument pd) okButton.BackColor = ThemeManager.SecondColorDark; okButton.Image = Properties.Resources.white_print; - } - - leftMarginTextBox.Text = pd.DefaultPageSettings.Margins.Left.ToString(); - topMarginTextBox.Text = pd.DefaultPageSettings.Margins.Top.ToString(); - rightMarginTextBox.Text = pd.DefaultPageSettings.Margins.Right.ToString(); - bottomMarginTextBox.Text = pd.DefaultPageSettings.Margins.Bottom.ToString(); - printPreviewControl1.Document = pd; + ThemeManager.enableDarkTitlebar(this.Handle, true); + } } private void marginsCheckBox_CheckedChanged(object sender, EventArgs e) diff --git a/quick-picture-viewer/Program.cs b/quick-picture-viewer/Program.cs index a56f42cb..11878df9 100644 --- a/quick-picture-viewer/Program.cs +++ b/quick-picture-viewer/Program.cs @@ -13,17 +13,21 @@ static void Main(string[] args) SetProcessDPIAware(); } + ThemeManager.allowDarkModeForApp(true); + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + string param; if(args.Length > 0) { - Application.Run(new MainForm(args[0])); + param = args[0]; } else { - Application.Run(new MainForm(string.Empty)); + param = string.Empty; } + Application.Run(new MainForm(param)); } [System.Runtime.InteropServices.DllImport("user32.dll")] diff --git a/quick-picture-viewer/Properties/AssemblyInfo.cs b/quick-picture-viewer/Properties/AssemblyInfo.cs index a8b724f5..26d4823a 100644 --- a/quick-picture-viewer/Properties/AssemblyInfo.cs +++ b/quick-picture-viewer/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Quick Picture Viewer")] -[assembly: AssemblyDescription("Lightweight picture viewer for Windows")] +[assembly: AssemblyDescription("Lightweight desktop photo viewer for Windows")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Module Art")] [assembly: AssemblyProduct("Quick Picture Viewer")] @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.9.4")] -[assembly: AssemblyFileVersion("1.9.4")] +[assembly: AssemblyVersion("1.9.5")] +[assembly: AssemblyFileVersion("1.9.5")] [assembly: NeutralResourcesLanguage("en")] diff --git a/quick-picture-viewer/ThemeManager.cs b/quick-picture-viewer/ThemeManager.cs index f9bfb6a1..b2336a54 100644 --- a/quick-picture-viewer/ThemeManager.cs +++ b/quick-picture-viewer/ThemeManager.cs @@ -61,13 +61,18 @@ private struct WindowCompositionAttribData private static extern bool AllowDarkModeForApp(bool allow); [DllImport("user32.dll")] - private static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttribData data); + private static extern bool SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttribData data); - public static void enableDarkTitlebar(IntPtr handle) - { - bool dark = true; + [DllImport("user32.dll")] + private static extern bool UpdateWindow(IntPtr hWnd); + public static void allowDarkModeForApp(bool dark) + { AllowDarkModeForApp(dark); + } + + public static void enableDarkTitlebar(IntPtr handle, bool dark) + { AllowDarkModeForWindow(handle, dark); var sizeOfData = Marshal.SizeOf(dark); @@ -78,9 +83,10 @@ public static void enableDarkTitlebar(IntPtr handle) Attribute = WindowCompositionAttribute.WCA_USEDARKMODECOLORS, Data = dataPtr, SizeOfData = sizeOfData - }; SetWindowCompositionAttribute(handle, ref data); + + UpdateWindow(handle); } public static void setDarkModeToControl(IntPtr handle) @@ -128,7 +134,8 @@ public static Color getAccentColor() if (isWindows10()) { string root = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\DWM"; - string colorcode = Registry.GetValue(root, "AccentColor", null).ToString(); + string colorcode = Convert.ToString(Registry.GetValue(root, "AccentColor", null)); + Console.WriteLine(colorcode); int colorInt = Math.Abs(Convert.ToInt32(colorcode)); return Color.FromArgb(colorInt); } diff --git a/quick-picture-viewer/UpdateForm.cs b/quick-picture-viewer/UpdateForm.cs index 6cbc405c..b6615831 100644 --- a/quick-picture-viewer/UpdateForm.cs +++ b/quick-picture-viewer/UpdateForm.cs @@ -23,8 +23,6 @@ public UpdateForm(UpdateChecker checker, string appName) if (ThemeManager.isDarkTheme()) { - ThemeManager.enableDarkTitlebar(this.Handle); - this.BackColor = ThemeManager.BackColorDark; this.ForeColor = Color.White; @@ -32,6 +30,8 @@ public UpdateForm(UpdateChecker checker, string appName) buttonNo.BackColor = ThemeManager.SecondColorDark; boxReleaseNotes.BackColor = ThemeManager.SecondColorDark; } + + ThemeManager.enableDarkTitlebar(this.Handle, true); } async void boxReleaseNotes_CheckedChanged(object sender, EventArgs e) diff --git a/quick-picture-viewer/WallpaperForm.cs b/quick-picture-viewer/WallpaperForm.cs index a564c1eb..2d263758 100644 --- a/quick-picture-viewer/WallpaperForm.cs +++ b/quick-picture-viewer/WallpaperForm.cs @@ -15,8 +15,6 @@ public WallpaperForm(Bitmap bmp) if (ThemeManager.isDarkTheme()) { - ThemeManager.enableDarkTitlebar(this.Handle); - this.BackColor = ThemeManager.BackColorDark; this.ForeColor = Color.White; @@ -25,6 +23,8 @@ public WallpaperForm(Bitmap bmp) okButton.BackColor = ThemeManager.SecondColorDark; okButton.Image = Properties.Resources.white_desktop; } + + ThemeManager.enableDarkTitlebar(this.Handle, true); } private void okButton_Click(object sender, EventArgs e) diff --git a/quick-picture-viewer/bin/Debug/quick-picture-viewer.exe b/quick-picture-viewer/bin/Debug/quick-picture-viewer.exe index c3f56c68..2fb661ae 100644 Binary files a/quick-picture-viewer/bin/Debug/quick-picture-viewer.exe and b/quick-picture-viewer/bin/Debug/quick-picture-viewer.exe differ diff --git a/quick-picture-viewer/bin/Debug/quick-picture-viewer.pdb b/quick-picture-viewer/bin/Debug/quick-picture-viewer.pdb index 8290e47a..91c3bede 100644 Binary files a/quick-picture-viewer/bin/Debug/quick-picture-viewer.pdb and b/quick-picture-viewer/bin/Debug/quick-picture-viewer.pdb differ diff --git a/quick-picture-viewer/bin/Release/quick-picture-viewer.exe b/quick-picture-viewer/bin/Release/quick-picture-viewer.exe index 87c56f97..6416d990 100644 Binary files a/quick-picture-viewer/bin/Release/quick-picture-viewer.exe and b/quick-picture-viewer/bin/Release/quick-picture-viewer.exe differ diff --git a/quick-picture-viewer/bin/Release/quick-picture-viewer.pdb b/quick-picture-viewer/bin/Release/quick-picture-viewer.pdb index a6630464..eeb5465c 100644 Binary files a/quick-picture-viewer/bin/Release/quick-picture-viewer.pdb and b/quick-picture-viewer/bin/Release/quick-picture-viewer.pdb differ diff --git a/quick-picture-viewer/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/quick-picture-viewer/obj/Debug/DesignTimeResolveAssemblyReferences.cache index f0bf0533..0387ec5d 100644 Binary files a/quick-picture-viewer/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/quick-picture-viewer/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/quick-picture-viewer/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll b/quick-picture-viewer/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll index 9735e981..636a78a9 100644 Binary files a/quick-picture-viewer/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll and b/quick-picture-viewer/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/quick-picture-viewer/obj/Debug/quick-picture-viewer.csproj.GenerateResource.cache b/quick-picture-viewer/obj/Debug/quick-picture-viewer.csproj.GenerateResource.cache index c8a3fadf..f2fbbf3a 100644 Binary files a/quick-picture-viewer/obj/Debug/quick-picture-viewer.csproj.GenerateResource.cache and b/quick-picture-viewer/obj/Debug/quick-picture-viewer.csproj.GenerateResource.cache differ diff --git a/quick-picture-viewer/obj/Debug/quick-picture-viewer.csprojAssemblyReference.cache b/quick-picture-viewer/obj/Debug/quick-picture-viewer.csprojAssemblyReference.cache index f0892106..3e5f9ac4 100644 Binary files a/quick-picture-viewer/obj/Debug/quick-picture-viewer.csprojAssemblyReference.cache and b/quick-picture-viewer/obj/Debug/quick-picture-viewer.csprojAssemblyReference.cache differ diff --git a/quick-picture-viewer/obj/Debug/quick-picture-viewer.exe b/quick-picture-viewer/obj/Debug/quick-picture-viewer.exe index c3f56c68..2fb661ae 100644 Binary files a/quick-picture-viewer/obj/Debug/quick-picture-viewer.exe and b/quick-picture-viewer/obj/Debug/quick-picture-viewer.exe differ diff --git a/quick-picture-viewer/obj/Debug/quick-picture-viewer.pdb b/quick-picture-viewer/obj/Debug/quick-picture-viewer.pdb index 8290e47a..91c3bede 100644 Binary files a/quick-picture-viewer/obj/Debug/quick-picture-viewer.pdb and b/quick-picture-viewer/obj/Debug/quick-picture-viewer.pdb differ diff --git a/quick-picture-viewer/obj/Debug/quick_picture_viewer.MainForm.resources b/quick-picture-viewer/obj/Debug/quick_picture_viewer.MainForm.resources index 1ff13550..aa72f450 100644 Binary files a/quick-picture-viewer/obj/Debug/quick_picture_viewer.MainForm.resources and b/quick-picture-viewer/obj/Debug/quick_picture_viewer.MainForm.resources differ diff --git a/quick-picture-viewer/obj/Debug/quick_picture_viewer.Properties.Resources.resources b/quick-picture-viewer/obj/Debug/quick_picture_viewer.Properties.Resources.resources index 008c90a2..5db13684 100644 Binary files a/quick-picture-viewer/obj/Debug/quick_picture_viewer.Properties.Resources.resources and b/quick-picture-viewer/obj/Debug/quick_picture_viewer.Properties.Resources.resources differ diff --git a/quick-picture-viewer/obj/Release/DesignTimeResolveAssemblyReferences.cache b/quick-picture-viewer/obj/Release/DesignTimeResolveAssemblyReferences.cache index d26ed106..4247d863 100644 Binary files a/quick-picture-viewer/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/quick-picture-viewer/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/quick-picture-viewer/obj/Release/TempPE/Properties.Resources.Designer.cs.dll b/quick-picture-viewer/obj/Release/TempPE/Properties.Resources.Designer.cs.dll index 42584914..fbdb4328 100644 Binary files a/quick-picture-viewer/obj/Release/TempPE/Properties.Resources.Designer.cs.dll and b/quick-picture-viewer/obj/Release/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/quick-picture-viewer/obj/Release/quick-picture-viewer.csproj.GenerateResource.cache b/quick-picture-viewer/obj/Release/quick-picture-viewer.csproj.GenerateResource.cache index 50457319..81b3f17c 100644 Binary files a/quick-picture-viewer/obj/Release/quick-picture-viewer.csproj.GenerateResource.cache and b/quick-picture-viewer/obj/Release/quick-picture-viewer.csproj.GenerateResource.cache differ diff --git a/quick-picture-viewer/obj/Release/quick-picture-viewer.csprojAssemblyReference.cache b/quick-picture-viewer/obj/Release/quick-picture-viewer.csprojAssemblyReference.cache index df29444c..bce14415 100644 Binary files a/quick-picture-viewer/obj/Release/quick-picture-viewer.csprojAssemblyReference.cache and b/quick-picture-viewer/obj/Release/quick-picture-viewer.csprojAssemblyReference.cache differ diff --git a/quick-picture-viewer/obj/Release/quick-picture-viewer.exe b/quick-picture-viewer/obj/Release/quick-picture-viewer.exe index 87c56f97..6416d990 100644 Binary files a/quick-picture-viewer/obj/Release/quick-picture-viewer.exe and b/quick-picture-viewer/obj/Release/quick-picture-viewer.exe differ diff --git a/quick-picture-viewer/obj/Release/quick-picture-viewer.pdb b/quick-picture-viewer/obj/Release/quick-picture-viewer.pdb index a6630464..eeb5465c 100644 Binary files a/quick-picture-viewer/obj/Release/quick-picture-viewer.pdb and b/quick-picture-viewer/obj/Release/quick-picture-viewer.pdb differ