From 756256f03cc0f62164bf3f29c9a68b29dad6b553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Thu, 10 Dec 2020 23:42:03 +0100 Subject: [PATCH] =?UTF-8?q?Inf=C3=B6rt=20lista?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WindowsFormsCore/Form1.Designer.cs | 119 +++++++++++++++++ WindowsFormsCore/Form1.cs | 76 ++++++++++- WindowsFormsCore/Form1.resx | 124 ++++++++++++++++++ .../Properties/Resources.Designer.cs | 73 +++++++++++ WindowsFormsCore/Properties/Resources.resx | 124 ++++++++++++++++++ .../Resources/ASX_Download_grey_16x.png | Bin 0 -> 205 bytes WindowsFormsCore/WindowsFormsCore.csproj | 15 +++ 7 files changed, 530 insertions(+), 1 deletion(-) create mode 100644 WindowsFormsCore/Properties/Resources.Designer.cs create mode 100644 WindowsFormsCore/Properties/Resources.resx create mode 100644 WindowsFormsCore/Resources/ASX_Download_grey_16x.png diff --git a/WindowsFormsCore/Form1.Designer.cs b/WindowsFormsCore/Form1.Designer.cs index 32be8b9..c6ca86b 100644 --- a/WindowsFormsCore/Form1.Designer.cs +++ b/WindowsFormsCore/Form1.Designer.cs @@ -29,6 +29,7 @@ namespace WindowsFormsCore /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.btnGenMotNr = new System.Windows.Forms.Button(); this.btnGenerate = new System.Windows.Forms.Button(); this.txtNr1 = new System.Windows.Forms.TextBox(); @@ -86,6 +87,16 @@ namespace WindowsFormsCore this.chk02 = new System.Windows.Forms.CheckBox(); this.chk01 = new System.Windows.Forms.CheckBox(); this.btnClear = new System.Windows.Forms.Button(); + this.lvRows = new System.Windows.Forms.ListView(); + this.colNum1 = new System.Windows.Forms.ColumnHeader(); + this.colNum2 = new System.Windows.Forms.ColumnHeader(); + this.colNum3 = new System.Windows.Forms.ColumnHeader(); + this.colNum4 = new System.Windows.Forms.ColumnHeader(); + this.colNum5 = new System.Windows.Forms.ColumnHeader(); + this.colNum6 = new System.Windows.Forms.ColumnHeader(); + this.colNum7 = new System.Windows.Forms.ColumnHeader(); + this.btnDwn = new System.Windows.Forms.Button(); + this.btnDown2 = new System.Windows.Forms.Button(); this.gpbInmata.SuspendLayout(); this.SuspendLayout(); // @@ -115,6 +126,8 @@ namespace WindowsFormsCore this.txtNr1.Name = "txtNr1"; this.txtNr1.Size = new System.Drawing.Size(39, 23); this.txtNr1.TabIndex = 2; + this.txtNr1.TextChanged += new System.EventHandler(this.Text_TextChanged); + this.txtNr1.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Text_TextChanged); // // txtNr2 // @@ -122,6 +135,7 @@ namespace WindowsFormsCore this.txtNr2.Name = "txtNr2"; this.txtNr2.Size = new System.Drawing.Size(39, 23); this.txtNr2.TabIndex = 3; + this.txtNr2.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr3 // @@ -129,6 +143,7 @@ namespace WindowsFormsCore this.txtNr3.Name = "txtNr3"; this.txtNr3.Size = new System.Drawing.Size(39, 23); this.txtNr3.TabIndex = 4; + this.txtNr3.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr4 // @@ -136,6 +151,7 @@ namespace WindowsFormsCore this.txtNr4.Name = "txtNr4"; this.txtNr4.Size = new System.Drawing.Size(39, 23); this.txtNr4.TabIndex = 5; + this.txtNr4.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr5 // @@ -143,6 +159,7 @@ namespace WindowsFormsCore this.txtNr5.Name = "txtNr5"; this.txtNr5.Size = new System.Drawing.Size(39, 23); this.txtNr5.TabIndex = 6; + this.txtNr5.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr6 // @@ -150,6 +167,7 @@ namespace WindowsFormsCore this.txtNr6.Name = "txtNr6"; this.txtNr6.Size = new System.Drawing.Size(39, 23); this.txtNr6.TabIndex = 7; + this.txtNr6.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr7 // @@ -157,6 +175,7 @@ namespace WindowsFormsCore this.txtNr7.Name = "txtNr7"; this.txtNr7.Size = new System.Drawing.Size(39, 23); this.txtNr7.TabIndex = 8; + this.txtNr7.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr27 // @@ -164,6 +183,7 @@ namespace WindowsFormsCore this.txtNr27.Name = "txtNr27"; this.txtNr27.Size = new System.Drawing.Size(39, 23); this.txtNr27.TabIndex = 15; + this.txtNr27.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr26 // @@ -171,6 +191,7 @@ namespace WindowsFormsCore this.txtNr26.Name = "txtNr26"; this.txtNr26.Size = new System.Drawing.Size(39, 23); this.txtNr26.TabIndex = 14; + this.txtNr26.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr25 // @@ -178,6 +199,7 @@ namespace WindowsFormsCore this.txtNr25.Name = "txtNr25"; this.txtNr25.Size = new System.Drawing.Size(39, 23); this.txtNr25.TabIndex = 13; + this.txtNr25.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr24 // @@ -185,6 +207,7 @@ namespace WindowsFormsCore this.txtNr24.Name = "txtNr24"; this.txtNr24.Size = new System.Drawing.Size(39, 23); this.txtNr24.TabIndex = 12; + this.txtNr24.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr23 // @@ -192,6 +215,7 @@ namespace WindowsFormsCore this.txtNr23.Name = "txtNr23"; this.txtNr23.Size = new System.Drawing.Size(39, 23); this.txtNr23.TabIndex = 11; + this.txtNr23.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr22 // @@ -199,6 +223,7 @@ namespace WindowsFormsCore this.txtNr22.Name = "txtNr22"; this.txtNr22.Size = new System.Drawing.Size(39, 23); this.txtNr22.TabIndex = 10; + this.txtNr22.TextChanged += new System.EventHandler(this.Text_TextChanged); // // txtNr21 // @@ -206,6 +231,7 @@ namespace WindowsFormsCore this.txtNr21.Name = "txtNr21"; this.txtNr21.Size = new System.Drawing.Size(39, 23); this.txtNr21.TabIndex = 9; + this.txtNr21.TextChanged += new System.EventHandler(this.Text_TextChanged); // // btnTest // @@ -680,11 +706,94 @@ namespace WindowsFormsCore this.btnClear.UseVisualStyleBackColor = true; this.btnClear.Click += new System.EventHandler(this.btnClear_Click); // + // lvRows + // + this.lvRows.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.colNum1, + this.colNum2, + this.colNum3, + this.colNum4, + this.colNum5, + this.colNum6, + this.colNum7}); + this.lvRows.HideSelection = false; + this.lvRows.Location = new System.Drawing.Point(191, 114); + this.lvRows.Name = "lvRows"; + this.lvRows.Size = new System.Drawing.Size(306, 176); + this.lvRows.TabIndex = 23; + this.lvRows.UseCompatibleStateImageBehavior = false; + this.lvRows.View = System.Windows.Forms.View.Details; + // + // colNum1 + // + this.colNum1.Name = "colNum1"; + this.colNum1.Text = "Nr 1"; + this.colNum1.Width = 43; + // + // colNum2 + // + this.colNum2.Name = "colNum2"; + this.colNum2.Text = "Nr 2"; + this.colNum2.Width = 43; + // + // colNum3 + // + this.colNum3.Name = "colNum3"; + this.colNum3.Text = "Nr 3"; + this.colNum3.Width = 43; + // + // colNum4 + // + this.colNum4.Name = "colNum4"; + this.colNum4.Text = "Nr 4"; + this.colNum4.Width = 43; + // + // colNum5 + // + this.colNum5.Name = "colNum5"; + this.colNum5.Text = "Nr 5"; + this.colNum5.Width = 43; + // + // colNum6 + // + this.colNum6.Name = "colNum6"; + this.colNum6.Text = "Nr 6"; + this.colNum6.Width = 43; + // + // colNum7 + // + this.colNum7.Name = "colNum7"; + this.colNum7.Text = "Nr 7"; + this.colNum7.Width = 43; + // + // btnDwn + // + this.btnDwn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnDwn.BackgroundImage"))); + this.btnDwn.Location = new System.Drawing.Point(141, 41); + this.btnDwn.Name = "btnDwn"; + this.btnDwn.Size = new System.Drawing.Size(22, 23); + this.btnDwn.TabIndex = 24; + this.btnDwn.UseVisualStyleBackColor = true; + this.btnDwn.Click += new System.EventHandler(this.btnDwn_Click); + // + // btnDown2 + // + this.btnDown2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnDown2.BackgroundImage"))); + this.btnDown2.Location = new System.Drawing.Point(141, 70); + this.btnDown2.Name = "btnDown2"; + this.btnDown2.Size = new System.Drawing.Size(22, 23); + this.btnDown2.TabIndex = 25; + this.btnDown2.UseVisualStyleBackColor = true; + this.btnDown2.Click += new System.EventHandler(this.btnDown2_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.btnDown2); + this.Controls.Add(this.btnDwn); + this.Controls.Add(this.lvRows); this.Controls.Add(this.btnClear); this.Controls.Add(this.gpbInmata); this.Controls.Add(this.lblIndicator); @@ -776,6 +885,16 @@ namespace WindowsFormsCore private System.Windows.Forms.CheckBox chk02; private System.Windows.Forms.CheckBox chk01; private System.Windows.Forms.Button btnClear; + private System.Windows.Forms.ListView lvRows; + private System.Windows.Forms.ColumnHeader colNum1; + private System.Windows.Forms.ColumnHeader colNum2; + private System.Windows.Forms.ColumnHeader colNum3; + private System.Windows.Forms.ColumnHeader colNum4; + private System.Windows.Forms.ColumnHeader colNum5; + private System.Windows.Forms.ColumnHeader colNum6; + private System.Windows.Forms.ColumnHeader colNum7; + private System.Windows.Forms.Button btnDwn; + private System.Windows.Forms.Button btnDown2; } } diff --git a/WindowsFormsCore/Form1.cs b/WindowsFormsCore/Form1.cs index 5e7680d..87c9755 100644 --- a/WindowsFormsCore/Form1.cs +++ b/WindowsFormsCore/Form1.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; +using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -65,7 +66,7 @@ namespace WindowsFormsCore InitializeComponent(); lotto = new Lotto(rnd); ClearChks(); - for(int i = 0; i < txtBGrp1.Count(); i++) + for (int i = 0; i < txtBGrp1.Count(); i++) { txtBGrp1[i] = (TextBox)this.Controls["txtNr" + (i + 1).ToString()]; txtBGrp2[i] = (TextBox)this.Controls["txtNr2" + (i + 1).ToString()]; @@ -81,6 +82,7 @@ namespace WindowsFormsCore txtBGrp1[i].Text = ansver[i]; } + } private string randomNum() @@ -169,5 +171,77 @@ namespace WindowsFormsCore ClearChks(); gpbInmata.Refresh(); } + + private void Text_TextChanged(object sender, EventArgs e) + { + var n = 0; + var nochange = false; + if (!int.TryParse(((TextBox)sender).Text, out n)) + { + if (nochange) + { + nochange = false; + return; + } + var lngd = ((TextBox)sender).Text.Length; + if (lngd > 1) + { + var repl = ((TextBox)sender).Text.Substring(0, lngd - 1); + ((TextBox)sender).Text = repl; + ((TextBox)sender).SelectionStart = lngd-1; + ((TextBox)sender).SelectionLength = 0; + } + else ((TextBox)sender).Text = string.Empty; + nochange = true; + } + } + + private void Text_TextChanged(object sender, KeyEventArgs e) + { + var n = 0; + if (!int.TryParse(((TextBox)sender).Text, out n)) + { + var lngd = ((TextBox)sender).Text.Length; + ((TextBox)sender).Text = ((TextBox)sender).Text.Substring(0, lngd - 1); + } + + } + + private void AddNumbersToList1() + { + if(txtBGrp1.Any(tx => tx.Text.Length == 0)) + { + return; + } + ListViewItem lvRow = new ListViewItem(txtBGrp1[0].Text); + for(int i = 1; i < txtBGrp1.Length;i++) + { + lvRow.SubItems.Add(txtBGrp1[i].Text); + } + lvRows.Items.Add(lvRow); + } + private void AddNumbersToList2() + { + if (txtBGrp2.Any(tx => tx.Text.Length == 0)) + { + return; + } + ListViewItem lvRow = new ListViewItem(txtBGrp2[0].Text); + for (int i = 1; i < txtBGrp2.Length; i++) + { + lvRow.SubItems.Add(txtBGrp2[i].Text); + } + lvRows.Items.Add(lvRow); + } + + private void btnDwn_Click(object sender, EventArgs e) + { + AddNumbersToList1(); + } + + private void btnDown2_Click(object sender, EventArgs e) + { + AddNumbersToList2(); + } } } diff --git a/WindowsFormsCore/Form1.resx b/WindowsFormsCore/Form1.resx index 8b80193..d9b3221 100644 --- a/WindowsFormsCore/Form1.resx +++ b/WindowsFormsCore/Form1.resx @@ -225,6 +225,130 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wgAADsIBFShKgAAAALxJREFUOE/dkbENwkAMRTMKIyClzxpp2SALZICsQINSI6VFikTDCBEVPQOkutbc + O8mRLxgEoqN4cuz7/zUpROQn3OM3uEcIIYiyfrO4R6BY7st/EsS5se9KtsRQTyGyZapA90hv85CVp/sk + 3aUjOFMwgrk5NcI7uVcCGW9jKrXnNhVVwF4dKhXEuC9IkuE6pGJ9rBeZLZN7J8gksC6DKwANEEbilcF2 + sgVMUP8I0y3D0wFMYWe+3ax7/BwpHj+xC45fZcSfAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wgAADsIBFShKgAAAALxJREFUOE/dkbENwkAMRTMKIyClzxpp2SALZICsQINSI6VFikTDCBEVPQOkutbc + O8mRLxgEoqN4cuz7/zUpROQn3OM3uEcIIYiyfrO4R6BY7st/EsS5se9KtsRQTyGyZapA90hv85CVp/sk + 3aUjOFMwgrk5NcI7uVcCGW9jKrXnNhVVwF4dKhXEuC9IkuE6pGJ9rBeZLZN7J8gksC6DKwANEEbilcF2 + sgVMUP8I0y3D0wFMYWe+3ax7/BwpHj+xC45fZcSfAAAAAElFTkSuQmCC + + True diff --git a/WindowsFormsCore/Properties/Resources.Designer.cs b/WindowsFormsCore/Properties/Resources.Designer.cs new file mode 100644 index 0000000..42f1c15 --- /dev/null +++ b/WindowsFormsCore/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsCore.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsCore.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ASX_Download_grey_16x { + get { + object obj = ResourceManager.GetObject("ASX_Download_grey_16x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/WindowsFormsCore/Properties/Resources.resx b/WindowsFormsCore/Properties/Resources.resx new file mode 100644 index 0000000..d93be1c --- /dev/null +++ b/WindowsFormsCore/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\ASX_Download_grey_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/WindowsFormsCore/Resources/ASX_Download_grey_16x.png b/WindowsFormsCore/Resources/ASX_Download_grey_16x.png new file mode 100644 index 0000000000000000000000000000000000000000..a6ceb23368a77b1a97dc9a4148b068401191a45b GIT binary patch literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5M?jcysy3fAP_W+9 z#WAEJ?(M{bybT6C%*;uGW{E6r4T46V?i$htOgUnggie0=xZGxA$j`w0D}$_!CoeN- zTqX7J)yt*2^SSC8SNVw?$gAUKkiW;>{J5^)mPK>vWindowsFormsCore.Program + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file