Windows Forms getting started update for .NET 6 (#1215)

* Migrate code to .NET 6

* Add snippet ref in code

* Add net6 pics; move others to version folder

* Update winforms getting started

* Other .NET 5 references updated

* Lessen the amount of 'winforms'

* minor

* Update dotnet-desktop-guide/net/winforms/get-started/create-app-visual-studio.md

Co-authored-by: Tom Dykstra <[email protected]>

* Update dotnet-desktop-guide/net/winforms/get-started/create-app-visual-studio.md

Co-authored-by: Tom Dykstra <[email protected]>

* Update dotnet-desktop-guide/net/winforms/overview/index.md

Co-authored-by: Tom Dykstra <[email protected]>

* Update dotnet-desktop-guide/net/winforms/get-started/create-app-visual-studio.md

Co-authored-by: Tom Dykstra <[email protected]>

* Update dotnet-desktop-guide/net/winforms/overview/index.md

Co-authored-by: Tom Dykstra <[email protected]>

* Update dotnet-desktop-guide/net/winforms/get-started/create-app-visual-studio.md

Co-authored-by: Tom Dykstra <[email protected]>

* Update create-app-visual-studio.md

* Update create-app-visual-studio.md

* Update create-app-visual-studio.md

Co-authored-by: Tom Dykstra <[email protected]>
This commit is contained in:
Andy (Steve) De George
2021-11-16 14:09:35 -08:00
committed by GitHub
co-authored by Tom Dykstra
parent e17bdfae17
commit 4e4a3f5498
38 changed files with 292 additions and 185 deletions
@@ -1,4 +1,4 @@
namespace project
namespace Names
{
partial class Form1
{
@@ -30,8 +30,8 @@
{
this.label1 = new System.Windows.Forms.Label();
this.lstNames = new System.Windows.Forms.ListBox();
this.btnAdd = new System.Windows.Forms.Button();
this.txtName = new System.Windows.Forms.TextBox();
this.btnAdd = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
@@ -52,36 +52,34 @@
this.lstNames.Size = new System.Drawing.Size(120, 94);
this.lstNames.TabIndex = 1;
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(138, 55);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(100, 23);
this.btnAdd.TabIndex = 2;
this.btnAdd.Text = "Add Name";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(138, 26);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(100, 23);
this.txtName.TabIndex = 3;
this.txtName.TabIndex = 2;
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(138, 55);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(100, 23);
this.btnAdd.TabIndex = 3;
this.btnAdd.Text = "Add Name";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(252, 141);
this.Controls.Add(this.txtName);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.txtName);
this.Controls.Add(this.lstNames);
this.Controls.Add(this.label1);
this.Cursor = System.Windows.Forms.Cursors.Default;
this.Name = "Form1";
this.Text = "Names";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -89,10 +87,9 @@
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox lstNames;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.TextBox txtName;
private Label label1;
private ListBox lstNames;
private TextBox txtName;
private Button btnAdd;
}
}
}
@@ -0,0 +1,18 @@
namespace Names
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
// <buttonClick>
private void btnAdd_Click(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(txtName.Text) && !lstNames.Items.Contains(txtName.Text))
lstNames.Items.Add(txtName.Text);
}
// </buttonClick>
}
}
@@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace project
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnAdd_Click(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(txtName.Text) && !lstNames.Items.Contains(txtName.Text))
lstNames.Items.Add(txtName.Text);
}
}
}
@@ -2,12 +2,10 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Update="Main.cs" />
</ItemGroup>
</Project>
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace project
namespace Names
{
static class Program
internal static class Program
{
/// <summary>
/// The main entry point for the application.
@@ -14,10 +8,8 @@ namespace project
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}
}