Use radio buttons for combine orientation

This commit is contained in:
Jaex 2020-11-21 00:12:29 +03:00
parent 596510f2e5
commit 297204f327
3 changed files with 150 additions and 44 deletions

View file

@ -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;
}
}

View file

@ -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();
}

View file

@ -232,7 +232,7 @@
<value>lvImages</value>
</data>
<data name="&gt;&gt;lvImages.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvImages.Parent" xml:space="preserve">
<value>$this</value>
@ -360,30 +360,6 @@
<data name="&gt;&gt;lblOrientation.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="cbOrientation.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
<data name="cbOrientation.Location" type="System.Drawing.Point, System.Drawing">
<value>200, 420</value>
</data>
<data name="cbOrientation.Size" type="System.Drawing.Size, System.Drawing">
<value>121, 21</value>
</data>
<data name="cbOrientation.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="&gt;&gt;cbOrientation.Name" xml:space="preserve">
<value>cbOrientation</value>
</data>
<data name="&gt;&gt;cbOrientation.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cbOrientation.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cbOrientation.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="lblSpacePixel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
@ -412,7 +388,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;lblSpacePixel.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="lblImageAlignment.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
@ -442,7 +418,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;lblImageAlignment.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="cbAlignment.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
@ -466,13 +442,97 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbAlignment.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="flpOrientation.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
<data name="flpOrientation.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="rbOrientationHorizontal.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="rbOrientationHorizontal.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 3</value>
</data>
<data name="rbOrientationHorizontal.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 3, 3, 3</value>
</data>
<data name="rbOrientationHorizontal.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 17</value>
</data>
<data name="rbOrientationHorizontal.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="rbOrientationHorizontal.Text" xml:space="preserve">
<value>Horizontal</value>
</data>
<data name="&gt;&gt;rbOrientationHorizontal.Name" xml:space="preserve">
<value>rbOrientationHorizontal</value>
</data>
<data name="&gt;&gt;rbOrientationHorizontal.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;rbOrientationHorizontal.Parent" xml:space="preserve">
<value>flpOrientation</value>
</data>
<data name="&gt;&gt;rbOrientationHorizontal.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="rbOrientationVertical.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="rbOrientationVertical.Location" type="System.Drawing.Point, System.Drawing">
<value>78, 3</value>
</data>
<data name="rbOrientationVertical.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 17</value>
</data>
<data name="rbOrientationVertical.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="rbOrientationVertical.Text" xml:space="preserve">
<value>Vertical</value>
</data>
<data name="&gt;&gt;rbOrientationVertical.Name" xml:space="preserve">
<value>rbOrientationVertical</value>
</data>
<data name="&gt;&gt;rbOrientationVertical.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;rbOrientationVertical.Parent" xml:space="preserve">
<value>flpOrientation</value>
</data>
<data name="&gt;&gt;rbOrientationVertical.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="flpOrientation.Location" type="System.Drawing.Point, System.Drawing">
<value>200, 419</value>
</data>
<data name="flpOrientation.Size" type="System.Drawing.Size, System.Drawing">
<value>141, 23</value>
</data>
<data name="flpOrientation.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
</data>
<data name="&gt;&gt;flpOrientation.Name" xml:space="preserve">
<value>flpOrientation</value>
</data>
<data name="&gt;&gt;flpOrientation.Type" xml:space="preserve">
<value>System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;flpOrientation.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;flpOrientation.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
<value>96, 96</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>521, 536</value>