From f83ec8cfcd23526e94562a526cd6ae8fabda8f40 Mon Sep 17 00:00:00 2001 From: HuskyTeufel Date: Fri, 27 Mar 2020 13:23:10 +0100 Subject: [PATCH] Berichtworker angefangen --- BerichtGen/BerichtGen.csproj | 1 + BerichtGen/BerichtWorker.cs | 36 +++++++++++++++++++++++++++++++++ SanShared/BerichtWorker.cs | 13 ++++++++++++ SanShared/SanShared.csproj | 1 + SanSystem/UCSchachtanbindung.cs | 1 + 5 files changed, 52 insertions(+) create mode 100644 BerichtGen/BerichtWorker.cs create mode 100644 SanShared/BerichtWorker.cs diff --git a/BerichtGen/BerichtGen.csproj b/BerichtGen/BerichtGen.csproj index 794e65c..fcb3f2f 100644 --- a/BerichtGen/BerichtGen.csproj +++ b/BerichtGen/BerichtGen.csproj @@ -84,6 +84,7 @@ + Form diff --git a/BerichtGen/BerichtWorker.cs b/BerichtGen/BerichtWorker.cs new file mode 100644 index 0000000..19d684e --- /dev/null +++ b/BerichtGen/BerichtWorker.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BerichtGen +{ + public class BerichtWorker + { + public static Image resizeImage(Image imgToResize, Size size) + { + int width = imgToResize.Width; + int height = imgToResize.Height; + float scale = 0f; + float newWidth = 0f; + float newHeight = 0f; + + newWidth = (float)size.Width / (float)width; + newHeight = (float)size.Height / (float)height; + + scale = ((!(newHeight < newWidth)) ? newWidth : newHeight); + int width2 = (int)((float)width * scale); + int height2 = (int)((float)height * scale); + + Bitmap bitmap = new Bitmap(width2, height2); + Graphics graphics = Graphics.FromImage(bitmap); + graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; + graphics.DrawImage(imgToResize, 0, 0, width2, height2); + graphics.Dispose(); + return bitmap; + } + } +} diff --git a/SanShared/BerichtWorker.cs b/SanShared/BerichtWorker.cs new file mode 100644 index 0000000..beaa392 --- /dev/null +++ b/SanShared/BerichtWorker.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SanShared +{ + public class BerichtWorker + { + + } +} diff --git a/SanShared/SanShared.csproj b/SanShared/SanShared.csproj index 1184eb5..eb24725 100644 --- a/SanShared/SanShared.csproj +++ b/SanShared/SanShared.csproj @@ -43,6 +43,7 @@ + diff --git a/SanSystem/UCSchachtanbindung.cs b/SanSystem/UCSchachtanbindung.cs index 4cf0bb1..80fe06b 100644 --- a/SanSystem/UCSchachtanbindung.cs +++ b/SanSystem/UCSchachtanbindung.cs @@ -127,6 +127,7 @@ namespace SanSystem return; } pt_box.Load(pfad); + pt_box.SizeMode = PictureBoxSizeMode.StretchImage; } }