From 3c62f0bd9e151d2b5d11862ae639c6a51f0e9ee7 Mon Sep 17 00:00:00 2001 From: Manuel Kamper Date: Sat, 30 Mar 2019 13:03:33 +0100 Subject: [PATCH 1/3] refactoring --- Mk0.Software.ImageSorter/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mk0.Software.ImageSorter/Program.cs b/Mk0.Software.ImageSorter/Program.cs index 52d4a44..b29ff39 100644 --- a/Mk0.Software.ImageSorter/Program.cs +++ b/Mk0.Software.ImageSorter/Program.cs @@ -14,7 +14,7 @@ namespace Mk0.Software.ImageSorter { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - SingleApplication.Run(args.Length == 0 ? new Main(string.Empty) : new Main(args[0]), Mk0.Software.ImageSorter.Properties.Settings.Default.singleInstance); + SingleApplication.Run(args.Length == 0 ? new Main(string.Empty) : new Main(args[0]), Properties.Settings.Default.singleInstance); } } } From e1ed3577096a4bc53eda36c882144e31485448a8 Mon Sep 17 00:00:00 2001 From: Manuel Kamper Date: Sat, 30 Mar 2019 14:07:41 +0100 Subject: [PATCH 2/3] refactoring singleinstance +pass parameter to active singleinstance --- Mk0.Software.ImageSorter/Main.Designer.cs | 3 +- Mk0.Software.ImageSorter/Main.cs | 40 +++++++++++++++--- .../Mk0.Software.ImageSorter.csproj | 5 --- Mk0.Software.ImageSorter/Program.cs | 39 ++++++++++++++--- .../Properties/AssemblyInfo.cs | 2 +- .../dll/Mk0.Tools.SingleInstance.dll | Bin 6144 -> 0 bytes 6 files changed, 70 insertions(+), 19 deletions(-) delete mode 100644 Mk0.Software.ImageSorter/dll/Mk0.Tools.SingleInstance.dll diff --git a/Mk0.Software.ImageSorter/Main.Designer.cs b/Mk0.Software.ImageSorter/Main.Designer.cs index 29c210d..8a15e1a 100644 --- a/Mk0.Software.ImageSorter/Main.Designer.cs +++ b/Mk0.Software.ImageSorter/Main.Designer.cs @@ -472,8 +472,9 @@ this.MinimumSize = new System.Drawing.Size(983, 605); this.Name = "Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Image Sorter v1.27 | © 2015-2019 by manuelkamper.com"; + this.Text = "Image Sorter v1.28 | © 2015-2019 by manuelkamper.com"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing); + this.Load += new System.EventHandler(this.Main_Load); this.Shown += new System.EventHandler(this.Main_Shown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Main_KeyDown); this.Resize += new System.EventHandler(this.Main_ResizeEnd); diff --git a/Mk0.Software.ImageSorter/Main.cs b/Mk0.Software.ImageSorter/Main.cs index da8e2eb..f67bd15 100644 --- a/Mk0.Software.ImageSorter/Main.cs +++ b/Mk0.Software.ImageSorter/Main.cs @@ -6,7 +6,6 @@ using Mk0.Tools.Randomization; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Data; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; @@ -41,21 +40,48 @@ namespace Mk0.Software.ImageSorter private string zoomType = "auto"; private string startuppath; private string startupimage; + public string[] Args; - public Main(string startuppath) + public Main() { InitializeComponent(); banner = new Banner(components, panel3, pictureBox1, pictureBox2, label1, label2); pictureBox.Cursor = grabCursor; DoubleBuffered = true; - if (!string.IsNullOrEmpty(startuppath) && File.Exists(startuppath)) - { - this.startuppath = Path.GetDirectoryName(startuppath); - startupimage = Path.GetFileName(startuppath); - } SetDefaultPath(); } + private void Main_Load(object sender, EventArgs e) + { + if (Args != null) + { + ProcessParameters(null, Args); + Args = null; + } + } + + public delegate void ProcessParametersDelegate(object sender, string[] args); + public void ProcessParameters(object sender, string[] args) + { + if (args != null && args.Length != 0) + { + if (!string.IsNullOrEmpty(args[0]) && File.Exists(args[0])) + { + startuppath = Path.GetDirectoryName(args[0]); + startupimage = Path.GetFileName(args[0]); + if (!string.IsNullOrEmpty(startuppath) && File.Exists(startuppath)) + { + startuppath = Path.GetDirectoryName(startuppath); + startupimage = Path.GetFileName(startuppath); + } + SetDefaultPath(); + SearchImages(); + CountPicsInPath(); + LoadPicture(GetImageIndex(Path.Combine(startuppath, startupimage))); + } + } + } + /// /// Default: Lädt das erste Bild /// diff --git a/Mk0.Software.ImageSorter/Mk0.Software.ImageSorter.csproj b/Mk0.Software.ImageSorter/Mk0.Software.ImageSorter.csproj index 89e6b0e..37b3458 100644 --- a/Mk0.Software.ImageSorter/Mk0.Software.ImageSorter.csproj +++ b/Mk0.Software.ImageSorter/Mk0.Software.ImageSorter.csproj @@ -95,10 +95,6 @@ ..\Mk0.Tools.Randomization.dll False - - ..\Mk0.Tools.SingleInstance.dll - False - @@ -175,7 +171,6 @@ - diff --git a/Mk0.Software.ImageSorter/Program.cs b/Mk0.Software.ImageSorter/Program.cs index b29ff39..b47ab2b 100644 --- a/Mk0.Software.ImageSorter/Program.cs +++ b/Mk0.Software.ImageSorter/Program.cs @@ -1,6 +1,5 @@ using System; -using System.Windows.Forms; -using Mk0.Tools.SingleInstance; +using Microsoft.VisualBasic.ApplicationServices; namespace Mk0.Software.ImageSorter { @@ -12,9 +11,39 @@ namespace Mk0.Software.ImageSorter [STAThread] static void Main(string[] args) { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - SingleApplication.Run(args.Length == 0 ? new Main(string.Empty) : new Main(args[0]), Properties.Settings.Default.singleInstance); + App myApp = new App(); + myApp.Run(args); + } + + class App : WindowsFormsApplicationBase + { + public App() + { + IsSingleInstance = Properties.Settings.Default.singleInstance; + EnableVisualStyles = true; + + ShutdownStyle = ShutdownMode.AfterMainFormCloses; + StartupNextInstance += new StartupNextInstanceEventHandler(SIApp_StartupNextInstance); + } + + protected override void OnCreateMainForm() + { + MainForm = new Main(); + ((Main)MainForm).Args = new string[CommandLineArgs.Count]; + CommandLineArgs.CopyTo(((Main)MainForm).Args, 0); + } + + protected void SIApp_StartupNextInstance(object sender, StartupNextInstanceEventArgs eventArgs) + { + string[] args = new string[eventArgs.CommandLine.Count]; + eventArgs.CommandLine.CopyTo(args, 0); + + object[] parameters = new object[2]; + parameters[0] = MainForm; + parameters[1] = args; + + MainForm.Invoke(new Main.ProcessParametersDelegate(((Main)MainForm).ProcessParameters), parameters); + } } } } diff --git a/Mk0.Software.ImageSorter/Properties/AssemblyInfo.cs b/Mk0.Software.ImageSorter/Properties/AssemblyInfo.cs index c25d0c0..e5ef9a9 100644 --- a/Mk0.Software.ImageSorter/Properties/AssemblyInfo.cs +++ b/Mk0.Software.ImageSorter/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.27.*")] +[assembly: AssemblyVersion("1.28.*")] //[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/Mk0.Software.ImageSorter/dll/Mk0.Tools.SingleInstance.dll b/Mk0.Software.ImageSorter/dll/Mk0.Tools.SingleInstance.dll deleted file mode 100644 index 490cde19102e8ee81d20b59e0271e41ef62fa2f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6144 zcmeHLU2Ggz6+SbwJG)*x8?T)>n>1-AbsBABXIaOljiG7%pDe_&<8|yLxY)D1V|$w2 zneEJM9U~E3Rjt&AR*4W5K|DYnh)RkeQd>#|LV$oGQ6z|p5UQX;LR26`#8dc7_|Bc( z_1Z~_@=ANxbME=O=bm%!xp(e(^wc?0h$w*P=1rp4(R1q)@cqFG#L=B^MCp}=w|2cQ z9eHcl~kag&}(@5@DMc%T=xBDhRT533LfyeDKz&CtMcD!Um=-=_F5;= z7$bd{ij%Ou%@H+$_nQu)1M6k)M{70Lg;p5!;X3`KXPogsH*WxdOvGC88--wgT&r+FI3^+S$l}Zq|+u#LlY3v}LQzC>=rw{EQ>jiuT$XZhh9Yc?) zVe=jgwzqQ}s=EUnGIuY!rY#O~S_&t2f@o1(4c!Vjfd-DVa|4}a!rlcoQA67esWph8 zgIE$8$b4czs;n;8%9B0GRI)qO-PH>M>t6tzK|t+iiQYti7>=}OJjb*aT-IpDe#8P% z`|%9z2F|6}e&~352z?LeS1@z?K*7#}=7y9>(>vr%$PUpzrEacCs1VX3N)&Qp8J9Ku z6+GVdm{#b)g<6l@D)U&@{*`n_QRz{cp(>3i8|jNsRVgW{;Jhl}ivsSEne%snHwt`M z;M=5=;9n<(%Yri}eNI;CZRILpW8g74LO)SPlqmgHz6727mCdmKD5Md(LL=Z@kgv*7 z`m2z(2Y8n4(BbBL$$6HLp+Ct7sbAnR6yq1@*h+*h(748$&&GQ(&eva|^V&7#%XQQ{ z%0;dgG?pdkBJwh$F@2sax`g$*UZJMwGN^|+h4doDm2dJ|)~MGgMCSyBaWYfvqhJ63 z!UR5Eg};}Zn`Qcn+(5mGgfe6gw*p4!0l;SJ60ldmegV@09ux4SfI8r2G6nvGfXf0t z1*p7|Cco7HH6?zl=?@(vp5IE1%C`KI!9HSo~x-9*S zwgeo&f5_eROJVt|^nIcK3uTF(1Lw1Vfq;q^NSIzgU2Ub$Q<56#4Zv3V5#T-a2f%jv z3t$H|NJ)%m_;CRT1^<(@5uA+Rd`iF^YAi{o=>(ulhO~{Q=`mWQ%Q8tgKanw#LiCR4 z8z_O?23D#SfwYTu5Rfap+MXfoWVE%stGqeZ@hC$qe>&!AM)Kr&~FL zGE1hHTb#59%Z_7MUX6dq@Yb=WO)GCN9oDUU!4S4bb5fes1KO->rR@=x(zMS)J6%5*?Wyf4tysfBM(yisyF%xCWGm8e# ziFvYS!Sw2+l{%VSbPPR@3PBb17Z_j0IExt-jf$CMB@sd*-W8;mN*TlRm{WEQr+a@g zUntzM@PyE}Nh7vXqv1x0>+_LoWpGba)vYVC+!A*yZ|^93Wv=_GhWyfkTR-WG_j zBFIyQV^cEc*$$;GZ`^aLVGNo2f@Qm&nRBbGYGhEvD8%ACX`+7Di~U72oSNLPNQ8|- zUsd-vhMVNrTw2{tmFgzc3nHSi?BfW7kT@tB3yxj3^8QfDEZR#I)EX@2nIx2np}WQ? zcETAd3JBA~XN+8#6JISxvP-kWPn30DW5&~#QKfLaY&?W_zD-%u(a-RKL;pFybp7JB z=LastzLEO5`qXg>Xp$6GG@NfhVlgJ84CLleINp-pA^yTGX*n*dahzc-X(&hWT7x7C zG#t>VBuQ!+Z3wB+mSa)SY{P(7G#U+QiX=yyeY%kRI!HifJD0u zqr0m|Pxb6e_2g3fdgkY|`+9qObNdeTcF#Z9W#m5Eo6X~{j#;~K{lbrERHE(4qr;Q6 zBd4>nsSe_b_F%FL?ngJ(ghQrVD(K=!+{B}_nnV-Y91ETN$hIGIFXQ5j$oUy*fDW#8L(;5JkBw0yTzzUNOf>s$aV6dXM^(Fw*pOkQott1YT z@G5fK3#;{Z{guvRo+9RPpj}-J!isTxW0g61r8&N8)iA{?h~xJzb6p?jgotw-bJ&Q! zjJ5FUGI;m4ImRBbj%#hMU(NMvc|eTmNA&nEL0nlxx{Un&uW>xzhwTHJ0nPuPVH1Cn Ke%L;68Tc=9o{#JR From 9fe36ea0c7134aa7ad0f00d51c6cabb8bc763fe2 Mon Sep 17 00:00:00 2001 From: Manuel Kamper Date: Tue, 2 Apr 2019 17:36:31 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Zoom-Einstellung=20von=20Buttons=20auf=20Co?= =?UTF-8?q?mbobox=20ge=C3=A4ndert=20und=20Optionen=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mk0.Software.ImageSorter/App.config | 50 ++++++++------ Mk0.Software.ImageSorter/Main.Designer.cs | 63 ++++++++--------- Mk0.Software.ImageSorter/Main.cs | 69 ++++++++++++------- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/Settings.Designer.cs | 14 +++- .../Properties/Settings.settings | 5 +- 6 files changed, 122 insertions(+), 81 deletions(-) diff --git a/Mk0.Software.ImageSorter/App.config b/Mk0.Software.ImageSorter/App.config index 452f2d1..12e7981 100644 --- a/Mk0.Software.ImageSorter/App.config +++ b/Mk0.Software.ImageSorter/App.config @@ -37,27 +37,33 @@ - - - - - - - - True - - - 0 - - - 0 - - - 0 - - - 0 - - + + + + + + + + True + + + 0 + + + 0 + + + 0 + + + 0 + + + False + + + 0 + + diff --git a/Mk0.Software.ImageSorter/Main.Designer.cs b/Mk0.Software.ImageSorter/Main.Designer.cs index 8a15e1a..01efd50 100644 --- a/Mk0.Software.ImageSorter/Main.Designer.cs +++ b/Mk0.Software.ImageSorter/Main.Designer.cs @@ -53,8 +53,6 @@ this.buttonRotate270 = new System.Windows.Forms.Button(); this.buttonMirrorHorizontal = new System.Windows.Forms.Button(); this.buttonMirrorVertikal = new System.Windows.Forms.Button(); - this.buttonZoom100 = new System.Windows.Forms.Button(); - this.buttonZoomAuto = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); this.labelNoImages = new System.Windows.Forms.Label(); this.labelZoom = new System.Windows.Forms.Label(); @@ -64,6 +62,8 @@ this.label1 = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); + this.comboBoxZoom = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.contextMenuStrip.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -333,30 +333,6 @@ this.buttonMirrorVertikal.UseVisualStyleBackColor = true; this.buttonMirrorVertikal.Click += new System.EventHandler(this.ImageMirror); // - // buttonZoom100 - // - this.buttonZoom100.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonZoom100.Location = new System.Drawing.Point(712, 538); - this.buttonZoom100.Name = "buttonZoom100"; - this.buttonZoom100.Size = new System.Drawing.Size(100, 23); - this.buttonZoom100.TabIndex = 11; - this.buttonZoom100.Tag = "100"; - this.buttonZoom100.Text = "Zoom 100%"; - this.buttonZoom100.UseVisualStyleBackColor = true; - this.buttonZoom100.Click += new System.EventHandler(this.Zoom); - // - // buttonZoomAuto - // - this.buttonZoomAuto.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonZoomAuto.Location = new System.Drawing.Point(818, 538); - this.buttonZoomAuto.Name = "buttonZoomAuto"; - this.buttonZoomAuto.Size = new System.Drawing.Size(100, 23); - this.buttonZoomAuto.TabIndex = 12; - this.buttonZoomAuto.Tag = "auto"; - this.buttonZoomAuto.Text = "Zoom Auto"; - this.buttonZoomAuto.UseVisualStyleBackColor = true; - this.buttonZoomAuto.Click += new System.EventHandler(this.Zoom); - // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -449,16 +425,41 @@ this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // + // comboBoxZoom + // + this.comboBoxZoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxZoom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxZoom.FormattingEnabled = true; + this.comboBoxZoom.Items.AddRange(new object[] { + "Auto", + "Vollbild", + "Original"}); + this.comboBoxZoom.Location = new System.Drawing.Point(799, 538); + this.comboBoxZoom.Name = "comboBoxZoom"; + this.comboBoxZoom.Size = new System.Drawing.Size(121, 21); + this.comboBoxZoom.TabIndex = 14; + this.comboBoxZoom.SelectedIndexChanged += new System.EventHandler(this.ComboBoxZoom_SelectedIndexChanged); + // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(759, 543); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(34, 13); + this.label3.TabIndex = 15; + this.label3.Text = "Zoom"; + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.ClientSize = new System.Drawing.Size(967, 566); + this.Controls.Add(this.label3); + this.Controls.Add(this.comboBoxZoom); this.Controls.Add(this.panel3); this.Controls.Add(this.labelZoom); this.Controls.Add(this.panel1); - this.Controls.Add(this.buttonZoomAuto); - this.Controls.Add(this.buttonZoom100); this.Controls.Add(this.buttonMirrorVertikal); this.Controls.Add(this.buttonMirrorHorizontal); this.Controls.Add(this.buttonRotate270); @@ -472,7 +473,7 @@ this.MinimumSize = new System.Drawing.Size(983, 605); this.Name = "Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Image Sorter v1.28 | © 2015-2019 by manuelkamper.com"; + this.Text = "Image Sorter v1.29 | © 2015-2019 by manuelkamper.com"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing); this.Load += new System.EventHandler(this.Main_Load); this.Shown += new System.EventHandler(this.Main_Shown); @@ -513,8 +514,6 @@ private System.Windows.Forms.Button buttonRotate270; private System.Windows.Forms.Button buttonMirrorHorizontal; private System.Windows.Forms.Button buttonMirrorVertikal; - private System.Windows.Forms.Button buttonZoom100; - private System.Windows.Forms.Button buttonZoomAuto; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label labelZoom; private System.Windows.Forms.ContextMenuStrip contextMenuStrip; @@ -532,6 +531,8 @@ private System.Windows.Forms.Button buttonQuellPfad; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog; private System.Windows.Forms.Label labelZielPath; + private System.Windows.Forms.ComboBox comboBoxZoom; + private System.Windows.Forms.Label label3; } } diff --git a/Mk0.Software.ImageSorter/Main.cs b/Mk0.Software.ImageSorter/Main.cs index f67bd15..815cf68 100644 --- a/Mk0.Software.ImageSorter/Main.cs +++ b/Mk0.Software.ImageSorter/Main.cs @@ -37,7 +37,7 @@ namespace Mk0.Software.ImageSorter private Thread folderThread; private bool threadIsRunning = false; private Banner banner; - private string zoomType = "auto"; + //private string zoomType = "auto"; private string startuppath; private string startupimage; public string[] Args; @@ -49,6 +49,7 @@ namespace Mk0.Software.ImageSorter pictureBox.Cursor = grabCursor; DoubleBuffered = true; SetDefaultPath(); + comboBoxZoom.SelectedIndex = Properties.Settings.Default.zoom; } private void Main_Load(object sender, EventArgs e) @@ -401,8 +402,7 @@ namespace Mk0.Software.ImageSorter buttonRotate180.Enabled = enabled; buttonRotate270.Enabled = enabled; buttonRotate90.Enabled = enabled; - buttonZoom100.Enabled = enabled; - buttonZoomAuto.Enabled = enabled; + comboBoxZoom.Enabled = enabled; buttonJumpOver.Enabled = enabled; labelNoImages.Visible = !enabled; } @@ -672,37 +672,48 @@ namespace Mk0.Software.ImageSorter } /// - /// Zoom-Optionen für Buttons + /// Zoom-Optionen /// /// /// - private void Zoom(object sender, EventArgs e) + private void Zoom() { - Button btn = (Button)sender; - string zoom = btn.Tag.ToString(); + string zoom = comboBoxZoom.SelectedItem.ToString(); - if (zoom == "100") + if (zoom == "Original") { - zoomType = "100"; - buttonZoom100.Font = new Font(buttonZoom100.Font, FontStyle.Bold); - buttonZoomAuto.Font = new Font(buttonZoomAuto.Font, FontStyle.Regular); pictureBox.SizeMode = PictureBoxSizeMode.Zoom; pictureBox.Size = new Size(pictureBox.Image.Width, pictureBox.Image.Height); if (pictureBox.Image.Width > panel1.Width) { pictureBox.Left = (panel1.Width / 2) - (pictureBox.Width / 2); } else { pictureBox.Left = (panel1.Width / 2) - (pictureBox.Image.Width / 2); } if (pictureBox.Image.Height > panel1.Height) { pictureBox.Top = (panel1.Height / 2) - (pictureBox.Height / 2); } else { pictureBox.Top = (panel1.Height / 2) - (pictureBox.Image.Height / 2); } moveable = true; } - else if (zoom == "auto") + else if (zoom == "Vollbild") { - zoomType = "auto"; - buttonZoom100.Font = new Font(buttonZoom100.Font, FontStyle.Regular); - buttonZoomAuto.Font = new Font(buttonZoomAuto.Font, FontStyle.Bold); pictureBox.SizeMode = PictureBoxSizeMode.Zoom; pictureBox.Size = new Size(panel1.Width, panel1.Height); pictureBox.Top = 0; pictureBox.Left = 0; moveable = false; } + else if (zoom == "Auto") + { + pictureBox.SizeMode = PictureBoxSizeMode.Zoom; + if(pictureBox.Image.Width>panel1.Width || pictureBox.Image.Height>panel1.Height) + { + pictureBox.Size = new Size(panel1.Width, panel1.Height); + pictureBox.Top = 0; + pictureBox.Left = 0; + moveable = false; + } + else + { + pictureBox.Size = new Size(pictureBox.Image.Width, pictureBox.Image.Height); + if (pictureBox.Image.Width > panel1.Width) { pictureBox.Left = (panel1.Width / 2) - (pictureBox.Width / 2); } else { pictureBox.Left = (panel1.Width / 2) - (pictureBox.Image.Width / 2); } + if (pictureBox.Image.Height > panel1.Height) { pictureBox.Top = (panel1.Height / 2) - (pictureBox.Height / 2); } else { pictureBox.Top = (panel1.Height / 2) - (pictureBox.Image.Height / 2); } + moveable = true; + } + } else { return; @@ -855,11 +866,7 @@ namespace Mk0.Software.ImageSorter /// private void PictureBox_LoadCompleted(object sender, AsyncCompletedEventArgs e) { - Button b = new Button - { - Tag = zoomType - }; - Zoom(b, null); + Zoom(); } /// @@ -1047,11 +1054,7 @@ namespace Mk0.Software.ImageSorter { try { - Button b = new Button - { - Tag = zoomType - }; - Zoom(b, null); + Zoom(); } catch (Exception) { @@ -1140,5 +1143,21 @@ namespace Mk0.Software.ImageSorter LoadPicture(0); ResetUndo(); } + + /// + /// Zoom-Combobox geändert + /// + /// + /// + private void ComboBoxZoom_SelectedIndexChanged(object sender, EventArgs e) + { + Properties.Settings.Default.zoom = comboBoxZoom.SelectedIndex; + Properties.Settings.Default.Save(); + + if(pictureBox.Image != null) + { + Zoom(); + } + } } } \ No newline at end of file diff --git a/Mk0.Software.ImageSorter/Properties/AssemblyInfo.cs b/Mk0.Software.ImageSorter/Properties/AssemblyInfo.cs index e5ef9a9..0802e78 100644 --- a/Mk0.Software.ImageSorter/Properties/AssemblyInfo.cs +++ b/Mk0.Software.ImageSorter/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.28.*")] +[assembly: AssemblyVersion("1.29.*")] //[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/Mk0.Software.ImageSorter/Properties/Settings.Designer.cs b/Mk0.Software.ImageSorter/Properties/Settings.Designer.cs index a70960b..4ed8230 100644 --- a/Mk0.Software.ImageSorter/Properties/Settings.Designer.cs +++ b/Mk0.Software.ImageSorter/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Mk0.Software.ImageSorter.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -118,5 +118,17 @@ namespace Mk0.Software.ImageSorter.Properties { this["fileAssociation"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public int zoom { + get { + return ((int)(this["zoom"])); + } + set { + this["zoom"] = value; + } + } } } diff --git a/Mk0.Software.ImageSorter/Properties/Settings.settings b/Mk0.Software.ImageSorter/Properties/Settings.settings index ddd057c..941d310 100644 --- a/Mk0.Software.ImageSorter/Properties/Settings.settings +++ b/Mk0.Software.ImageSorter/Properties/Settings.settings @@ -1,5 +1,5 @@  - + @@ -26,5 +26,8 @@ False + + 0 + \ No newline at end of file