diff --git a/windowsforms/README.md b/windowsforms/README.md index 0782f8309d9..670b04fef23 100644 --- a/windowsforms/README.md +++ b/windowsforms/README.md @@ -13,6 +13,7 @@ If you're new to .NET Core, here are a few resources to help you understand the | Sample Name | Description | | ----------- | ----------- | | [Hello World - shared source](helloworld-sharedsource) | This sample shows you how to share source between a .NET Framework WinForms application and a .NET Core WinForms application. Use this to get the full .NET Framework tooling experience while still building for .NET Core. | +| [Matching Game](matching-game) | This sample demonstrates simple event handling and timers in a .NET Core 3 WinForms application | ## Getting Started diff --git a/windowsforms/matching-game/MatchingGame/Form1.Designer.cs b/windowsforms/matching-game/MatchingGame/Form1.Designer.cs new file mode 100644 index 00000000000..ffcfd0474be --- /dev/null +++ b/windowsforms/matching-game/MatchingGame/Form1.Designer.cs @@ -0,0 +1,321 @@ +namespace MatchingGame +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label16 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.BackColor = System.Drawing.Color.CornflowerBlue; + this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset; + this.tableLayoutPanel1.ColumnCount = 4; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.Controls.Add(this.label16, 3, 3); + this.tableLayoutPanel1.Controls.Add(this.label15, 2, 3); + this.tableLayoutPanel1.Controls.Add(this.label14, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.label13, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.label12, 3, 2); + this.tableLayoutPanel1.Controls.Add(this.label11, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.label10, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.label9, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.label8, 3, 1); + this.tableLayoutPanel1.Controls.Add(this.label7, 2, 1); + this.tableLayoutPanel1.Controls.Add(this.label6, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.label5, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.label4, 3, 0); + this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(534, 511); + this.tableLayoutPanel1.TabIndex = 0; + // + // label16 + // + this.label16.Dock = System.Windows.Forms.DockStyle.Fill; + this.label16.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label16.Location = new System.Drawing.Point(404, 383); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(125, 126); + this.label16.TabIndex = 15; + this.label16.Text = "c"; + this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label16.Click += new System.EventHandler(this.label_Click); + // + // label15 + // + this.label15.Dock = System.Windows.Forms.DockStyle.Fill; + this.label15.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label15.Location = new System.Drawing.Point(271, 383); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(125, 126); + this.label15.TabIndex = 14; + this.label15.Text = "c"; + this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label15.Click += new System.EventHandler(this.label_Click); + // + // label14 + // + this.label14.Dock = System.Windows.Forms.DockStyle.Fill; + this.label14.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label14.Location = new System.Drawing.Point(138, 383); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(125, 126); + this.label14.TabIndex = 13; + this.label14.Text = "c"; + this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label14.Click += new System.EventHandler(this.label_Click); + // + // label13 + // + this.label13.Dock = System.Windows.Forms.DockStyle.Fill; + this.label13.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label13.Location = new System.Drawing.Point(5, 383); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(125, 126); + this.label13.TabIndex = 12; + this.label13.Text = "c"; + this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label13.Click += new System.EventHandler(this.label_Click); + // + // label12 + // + this.label12.Dock = System.Windows.Forms.DockStyle.Fill; + this.label12.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label12.Location = new System.Drawing.Point(404, 256); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(125, 125); + this.label12.TabIndex = 11; + this.label12.Text = "c"; + this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label12.Click += new System.EventHandler(this.label_Click); + // + // label11 + // + this.label11.Dock = System.Windows.Forms.DockStyle.Fill; + this.label11.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label11.Location = new System.Drawing.Point(271, 256); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(125, 125); + this.label11.TabIndex = 10; + this.label11.Text = "c"; + this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label11.Click += new System.EventHandler(this.label_Click); + // + // label10 + // + this.label10.Dock = System.Windows.Forms.DockStyle.Fill; + this.label10.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label10.Location = new System.Drawing.Point(138, 256); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(125, 125); + this.label10.TabIndex = 9; + this.label10.Text = "c"; + this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label10.Click += new System.EventHandler(this.label_Click); + // + // label9 + // + this.label9.Dock = System.Windows.Forms.DockStyle.Fill; + this.label9.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label9.Location = new System.Drawing.Point(5, 256); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(125, 125); + this.label9.TabIndex = 8; + this.label9.Text = "c"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label9.Click += new System.EventHandler(this.label_Click); + // + // label8 + // + this.label8.Dock = System.Windows.Forms.DockStyle.Fill; + this.label8.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label8.Location = new System.Drawing.Point(404, 129); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(125, 125); + this.label8.TabIndex = 7; + this.label8.Text = "c"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label8.Click += new System.EventHandler(this.label_Click); + // + // label7 + // + this.label7.Dock = System.Windows.Forms.DockStyle.Fill; + this.label7.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label7.Location = new System.Drawing.Point(271, 129); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(125, 125); + this.label7.TabIndex = 6; + this.label7.Text = "c"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label7.Click += new System.EventHandler(this.label_Click); + // + // label6 + // + this.label6.Dock = System.Windows.Forms.DockStyle.Fill; + this.label6.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label6.Location = new System.Drawing.Point(138, 129); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(125, 125); + this.label6.TabIndex = 5; + this.label6.Text = "c"; + this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label6.Click += new System.EventHandler(this.label_Click); + // + // label5 + // + this.label5.Dock = System.Windows.Forms.DockStyle.Fill; + this.label5.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label5.Location = new System.Drawing.Point(5, 129); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(125, 125); + this.label5.TabIndex = 4; + this.label5.Text = "c"; + this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label5.Click += new System.EventHandler(this.label_Click); + // + // label4 + // + this.label4.Dock = System.Windows.Forms.DockStyle.Fill; + this.label4.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label4.Location = new System.Drawing.Point(404, 2); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(125, 125); + this.label4.TabIndex = 3; + this.label4.Text = "c"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label4.Click += new System.EventHandler(this.label_Click); + // + // label3 + // + this.label3.Dock = System.Windows.Forms.DockStyle.Fill; + this.label3.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label3.Location = new System.Drawing.Point(271, 2); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(125, 125); + this.label3.TabIndex = 2; + this.label3.Text = "c"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label3.Click += new System.EventHandler(this.label_Click); + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Fill; + this.label2.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label2.Location = new System.Drawing.Point(138, 2); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(125, 125); + this.label2.TabIndex = 1; + this.label2.Text = "c"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label2.Click += new System.EventHandler(this.label_Click); + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Font = new System.Drawing.Font("Webdings", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.label1.Location = new System.Drawing.Point(5, 2); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(125, 125); + this.label1.TabIndex = 0; + this.label1.Text = "c"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label1.Click += new System.EventHandler(this.label_Click); + // + // timer1 + // + this.timer1.Interval = 750; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(534, 511); + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "Form1"; + this.Text = "Matching Game"; + this.tableLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Timer timer1; + } +} + diff --git a/windowsforms/matching-game/MatchingGame/Form1.cs b/windowsforms/matching-game/MatchingGame/Form1.cs new file mode 100644 index 00000000000..c8f214403d5 --- /dev/null +++ b/windowsforms/matching-game/MatchingGame/Form1.cs @@ -0,0 +1,177 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; + +namespace MatchingGame +{ + public partial class Form1 : Form + { + // firstClicked points to the first Label control + // that the player clicks, but it will be null + // if the player hasn't clicked a label yet. + Label firstClicked = null; + + // secondClicked points to the second Label control + // that the player clicks. + Label secondClicked = null; + + // Use this Random object to choose random icons for the squares. + Random random = new Random(); + + // Each of these letters is an interesting icon + // in the Webdings font, + // and each icon appears twice in this list. + List icons = new List() + { + "!", "!", "N", "N", ",", ",", "k", "k", + "b", "b", "v", "v", "w", "w", "z", "z" + }; + + /// + /// Assign each icon from the list of icons to a random square + /// + private void AssignIconsToSquares() + { + // The TableLayoutPanel has 16 labels, + // and the icon list has 16 icons, + // so an icon is pulled at random from the list + // and added to each label. + foreach (Control control in tableLayoutPanel1.Controls) + { + Label iconLabel = control as Label; + if (iconLabel != null) + { + int randomNumber = random.Next(icons.Count); + iconLabel.Text = icons[randomNumber]; + iconLabel.ForeColor = iconLabel.BackColor; + icons.RemoveAt(randomNumber); + } + } + } + + + public Form1() + { + InitializeComponent(); + AssignIconsToSquares(); + } + + /// + /// Every label's Click event is handled by this event handler. + /// + /// The label that was clicked. + /// + private void label_Click(object sender, EventArgs e) + { + // The timer is only on after two non-matching + // icons have been shown to the player, + // so ignore any clicks if the timer is running + if (timer1.Enabled == true) + return; + + Label clickedLabel = sender as Label; + + if (clickedLabel != null) + { + // If the clicked label is black, the player clicked + // an icon that's already been revealed -- + // ignore the click. + if (clickedLabel.ForeColor == Color.Black) + // All done - leave the if statements. + return; + + // If firstClicked is null, this is the first icon + // in the pair that the player clicked, + // so set firstClicked to the label that the player + // clicked, change its color to black, and return. + if (firstClicked == null) + { + firstClicked = clickedLabel; + firstClicked.ForeColor = Color.Black; + + // All done - leave the if statements. + return; + } + + // If the player gets this far, the timer isn't + // running and firstClicked isn't null, + // so this must be the second icon the player clicked + // Set its color to black. + secondClicked = clickedLabel; + secondClicked.ForeColor = Color.Black; + + // Check to see if the player won. + CheckForWinner(); + + // If the player clicked two matching icons, keep them + // black and reset firstClicked and secondClicked + // so the player can click another icon. + if (firstClicked.Text == secondClicked.Text) + { + firstClicked = null; + secondClicked = null; + return; + } + + // If the player gets this far, the player + // clicked two different icons, so start the + // timer (which will wait three quarters of + // a second, and then hide the icons). + timer1.Start(); + } + } + + /// + /// This timer is started when the player clicks + /// two icons that don't match, + /// so it counts three quarters of a second + /// and then turns itself off and hides both icons. + /// + /// + /// + private void timer1_Tick(object sender, EventArgs e) + { + // Stop the timer. + timer1.Stop(); + + // Hide both icons. + firstClicked.ForeColor = firstClicked.BackColor; + secondClicked.ForeColor = secondClicked.BackColor; + + // Reset firstClicked and secondClicked + // so the next time a label is + // clicked, the program knows it's the first click. + firstClicked = null; + secondClicked = null; + } + + /// + /// Check every icon to see if it is matched, by + /// comparing its foreground color to its background color. + /// If all of the icons are matched, the player wins. + /// + private void CheckForWinner() + { + // Go through all of the labels in the TableLayoutPanel, + // checking each one to see if its icon is matched. + foreach (Control control in tableLayoutPanel1.Controls) + { + Label iconLabel = control as Label; + + if (iconLabel != null) + { + if (iconLabel.ForeColor == iconLabel.BackColor) + return; + } + } + + // If the loop didn’t return, it didn't find + // any unmatched icons. + // That means the user won. Show a message and close the form. + MessageBox.Show("You matched all the icons!", "Congratulations!"); + Close(); + } + + } +} diff --git a/windowsforms/matching-game/MatchingGame/Form1.resx b/windowsforms/matching-game/MatchingGame/Form1.resx new file mode 100644 index 00000000000..1f666f268bc --- /dev/null +++ b/windowsforms/matching-game/MatchingGame/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + \ No newline at end of file diff --git a/windowsforms/matching-game/MatchingGame/MatchingGameCS.csproj b/windowsforms/matching-game/MatchingGame/MatchingGameCS.csproj new file mode 100644 index 00000000000..969b9fbed78 --- /dev/null +++ b/windowsforms/matching-game/MatchingGame/MatchingGameCS.csproj @@ -0,0 +1,34 @@ + + + + WinExe + netcoreapp3.0 + MatchingGame + MatchingGame + + + false + + + + + + + + + + Form1.cs + + + Form1.cs + + + + diff --git a/windowsforms/matching-game/MatchingGame/Program.cs b/windowsforms/matching-game/MatchingGame/Program.cs new file mode 100644 index 00000000000..adfc28b39e6 --- /dev/null +++ b/windowsforms/matching-game/MatchingGame/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Windows.Forms; + +namespace MatchingGame +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/windowsforms/matching-game/MatchingGame/Properties/AssemblyInfo.cs b/windowsforms/matching-game/MatchingGame/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..dfd8ebe82a0 --- /dev/null +++ b/windowsforms/matching-game/MatchingGame/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MatchingGame")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corp.")] +[assembly: AssemblyProduct("MatchingGame")] +[assembly: AssemblyCopyright("Copyright © Microsoft Corp. 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5cc1f991-0c7e-477b-8c57-2a555c206a12")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/windowsforms/matching-game/MatchingGameCS.sln b/windowsforms/matching-game/MatchingGameCS.sln new file mode 100644 index 00000000000..28c0fa0f8e1 --- /dev/null +++ b/windowsforms/matching-game/MatchingGameCS.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatchingGameCS", "MatchingGame\MatchingGameCS.csproj", "{2C7AA1CA-3C34-4656-A12E-A5B85846DC95}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2C7AA1CA-3C34-4656-A12E-A5B85846DC95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2C7AA1CA-3C34-4656-A12E-A5B85846DC95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2C7AA1CA-3C34-4656-A12E-A5B85846DC95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2C7AA1CA-3C34-4656-A12E-A5B85846DC95}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/windowsforms/matching-game/README.md b/windowsforms/matching-game/README.md new file mode 100644 index 00000000000..e8babcee5e9 --- /dev/null +++ b/windowsforms/matching-game/README.md @@ -0,0 +1,6 @@ +# Matching Game Sample +This Windows Form sample was ported from [a previous .NET Framework 4.5 sample](https://code.msdn.microsoft.com/windowsdesktop/Complete-Matching-Game-4cffddba). + +This sample demonstrates a .NET Core 3 WinForms application using simple grids, event handlers, and timers. + +![Screenshot](images/screenshot.png) diff --git a/windowsforms/matching-game/images/screenshot.png b/windowsforms/matching-game/images/screenshot.png new file mode 100644 index 00000000000..6d8d750c262 Binary files /dev/null and b/windowsforms/matching-game/images/screenshot.png differ