diff --git a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/.suo b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/.suo index 1419148..72ae9f2 100644 Binary files a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/.suo and b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/.suo differ diff --git a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide index 1098982..b07ce20 100644 Binary files a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide and b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide differ diff --git a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide-shm b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide-shm new file mode 100644 index 0000000..a25b69c Binary files /dev/null and b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide-shm differ diff --git a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide-wal b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide-wal new file mode 100644 index 0000000..c423a21 Binary files /dev/null and b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide-wal differ diff --git a/WindowsFormsApp01/ClassLibrary01/Class1.cs b/WindowsFormsApp01/ClassLibrary01/Class1.cs index 437d6b3..0d0f9be 100644 --- a/WindowsFormsApp01/ClassLibrary01/Class1.cs +++ b/WindowsFormsApp01/ClassLibrary01/Class1.cs @@ -1,14 +1,21 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassLibrary01 { - public class Class1 + public class Class1 :IDisposable { + + public void DoIt() + { + var foo = SingeltonPattern.GetInstance(); + } + public int Add(int i1, int i2 = 10) { return i1 + i2; @@ -19,5 +26,20 @@ namespace ClassLibrary01 return Add(i1, 10); } + private Pen _pen; + + public void Dispose() + { + _pen.Dispose(); + } + + + public Pen getPen() + { + + _pen = new Pen(Color.Black, 2); + + return _pen; + } } } diff --git a/WindowsFormsApp01/ClassLibrary01/ClassLibrary01.csproj b/WindowsFormsApp01/ClassLibrary01/ClassLibrary01.csproj index 8235f2c..c15cbb7 100644 --- a/WindowsFormsApp01/ClassLibrary01/ClassLibrary01.csproj +++ b/WindowsFormsApp01/ClassLibrary01/ClassLibrary01.csproj @@ -1,10 +1,10 @@ - + Debug AnyCPU - 4859a826-18e2-4c0c-a441-f77975e70e93 + {4859A826-18E2-4C0C-A441-F77975E70E93} Library Properties ClassLibrary01 @@ -31,24 +31,20 @@ 4 - - - - - - - - - - - - - - + + + + + + + + + + - + \ No newline at end of file diff --git a/WindowsFormsApp01/ClassLibrary01/CodeFile1.cs b/WindowsFormsApp01/ClassLibrary01/CodeFile1.cs new file mode 100644 index 0000000..c4cbec8 --- /dev/null +++ b/WindowsFormsApp01/ClassLibrary01/CodeFile1.cs @@ -0,0 +1,33 @@ + +using System.Runtime.CompilerServices; + +public class SingeltonPattern +{ + + + + private static SingeltonPattern _singelton; + + + private SingeltonPattern() + { + + } + + + public static SingeltonPattern GetInstance() + { + if (_singelton == null) + { + _singelton = new SingeltonPattern(); + } + + return _singelton; + + } + + +} + + + diff --git a/WindowsFormsApp01/ClassLibrary01/bin/Debug/ClassLibrary01.dll b/WindowsFormsApp01/ClassLibrary01/bin/Debug/ClassLibrary01.dll index 6be3f2d..969150b 100644 Binary files a/WindowsFormsApp01/ClassLibrary01/bin/Debug/ClassLibrary01.dll and b/WindowsFormsApp01/ClassLibrary01/bin/Debug/ClassLibrary01.dll differ diff --git a/WindowsFormsApp01/ClassLibrary01/bin/Debug/ClassLibrary01.pdb b/WindowsFormsApp01/ClassLibrary01/bin/Debug/ClassLibrary01.pdb index 3264a37..dac59ad 100644 Binary files a/WindowsFormsApp01/ClassLibrary01/bin/Debug/ClassLibrary01.pdb and b/WindowsFormsApp01/ClassLibrary01/bin/Debug/ClassLibrary01.pdb differ diff --git a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csproj.CoreCompileInputs.cache b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csproj.CoreCompileInputs.cache index 1c27aec..93299c8 100644 --- a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csproj.CoreCompileInputs.cache +++ b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -69d79abfd67c28b98a7f19e87fceac8121786190 +165664fdbdaecd0156134d10b5983b1832f42627 diff --git a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csproj.FileListAbsolute.txt b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csproj.FileListAbsolute.txt index 474db40..45533e5 100644 --- a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csproj.FileListAbsolute.txt +++ b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csproj.FileListAbsolute.txt @@ -4,3 +4,9 @@ C:\Users\root\source\repos\WindowsFormsApp01\ClassLibrary01\obj\Debug\ClassLibra C:\Users\root\source\repos\WindowsFormsApp01\ClassLibrary01\obj\Debug\ClassLibrary01.csproj.CoreCompileInputs.cache C:\Users\root\source\repos\WindowsFormsApp01\ClassLibrary01\obj\Debug\ClassLibrary01.dll C:\Users\root\source\repos\WindowsFormsApp01\ClassLibrary01\obj\Debug\ClassLibrary01.pdb +C:\Users\root\source\SoftwareEngineering2\WindowsFormsApp01\ClassLibrary01\bin\Debug\ClassLibrary01.dll +C:\Users\root\source\SoftwareEngineering2\WindowsFormsApp01\ClassLibrary01\bin\Debug\ClassLibrary01.pdb +C:\Users\root\source\SoftwareEngineering2\WindowsFormsApp01\ClassLibrary01\obj\Debug\ClassLibrary01.csprojAssemblyReference.cache +C:\Users\root\source\SoftwareEngineering2\WindowsFormsApp01\ClassLibrary01\obj\Debug\ClassLibrary01.csproj.CoreCompileInputs.cache +C:\Users\root\source\SoftwareEngineering2\WindowsFormsApp01\ClassLibrary01\obj\Debug\ClassLibrary01.dll +C:\Users\root\source\SoftwareEngineering2\WindowsFormsApp01\ClassLibrary01\obj\Debug\ClassLibrary01.pdb diff --git a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csprojAssemblyReference.cache b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csprojAssemblyReference.cache index 24df8ab..271e57d 100644 Binary files a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csprojAssemblyReference.cache and b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.csprojAssemblyReference.cache differ diff --git a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.dll b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.dll index 6be3f2d..969150b 100644 Binary files a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.dll and b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.dll differ diff --git a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.pdb b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.pdb index 3264a37..dac59ad 100644 Binary files a/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.pdb and b/WindowsFormsApp01/ClassLibrary01/obj/Debug/ClassLibrary01.pdb differ diff --git a/WindowsFormsApp01/ClassLibrary01/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/WindowsFormsApp01/ClassLibrary01/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 0e4acc5..71be825 100644 Binary files a/WindowsFormsApp01/ClassLibrary01/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/WindowsFormsApp01/ClassLibrary01/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/Form1.Designer.cs b/WindowsFormsApp01/WindowsFormsApp01/Form1.Designer.cs index 42f0518..e3b14ff 100644 --- a/WindowsFormsApp01/WindowsFormsApp01/Form1.Designer.cs +++ b/WindowsFormsApp01/WindowsFormsApp01/Form1.Designer.cs @@ -34,6 +34,10 @@ this.label1 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.trackBar1 = new System.Windows.Forms.TrackBar(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); @@ -76,11 +80,16 @@ // // panel1 // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.panel1.BackColor = System.Drawing.Color.DimGray; this.panel1.Location = new System.Drawing.Point(264, 125); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(512, 256); this.panel1.TabIndex = 4; + this.panel1.AutoSizeChanged += new System.EventHandler(this.Panel1_AutoSizeChanged); this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.Panel1_Paint); // // trackBar1 @@ -95,13 +104,55 @@ this.trackBar1.Value = 1; this.trackBar1.Scroll += new System.EventHandler(this.TrackBar1_Scroll); // + // button2 + // + this.button2.Location = new System.Drawing.Point(24, 246); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 6; + this.button2.Text = "cat_slow"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.Button2_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(152, 246); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(75, 23); + this.button3.TabIndex = 7; + this.button3.Text = "cat_fast"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.Button3_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(170, 299); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(35, 13); + this.label2.TabIndex = 8; + this.label2.Text = "label2"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(43, 299); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(35, 13); + this.label3.TabIndex = 9; + this.label3.Text = "label3"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSize = true; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.BackColor = System.Drawing.SystemColors.ActiveCaptionText; this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); this.Controls.Add(this.trackBar1); this.Controls.Add(this.panel1); this.Controls.Add(this.label1); @@ -112,6 +163,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); + this.Resize += new System.EventHandler(this.Form1_Resize); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit(); @@ -128,6 +180,10 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.TrackBar trackBar1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; } } diff --git a/WindowsFormsApp01/WindowsFormsApp01/Form1.cs b/WindowsFormsApp01/WindowsFormsApp01/Form1.cs index ff8ff7d..3d1d323 100644 --- a/WindowsFormsApp01/WindowsFormsApp01/Form1.cs +++ b/WindowsFormsApp01/WindowsFormsApp01/Form1.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Diagnostics; using System.Drawing; using System.Linq; using System.Text; @@ -16,6 +17,8 @@ namespace WindowsFormsApp01 private int _number; private int _scale = 1; + private int _x; + private int _y; public int Number { @@ -68,31 +71,47 @@ namespace WindowsFormsApp01 label1.Text = "Ergebnis: " + res.ToString(); } + + + + + + + + + + + + + private void Panel1_Paint(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; - + Pen _pen = new ClassLibrary01.Class1().getPen(); + + using (var p = _pen) + { //y axis - graphics.DrawLine(new Pen(Color.Black), 10, 10, 10, 246); + graphics.DrawLine(p, 10, 10, 10, 246); //x axis - graphics.DrawLine(new Pen(Color.Black), 10, 246, 502, 246); + graphics.DrawLine(p, 10, 246, 502, 246); //arrow y axis - graphics.DrawLine(new Pen(Color.Black), 5, 15, 10, 10); - graphics.DrawLine(new Pen(Color.Black), 15, 15, 10, 10); + graphics.DrawLine(p, 5, 15, 10, 10); + graphics.DrawLine(p, 15, 15, 10, 10); //arrow x axis - graphics.DrawLine(new Pen(Color.Black), 498, 241, 502, 246); - graphics.DrawLine(new Pen(Color.Black), 498, 251, 502, 246); - + graphics.DrawLine(p, 498, 241, 502, 246); + graphics.DrawLine(p, 498, 251, 502, 246); + } Brush aBrush = (Brush) Brushes.Red; - for (int i = 10; i < 502; i++) + for (int i = 10; i < (502 ); i++) { int y = (int)( 246 - (((Math.Log(i) * 10) - 23) *_scale ) ); @@ -116,6 +135,69 @@ namespace WindowsFormsApp01 panel1.Refresh(); } - + private void Panel1_AutoSizeChanged(object sender, EventArgs e) + { + + + + } + + private void Form1_Resize(object sender, EventArgs e) + { + + _x = panel1.Width; + _y = panel1.Height; + panel1.Invalidate(); + } + + private void Button2_Click(object sender, EventArgs e) + { + string s1 = "hello"; + + string s2 = "Offenburg"; + + string s3 = String.Empty; + + Stopwatch sw = new Stopwatch(); + + sw.Start(); + + for (int i = 0; i < 50000; i++) + { + s3 = s3 + s1 + s2; + } + + sw.Stop(); + + label3.Text = sw.ElapsedMilliseconds.ToString(); + + } + + private void Button3_Click(object sender, EventArgs e) + { + + string s1 = "hello"; + + string s2 = "Offenburg"; + + string s3 = String.Empty; + + Stopwatch sw = new Stopwatch(); + var sb = new StringBuilder(); + + sw.Start(); + + for (int i = 0; i < 50000; i++) + { + //s3 = s3 + s1 + s2; + + sb.Append(s1); + sb.Append(s2); + } + + sw.Stop(); + + label2.Text = sw.ElapsedMilliseconds.ToString(); + } } } \ No newline at end of file diff --git a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/ClassLibrary01.dll b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/ClassLibrary01.dll index 6be3f2d..969150b 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/ClassLibrary01.dll and b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/ClassLibrary01.dll differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/ClassLibrary01.pdb b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/ClassLibrary01.pdb index 3264a37..dac59ad 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/ClassLibrary01.pdb and b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/ClassLibrary01.pdb differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.exe b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.exe index 0369eac..fc2c1ae 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.exe and b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.exe differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.pdb b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.pdb index 98901d6..aa259c4 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.pdb and b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.pdb differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csproj.GenerateResource.cache b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csproj.GenerateResource.cache index d7b0d11..9b488d3 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csproj.GenerateResource.cache and b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csproj.GenerateResource.cache differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csprojAssemblyReference.cache b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csprojAssemblyReference.cache index ff692cf..cae45a8 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csprojAssemblyReference.cache and b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csprojAssemblyReference.cache differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.exe b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.exe index 0369eac..fc2c1ae 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.exe and b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.exe differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.pdb b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.pdb index 98901d6..aa259c4 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.pdb and b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.pdb differ