From 297204f32793aed34b36e27cf2dad021224f15dd Mon Sep 17 00:00:00 2001 From: Jaex Date: Sat, 21 Nov 2020 00:12:29 +0300 Subject: [PATCH] Use radio buttons for combine orientation --- .../Forms/ImageCombinerForm.Designer.cs | 45 +++++-- ShareX.MediaLib/Forms/ImageCombinerForm.cs | 33 ++++- ShareX.MediaLib/Forms/ImageCombinerForm.resx | 116 +++++++++++++----- 3 files changed, 150 insertions(+), 44 deletions(-) diff --git a/ShareX.MediaLib/Forms/ImageCombinerForm.Designer.cs b/ShareX.MediaLib/Forms/ImageCombinerForm.Designer.cs index f7393a663..220ac8f92 100644 --- a/ShareX.MediaLib/Forms/ImageCombinerForm.Designer.cs +++ b/ShareX.MediaLib/Forms/ImageCombinerForm.Designer.cs @@ -39,11 +39,14 @@ private void InitializeComponent() this.lblSpace = new System.Windows.Forms.Label(); this.nudSpace = new System.Windows.Forms.NumericUpDown(); this.lblOrientation = new System.Windows.Forms.Label(); - this.cbOrientation = new System.Windows.Forms.ComboBox(); this.lblSpacePixel = new System.Windows.Forms.Label(); this.lblImageAlignment = new System.Windows.Forms.Label(); this.cbAlignment = new System.Windows.Forms.ComboBox(); + this.flpOrientation = new System.Windows.Forms.FlowLayoutPanel(); + this.rbOrientationHorizontal = new System.Windows.Forms.RadioButton(); + this.rbOrientationVertical = new System.Windows.Forms.RadioButton(); ((System.ComponentModel.ISupportInitialize)(this.nudSpace)).BeginInit(); + this.flpOrientation.SuspendLayout(); this.SuspendLayout(); // // btnAdd @@ -123,14 +126,6 @@ private void InitializeComponent() resources.ApplyResources(this.lblOrientation, "lblOrientation"); this.lblOrientation.Name = "lblOrientation"; // - // cbOrientation - // - resources.ApplyResources(this.cbOrientation, "cbOrientation"); - this.cbOrientation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbOrientation.FormattingEnabled = true; - this.cbOrientation.Name = "cbOrientation"; - this.cbOrientation.SelectedIndexChanged += new System.EventHandler(this.cbOrientation_SelectedIndexChanged); - // // lblSpacePixel // resources.ApplyResources(this.lblSpacePixel, "lblSpacePixel"); @@ -149,18 +144,40 @@ private void InitializeComponent() this.cbAlignment.Name = "cbAlignment"; this.cbAlignment.SelectedIndexChanged += new System.EventHandler(this.cbAlignment_SelectedIndexChanged); // + // flpOrientation + // + resources.ApplyResources(this.flpOrientation, "flpOrientation"); + this.flpOrientation.Controls.Add(this.rbOrientationHorizontal); + this.flpOrientation.Controls.Add(this.rbOrientationVertical); + this.flpOrientation.Name = "flpOrientation"; + // + // rbOrientationHorizontal + // + resources.ApplyResources(this.rbOrientationHorizontal, "rbOrientationHorizontal"); + this.rbOrientationHorizontal.Name = "rbOrientationHorizontal"; + this.rbOrientationHorizontal.TabStop = true; + this.rbOrientationHorizontal.UseVisualStyleBackColor = true; + this.rbOrientationHorizontal.CheckedChanged += new System.EventHandler(this.rbOrientationHorizontal_CheckedChanged); + // + // rbOrientationVertical + // + resources.ApplyResources(this.rbOrientationVertical, "rbOrientationVertical"); + this.rbOrientationVertical.Name = "rbOrientationVertical"; + this.rbOrientationVertical.TabStop = true; + this.rbOrientationVertical.UseVisualStyleBackColor = true; + this.rbOrientationVertical.CheckedChanged += new System.EventHandler(this.rbOrientationVertical_CheckedChanged); + // // ImageCombinerForm // this.AcceptButton = this.btnCombine; this.AllowDrop = true; resources.ApplyResources(this, "$this"); - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.SystemColors.Window; + this.Controls.Add(this.flpOrientation); this.Controls.Add(this.cbAlignment); this.Controls.Add(this.lblImageAlignment); this.Controls.Add(this.lblSpacePixel); - this.Controls.Add(this.cbOrientation); this.Controls.Add(this.lblOrientation); this.Controls.Add(this.nudSpace); this.Controls.Add(this.lblSpace); @@ -174,6 +191,8 @@ private void InitializeComponent() this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ImageCombinerForm_DragDrop); this.DragEnter += new System.Windows.Forms.DragEventHandler(this.ImageCombinerForm_DragEnter); ((System.ComponentModel.ISupportInitialize)(this.nudSpace)).EndInit(); + this.flpOrientation.ResumeLayout(false); + this.flpOrientation.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -190,10 +209,12 @@ private void InitializeComponent() private System.Windows.Forms.Label lblSpace; private System.Windows.Forms.NumericUpDown nudSpace; private System.Windows.Forms.Label lblOrientation; - private System.Windows.Forms.ComboBox cbOrientation; private System.Windows.Forms.ColumnHeader chFilepath; private System.Windows.Forms.Label lblSpacePixel; private System.Windows.Forms.Label lblImageAlignment; private System.Windows.Forms.ComboBox cbAlignment; + private System.Windows.Forms.FlowLayoutPanel flpOrientation; + private System.Windows.Forms.RadioButton rbOrientationHorizontal; + private System.Windows.Forms.RadioButton rbOrientationVertical; } } \ No newline at end of file diff --git a/ShareX.MediaLib/Forms/ImageCombinerForm.cs b/ShareX.MediaLib/Forms/ImageCombinerForm.cs index 6bcfe5bb5..dcd90b102 100644 --- a/ShareX.MediaLib/Forms/ImageCombinerForm.cs +++ b/ShareX.MediaLib/Forms/ImageCombinerForm.cs @@ -46,12 +46,31 @@ public ImageCombinerForm(ImageCombinerOptions options) InitializeComponent(); ShareXResources.ApplyTheme(this); - cbOrientation.Items.AddRange(Enum.GetNames(typeof(Orientation))); - cbOrientation.SelectedIndex = (int)Options.Orientation; + if (Options.Orientation == Orientation.Horizontal) + { + rbOrientationHorizontal.Checked = true; + } + else + { + rbOrientationVertical.Checked = true; + } + UpdateAlignmentComboBox(); nudSpace.SetValue(Options.Space); } + private void UpdateOrientation() + { + if (rbOrientationHorizontal.Checked) + { + Options.Orientation = Orientation.Horizontal; + } + else + { + Options.Orientation = Orientation.Vertical; + } + } + private void UpdateAlignmentComboBox() { cbAlignment.Items.Clear(); @@ -123,9 +142,15 @@ private void btnMoveDown_Click(object sender, EventArgs e) } } - private void cbOrientation_SelectedIndexChanged(object sender, EventArgs e) + private void rbOrientationHorizontal_CheckedChanged(object sender, EventArgs e) { - Options.Orientation = (Orientation)cbOrientation.SelectedIndex; + UpdateOrientation(); + UpdateAlignmentComboBox(); + } + + private void rbOrientationVertical_CheckedChanged(object sender, EventArgs e) + { + UpdateOrientation(); UpdateAlignmentComboBox(); } diff --git a/ShareX.MediaLib/Forms/ImageCombinerForm.resx b/ShareX.MediaLib/Forms/ImageCombinerForm.resx index 5c4dde0a4..22be8661a 100644 --- a/ShareX.MediaLib/Forms/ImageCombinerForm.resx +++ b/ShareX.MediaLib/Forms/ImageCombinerForm.resx @@ -232,7 +232,7 @@ lvImages - ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null $this @@ -360,30 +360,6 @@ 4 - - Bottom, Left - - - 200, 420 - - - 121, 21 - - - 6 - - - cbOrientation - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - Bottom, Left @@ -412,7 +388,7 @@ $this - 2 + 3 Bottom, Left @@ -442,7 +418,7 @@ $this - 1 + 2 Bottom, Left @@ -466,13 +442,97 @@ $this + 1 + + + Bottom, Left + + + True + + + True + + + 0, 3 + + + 0, 3, 3, 3 + + + 72, 17 + + + 0 + + + Horizontal + + + rbOrientationHorizontal + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flpOrientation + + + 0 + + + True + + + 78, 3 + + + 60, 17 + + + 1 + + + Vertical + + + rbOrientationVertical + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flpOrientation + + + 1 + + + 200, 419 + + + 141, 23 + + + 13 + + + flpOrientation + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + 0 True - 6, 13 + 96, 96 521, 536