implemented #11
This commit is contained in:
parent
a710eced2e
commit
cb0fd96c2d
31
Mk0.Software.ImageSorter/Konverter.Designer.cs
generated
31
Mk0.Software.ImageSorter/Konverter.Designer.cs
generated
@ -37,21 +37,25 @@
|
|||||||
//
|
//
|
||||||
// comboBoxFormat
|
// comboBoxFormat
|
||||||
//
|
//
|
||||||
|
this.comboBoxFormat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.comboBoxFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.comboBoxFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.comboBoxFormat.FormattingEnabled = true;
|
this.comboBoxFormat.FormattingEnabled = true;
|
||||||
this.comboBoxFormat.Items.AddRange(new object[] {
|
this.comboBoxFormat.Items.AddRange(new object[] {
|
||||||
"PNG",
|
"PNG",
|
||||||
"JPG",
|
"JPG",
|
||||||
"BMP"});
|
"BMP"});
|
||||||
this.comboBoxFormat.Location = new System.Drawing.Point(201, 65);
|
this.comboBoxFormat.Location = new System.Drawing.Point(302, 98);
|
||||||
|
this.comboBoxFormat.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.comboBoxFormat.Name = "comboBoxFormat";
|
this.comboBoxFormat.Name = "comboBoxFormat";
|
||||||
this.comboBoxFormat.Size = new System.Drawing.Size(121, 28);
|
this.comboBoxFormat.Size = new System.Drawing.Size(180, 28);
|
||||||
this.comboBoxFormat.TabIndex = 0;
|
this.comboBoxFormat.TabIndex = 0;
|
||||||
|
this.comboBoxFormat.SelectedIndexChanged += new System.EventHandler(this.ComboBoxFormat_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
this.label1.Location = new System.Drawing.Point(18, 14);
|
||||||
|
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(179, 20);
|
this.label1.Size = new System.Drawing.Size(179, 20);
|
||||||
this.label1.TabIndex = 1;
|
this.label1.TabIndex = 1;
|
||||||
@ -60,7 +64,8 @@
|
|||||||
// labelBildname
|
// labelBildname
|
||||||
//
|
//
|
||||||
this.labelBildname.AutoSize = true;
|
this.labelBildname.AutoSize = true;
|
||||||
this.labelBildname.Location = new System.Drawing.Point(12, 29);
|
this.labelBildname.Location = new System.Drawing.Point(18, 44);
|
||||||
|
this.labelBildname.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.labelBildname.Name = "labelBildname";
|
this.labelBildname.Name = "labelBildname";
|
||||||
this.labelBildname.Size = new System.Drawing.Size(73, 20);
|
this.labelBildname.Size = new System.Drawing.Size(73, 20);
|
||||||
this.labelBildname.TabIndex = 2;
|
this.labelBildname.TabIndex = 2;
|
||||||
@ -68,10 +73,12 @@
|
|||||||
//
|
//
|
||||||
// buttonKonvert
|
// buttonKonvert
|
||||||
//
|
//
|
||||||
|
this.buttonKonvert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonKonvert.Enabled = false;
|
this.buttonKonvert.Enabled = false;
|
||||||
this.buttonKonvert.Location = new System.Drawing.Point(337, 62);
|
this.buttonKonvert.Location = new System.Drawing.Point(506, 93);
|
||||||
|
this.buttonKonvert.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.buttonKonvert.Name = "buttonKonvert";
|
this.buttonKonvert.Name = "buttonKonvert";
|
||||||
this.buttonKonvert.Size = new System.Drawing.Size(121, 32);
|
this.buttonKonvert.Size = new System.Drawing.Size(182, 48);
|
||||||
this.buttonKonvert.TabIndex = 3;
|
this.buttonKonvert.TabIndex = 3;
|
||||||
this.buttonKonvert.Text = "Konvertieren";
|
this.buttonKonvert.Text = "Konvertieren";
|
||||||
this.buttonKonvert.UseVisualStyleBackColor = true;
|
this.buttonKonvert.UseVisualStyleBackColor = true;
|
||||||
@ -80,7 +87,8 @@
|
|||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
this.label2.Location = new System.Drawing.Point(12, 68);
|
this.label2.Location = new System.Drawing.Point(18, 102);
|
||||||
|
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label2.Name = "label2";
|
this.label2.Name = "label2";
|
||||||
this.label2.Size = new System.Drawing.Size(135, 20);
|
this.label2.Size = new System.Drawing.Size(135, 20);
|
||||||
this.label2.TabIndex = 4;
|
this.label2.TabIndex = 4;
|
||||||
@ -88,19 +96,20 @@
|
|||||||
//
|
//
|
||||||
// Konverter
|
// Konverter
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||||
this.ClientSize = new System.Drawing.Size(472, 110);
|
this.ClientSize = new System.Drawing.Size(699, 140);
|
||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.buttonKonvert);
|
this.Controls.Add(this.buttonKonvert);
|
||||||
this.Controls.Add(this.labelBildname);
|
this.Controls.Add(this.labelBildname);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.comboBoxFormat);
|
this.Controls.Add(this.comboBoxFormat);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MaximumSize = new System.Drawing.Size(488, 149);
|
this.MaximumSize = new System.Drawing.Size(721, 196);
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.MinimumSize = new System.Drawing.Size(488, 149);
|
this.MinimumSize = new System.Drawing.Size(721, 196);
|
||||||
this.Name = "Konverter";
|
this.Name = "Konverter";
|
||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
this.ShowInTaskbar = false;
|
this.ShowInTaskbar = false;
|
||||||
|
@ -1,25 +1,59 @@
|
|||||||
using System;
|
using ImageMagick;
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.IO;
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Mk0.Software.ImageSorter
|
namespace Mk0.Software.ImageSorter
|
||||||
{
|
{
|
||||||
public partial class Konverter : Form
|
public partial class Konverter : Form
|
||||||
{
|
{
|
||||||
public Konverter()
|
private string imagePath;
|
||||||
|
public string newFilePath { get; set; }
|
||||||
|
|
||||||
|
public Konverter(string imagePath, bool auto = false, string autoFormat = "")
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.imagePath = imagePath;
|
||||||
|
labelBildname.Text = imagePath;
|
||||||
|
comboBoxFormat.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonKonvert_Click(object sender, EventArgs e)
|
private void ButtonKonvert_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
//todo konvertieren
|
||||||
|
using (MagickImage image = new MagickImage(imagePath))
|
||||||
|
{
|
||||||
|
if (comboBoxFormat.SelectedItem == "PNG")
|
||||||
|
{
|
||||||
|
image.Format = MagickFormat.Png;
|
||||||
|
}
|
||||||
|
else if (comboBoxFormat.SelectedItem == "JPG")
|
||||||
|
{
|
||||||
|
image.Format = MagickFormat.Jpeg;
|
||||||
|
}
|
||||||
|
else if (comboBoxFormat.SelectedItem == "BMP")
|
||||||
|
{
|
||||||
|
image.Format = MagickFormat.Bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save frame as jpg
|
||||||
|
newFilePath = Path.Combine(Path.GetDirectoryName(imagePath), Path.GetFileNameWithoutExtension(imagePath) + "." + comboBoxFormat.SelectedItem.ToString().ToLower());
|
||||||
|
image.Write(newFilePath);
|
||||||
|
}
|
||||||
|
this.DialogResult = DialogResult.OK;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ComboBoxFormat_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (File.Exists(imagePath) && comboBoxFormat.SelectedIndex != -1)
|
||||||
|
{
|
||||||
|
buttonKonvert.Enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buttonKonvert.Enabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace Mk0.Software.ImageSorter
|
|||||||
{
|
{
|
||||||
public string quellPath = "";
|
public string quellPath = "";
|
||||||
public string zielPath = "";
|
public string zielPath = "";
|
||||||
private string[] fileTypes = { ".jpg", ".png", ".jpeg", ".gif", ".tif", ".tiff", ".bmp", ".heic" };
|
private string[] fileTypes = { ".jpg", ".png", ".jpeg", ".gif", ".tif", ".tiff", ".bmp", ".heic", ".webp" };
|
||||||
private int moved = 0;
|
private int moved = 0;
|
||||||
private int imageIndex;
|
private int imageIndex;
|
||||||
private List<Button> buttons = new List<Button>();
|
private List<Button> buttons = new List<Button>();
|
||||||
@ -2281,8 +2281,17 @@ namespace Mk0.Software.ImageSorter
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void KonvertierenF7ToolStripMenuItem_Click(object sender, EventArgs e)
|
private void KonvertierenF7ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//todo bildpfad übergeben an konverter-fenster
|
Konverter k = new Konverter(pictureBoxImage.ImageLocation);
|
||||||
//todo wenn konverter true zurückgibt, altes bild löschen und neues bild einfügen (auch in die bilderliste)
|
DialogResult res = k.ShowDialog();
|
||||||
|
switch (res)
|
||||||
|
{
|
||||||
|
case DialogResult.OK:
|
||||||
|
string del = pictureBoxImage.ImageLocation;
|
||||||
|
images[imageIndex] = k.newFilePath;
|
||||||
|
LoadPicture(imageIndex);
|
||||||
|
FileSystem.DeleteFile(del, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin, UICancelOption.DoNothing);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user