From ea3b8c564a516ae8c70b278f7ec092594b651cab Mon Sep 17 00:00:00 2001 From: Husky Date: Sat, 21 Jul 2018 08:11:15 +0200 Subject: [PATCH] Bilder werden jetzt richtig geladen --- SanSystem/UCSchachtanbindung.Designer.cs | 49 +++++++++++++++--------- SanSystem/UCSchachtanbindung.cs | 18 ++++++++- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/SanSystem/UCSchachtanbindung.Designer.cs b/SanSystem/UCSchachtanbindung.Designer.cs index c168eb0..1623064 100644 --- a/SanSystem/UCSchachtanbindung.Designer.cs +++ b/SanSystem/UCSchachtanbindung.Designer.cs @@ -47,34 +47,38 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(9, 18); + this.label1.Location = new System.Drawing.Point(12, 22); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(126, 20); + this.label1.Size = new System.Drawing.Size(155, 25); this.label1.TabIndex = 0; this.label1.Text = "Schachtnummer"; // // txt_schachtnummer // this.txt_schachtnummer.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txt_schachtnummer.Location = new System.Drawing.Point(141, 15); + this.txt_schachtnummer.Location = new System.Drawing.Point(188, 18); + this.txt_schachtnummer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txt_schachtnummer.Name = "txt_schachtnummer"; - this.txt_schachtnummer.Size = new System.Drawing.Size(157, 26); + this.txt_schachtnummer.Size = new System.Drawing.Size(208, 30); this.txt_schachtnummer.TabIndex = 1; // // pt_box // - this.pt_box.Location = new System.Drawing.Point(13, 47); + this.pt_box.Location = new System.Drawing.Point(17, 58); + this.pt_box.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.pt_box.Name = "pt_box"; - this.pt_box.Size = new System.Drawing.Size(600, 326); + this.pt_box.Size = new System.Drawing.Size(800, 401); this.pt_box.TabIndex = 2; this.pt_box.TabStop = false; // // btn_add_bild // this.btn_add_bild.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btn_add_bild.Location = new System.Drawing.Point(628, 197); + this.btn_add_bild.Location = new System.Drawing.Point(837, 242); + this.btn_add_bild.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btn_add_bild.Name = "btn_add_bild"; - this.btn_add_bild.Size = new System.Drawing.Size(73, 176); + this.btn_add_bild.Size = new System.Drawing.Size(97, 217); this.btn_add_bild.TabIndex = 3; this.btn_add_bild.Text = "Bild Laden"; this.btn_add_bild.UseVisualStyleBackColor = true; @@ -83,30 +87,34 @@ // lb_pictures // this.lb_pictures.FormattingEnabled = true; - this.lb_pictures.Location = new System.Drawing.Point(620, 47); + this.lb_pictures.ItemHeight = 16; + this.lb_pictures.Location = new System.Drawing.Point(827, 58); + this.lb_pictures.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.lb_pictures.Name = "lb_pictures"; - this.lb_pictures.Size = new System.Drawing.Size(81, 147); + this.lb_pictures.Size = new System.Drawing.Size(107, 180); this.lb_pictures.TabIndex = 4; + this.lb_pictures.SelectedIndexChanged += new System.EventHandler(this.lb_pictures_SelectedIndexChanged); this.lb_pictures.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lb_pictures_MouseDown); // // contextMenuStrip1 // + this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.bearbeitenToolStripMenuItem, this.löschenToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(131, 48); + this.contextMenuStrip1.Size = new System.Drawing.Size(151, 52); // // bearbeitenToolStripMenuItem // this.bearbeitenToolStripMenuItem.Name = "bearbeitenToolStripMenuItem"; - this.bearbeitenToolStripMenuItem.Size = new System.Drawing.Size(130, 22); + this.bearbeitenToolStripMenuItem.Size = new System.Drawing.Size(150, 24); this.bearbeitenToolStripMenuItem.Text = "Bearbeiten"; // // löschenToolStripMenuItem // this.löschenToolStripMenuItem.Name = "löschenToolStripMenuItem"; - this.löschenToolStripMenuItem.Size = new System.Drawing.Size(130, 22); + this.löschenToolStripMenuItem.Size = new System.Drawing.Size(150, 24); this.löschenToolStripMenuItem.Text = "Löschen"; this.löschenToolStripMenuItem.Click += new System.EventHandler(this.löschenToolStripMenuItem_Click); // @@ -114,9 +122,10 @@ // this.cb_erledigt.AutoSize = true; this.cb_erledigt.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cb_erledigt.Location = new System.Drawing.Point(304, 14); + this.cb_erledigt.Location = new System.Drawing.Point(405, 17); + this.cb_erledigt.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.cb_erledigt.Name = "cb_erledigt"; - this.cb_erledigt.Size = new System.Drawing.Size(93, 28); + this.cb_erledigt.Size = new System.Drawing.Size(119, 33); this.cb_erledigt.TabIndex = 6; this.cb_erledigt.Text = "Erledigt"; this.cb_erledigt.UseVisualStyleBackColor = true; @@ -125,14 +134,15 @@ // this.dt_datum.CalendarFont = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dt_datum.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.dt_datum.Location = new System.Drawing.Point(403, 15); + this.dt_datum.Location = new System.Drawing.Point(537, 18); + this.dt_datum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dt_datum.Name = "dt_datum"; - this.dt_datum.Size = new System.Drawing.Size(298, 26); + this.dt_datum.Size = new System.Drawing.Size(396, 30); this.dt_datum.TabIndex = 7; // // UCSchachtanbindung // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.dt_datum); this.Controls.Add(this.cb_erledigt); @@ -141,8 +151,9 @@ this.Controls.Add(this.pt_box); this.Controls.Add(this.txt_schachtnummer); this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "UCSchachtanbindung"; - this.Size = new System.Drawing.Size(712, 389); + this.Size = new System.Drawing.Size(949, 479); this.Load += new System.EventHandler(this.UCSchachtanbindung_Load); ((System.ComponentModel.ISupportInitialize)(this.pt_box)).EndInit(); this.contextMenuStrip1.ResumeLayout(false); diff --git a/SanSystem/UCSchachtanbindung.cs b/SanSystem/UCSchachtanbindung.cs index 5d48c17..a41c1ba 100644 --- a/SanSystem/UCSchachtanbindung.cs +++ b/SanSystem/UCSchachtanbindung.cs @@ -49,8 +49,7 @@ namespace SanSystem { //pt_box.Image = Image.FromFile(Path.Combine("temp",schacht.SavedBilders[0].Speicherpfad)); - pt_box.Load(Path.Combine(schacht.SavedBilders[0].Speicherpfad)); - pt_box.SizeMode = PictureBoxSizeMode.StretchImage; + } } @@ -110,5 +109,20 @@ namespace SanSystem } } + + private void lb_pictures_SelectedIndexChanged(object sender, EventArgs e) + { + ListBox listBox = (ListBox)sender; + if (listBox == null) return; + int index = listBox.SelectedIndex; + + string pfad = Path.Combine(schacht.SavedBilders[index].Speicherpfad); + if (!File.Exists(pfad)) + { + MessageBox.Show("Bilddatei mit den Pfad " + pfad + " nicht gefunden"); + } + pt_box.Load(pfad); + pt_box.SizeMode = PictureBoxSizeMode.StretchImage; + } } }