Berichtworker angefangen

This commit is contained in:
HuskyTeufel
2020-03-27 13:23:10 +01:00
parent a9320eb1f6
commit f83ec8cfcd
5 changed files with 52 additions and 0 deletions

View File

@@ -84,6 +84,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Bericht.cs" /> <Compile Include="Bericht.cs" />
<Compile Include="BerichtWorker.cs" />
<Compile Include="FrmOptions.cs"> <Compile Include="FrmOptions.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View File

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

View File

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

View File

@@ -43,6 +43,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BerichtWorker.cs" />
<Compile Include="BilderObject.cs" /> <Compile Include="BilderObject.cs" />
<Compile Include="Exceptions\CSVImportException.cs" /> <Compile Include="Exceptions\CSVImportException.cs" />
<Compile Include="Exceptions\DataBaseVersionMismatchException.cs" /> <Compile Include="Exceptions\DataBaseVersionMismatchException.cs" />

View File

@@ -127,6 +127,7 @@ namespace SanSystem
return; return;
} }
pt_box.Load(pfad); pt_box.Load(pfad);
pt_box.SizeMode = PictureBoxSizeMode.StretchImage; pt_box.SizeMode = PictureBoxSizeMode.StretchImage;
} }
} }