From 782333e1a21d96f8f5f023fbf234079ae9c9ce56 Mon Sep 17 00:00:00 2001 From: Rahul-Siemens <144675885+Rahul-Siemens@users.noreply.github.com> Date: Fri, 12 Jul 2024 09:15:02 +0530 Subject: [PATCH] build: migrate sample forms to net8 (#38) --- .../Properties/Resources.Designer.cs | 2 +- Src/WindowsFormsSample/AssemblyInfo.cs | 25 -- .../GridSamples/frmSample25.cs | 27 +- .../GridSamples/frmSample26.cs | 7 +- Src/WindowsFormsSample/StartForm.cs | 49 ++-- ...indowsFormsSample-WithoutExtensions.csproj | 251 ++---------------- Src/WindowsFormsSample/WindowsFormsSample.sln | 4 +- 7 files changed, 82 insertions(+), 283 deletions(-) diff --git a/Src/DevAge.Windows.Forms/Properties/Resources.Designer.cs b/Src/DevAge.Windows.Forms/Properties/Resources.Designer.cs index 3abd08a..8662b98 100644 --- a/Src/DevAge.Windows.Forms/Properties/Resources.Designer.cs +++ b/Src/DevAge.Windows.Forms/Properties/Resources.Designer.cs @@ -39,7 +39,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DevAge.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sourcegrid.DevAge.Windows.Forms.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Src/WindowsFormsSample/AssemblyInfo.cs b/Src/WindowsFormsSample/AssemblyInfo.cs index 9f89a32..1f15ee1 100644 --- a/Src/WindowsFormsSample/AssemblyInfo.cs +++ b/Src/WindowsFormsSample/AssemblyInfo.cs @@ -1,33 +1,8 @@ using System.Reflection; using System.Runtime.CompilerServices; - -// -// 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("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// -// 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 Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. diff --git a/Src/WindowsFormsSample/GridSamples/frmSample25.cs b/Src/WindowsFormsSample/GridSamples/frmSample25.cs index 4d6e5ed..e2facbc 100644 --- a/Src/WindowsFormsSample/GridSamples/frmSample25.cs +++ b/Src/WindowsFormsSample/GridSamples/frmSample25.cs @@ -14,8 +14,10 @@ public class frmSample25 : System.Windows.Forms.Form { private System.Windows.Forms.Panel panelBottom; private SourceGrid.Grid grid; - private System.Windows.Forms.MainMenu mainMenu1; - private System.Windows.Forms.MenuItem mnWindow; + // TODO MainMenu is no longer supported. Use MenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + private System.Windows.Forms.MenuStrip mainMenu1; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + private System.Windows.Forms.ToolStripMenuItem mnWindow; /// /// Required designer variable. /// @@ -53,8 +55,10 @@ private void InitializeComponent() { this.panelBottom = new System.Windows.Forms.Panel(); this.grid = new SourceGrid.Grid(); - this.mainMenu1 = new System.Windows.Forms.MainMenu(); - this.mnWindow = new System.Windows.Forms.MenuItem(); + // TODO MainMenu is no longer supported. Use MenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mainMenu1 = new System.Windows.Forms.MenuStrip(); + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mnWindow = new System.Windows.Forms.ToolStripMenuItem(); this.panelBottom.SuspendLayout(); this.SuspendLayout(); // @@ -87,12 +91,13 @@ private void InitializeComponent() // // mainMenu1 // - this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mainMenu1.Items.AddRange(new System.Windows.Forms.ToolStripMenuItem[] { this.mnWindow}); // // mnWindow // - this.mnWindow.Index = 0; + //this.mnWindow.Index = 0; this.mnWindow.Text = "Window"; // // frmSample25 @@ -101,7 +106,7 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(772, 470); this.Controls.Add(this.panelBottom); this.IsMdiContainer = true; - this.Menu = this.mainMenu1; + this.MainMenuStrip = this.mainMenu1; this.Name = "frmSample25"; this.Text = "frmSample25"; this.Load += new System.EventHandler(this.frmSample25_Load); @@ -157,8 +162,9 @@ private void frmSample25_Load(object sender, System.EventArgs e) if (assemblyTypes[i] != this.GetType()) { - MenuItem menu = new MenuForm(this, assemblyTypes[i], sampleAttribute.Description + " " + sampleAttribute.SampleNumber.ToString()); - mnWindow.MenuItems.Add(menu); + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + ToolStripMenuItem menu = new MenuForm(this, assemblyTypes[i], sampleAttribute.Description + " " + sampleAttribute.SampleNumber.ToString()); + mnWindow.DropDownItems.Add(menu); } } } @@ -171,7 +177,8 @@ private void frmSample25_Load(object sender, System.EventArgs e) } - private class MenuForm : MenuItem + private class MenuForm : // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls +ToolStripMenuItem { private Type mFrm; private Form mParent; diff --git a/Src/WindowsFormsSample/GridSamples/frmSample26.cs b/Src/WindowsFormsSample/GridSamples/frmSample26.cs index 6f3c4d2..befd4f9 100644 --- a/Src/WindowsFormsSample/GridSamples/frmSample26.cs +++ b/Src/WindowsFormsSample/GridSamples/frmSample26.cs @@ -166,11 +166,12 @@ public CellCursor():base(Cursors.Cross, true) public class PopupMenu : SourceGrid.Cells.Controllers.ControllerBase { - ContextMenu menu = new ContextMenu(); + // TODO ContextMenu is no longer supported. Use ContextMenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + ContextMenuStrip menu = new ContextMenuStrip(); public PopupMenu() { - menu.MenuItems.Add("Menu 1", new EventHandler(Menu1_Click)); - menu.MenuItems.Add("Menu 2", new EventHandler(Menu2_Click)); + menu.Items.Add("Menu 1", null, new EventHandler(Menu1_Click)); + menu.Items.Add("Menu 2", null, new EventHandler(Menu2_Click)); } public override void OnMouseUp(SourceGrid.CellContext sender, MouseEventArgs e) diff --git a/Src/WindowsFormsSample/StartForm.cs b/Src/WindowsFormsSample/StartForm.cs index 4292261..fd6987f 100644 --- a/Src/WindowsFormsSample/StartForm.cs +++ b/Src/WindowsFormsSample/StartForm.cs @@ -11,11 +11,16 @@ namespace WindowsFormsSample /// public class StartForm : System.Windows.Forms.Form { - private System.Windows.Forms.MainMenu mainMenu1; - private System.Windows.Forms.MenuItem mnFile; - private System.Windows.Forms.MenuItem mnExit; - private System.Windows.Forms.MenuItem mnHelp; - private System.Windows.Forms.MenuItem mnAbout; + // TODO MainMenu is no longer supported. Use MenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + private System.Windows.Forms.MenuStrip mainMenu1; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + private System.Windows.Forms.ToolStripMenuItem mnFile; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + private System.Windows.Forms.ToolStripMenuItem mnExit; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + private System.Windows.Forms.ToolStripMenuItem mnHelp; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + private System.Windows.Forms.ToolStripMenuItem mnAbout; private SourceGrid.Grid grid1; /// /// Required designer variable. @@ -52,43 +57,51 @@ protected override void Dispose( bool disposing ) /// private void InitializeComponent() { - this.mainMenu1 = new System.Windows.Forms.MainMenu(); - this.mnFile = new System.Windows.Forms.MenuItem(); - this.mnExit = new System.Windows.Forms.MenuItem(); - this.mnHelp = new System.Windows.Forms.MenuItem(); - this.mnAbout = new System.Windows.Forms.MenuItem(); + // TODO MainMenu is no longer supported. Use MenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mainMenu1 = new System.Windows.Forms.MenuStrip(); + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mnFile = new System.Windows.Forms.ToolStripMenuItem(); + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mnExit = new System.Windows.Forms.ToolStripMenuItem(); + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mnHelp = new System.Windows.Forms.ToolStripMenuItem(); + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mnAbout = new System.Windows.Forms.ToolStripMenuItem(); this.grid1 = new SourceGrid.Grid(); this.SuspendLayout(); // // mainMenu1 // - this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mainMenu1.Items.AddRange(new System.Windows.Forms.ToolStripMenuItem[] { this.mnFile, this.mnHelp}); // // mnFile // - this.mnFile.Index = 0; - this.mnFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + // this.mnFile.Index = 0; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mnFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripMenuItem[] { this.mnExit}); this.mnFile.Text = "File"; // // mnExit // - this.mnExit.Index = 0; + // this.mnExit.Index = 0; this.mnExit.Text = "Exit"; this.mnExit.Click += new System.EventHandler(this.mnExit_Click); // // mnHelp // - this.mnHelp.Index = 1; - this.mnHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + // this.mnHelp.Index = 1; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + this.mnHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripMenuItem[] { this.mnAbout}); this.mnHelp.Text = "Help"; // // mnAbout // - this.mnAbout.Index = 0; + // this.mnAbout.Index = 0; this.mnAbout.Text = "About"; // // grid1 @@ -113,7 +126,7 @@ private void InitializeComponent() this.BackColor = System.Drawing.SystemColors.Window; this.ClientSize = new System.Drawing.Size(624, 305); this.Controls.Add(this.grid1); - this.Menu = this.mainMenu1; + this.MainMenuStrip = this.mainMenu1; this.Name = "StartForm"; this.Text = "Examples Explorer"; this.ResumeLayout(false); diff --git a/Src/WindowsFormsSample/WindowsFormsSample-WithoutExtensions.csproj b/Src/WindowsFormsSample/WindowsFormsSample-WithoutExtensions.csproj index 04b4e68..c2a4f0e 100644 --- a/Src/WindowsFormsSample/WindowsFormsSample-WithoutExtensions.csproj +++ b/Src/WindowsFormsSample/WindowsFormsSample-WithoutExtensions.csproj @@ -1,12 +1,7 @@ - - + + net8.0-windows Local - 9.0.21022 - 2.0 - {524BB84A-1662-47A6-9BE0-506638657C3F} - Debug - AnyCPU App.ico @@ -22,18 +17,11 @@ OnBuildSuccess - - - - Rational ClearCase Rational ClearCase Rational ClearCase Rational ClearCase - 3.5 false - v3.5 - publish\ true Disk @@ -48,250 +36,55 @@ 1.0.0.%2a false true + false + true + true ..\..\Out\Test\Debug\ - false 285212672 - false - DEBUG;TRACE - true 4096 false - false false false - false - 4 - full - prompt false ..\..\Out\Test\Release\ - false 285212672 - false - TRACE - false 4096 false - true false false - false - 4 none - prompt - + System - + System.Data - + System.Drawing - - System.Windows.Forms - - - - Code - - - Form - - - frmSample45.cs - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - Form - - - frmSample47.cs - - - Form - - - frmSample48.cs - - - Form - - - frmSample49.cs - - - Form - - - frmSample50.cs - - - Form - - - frmSample51.cs - - - Form - - - True - True - Resources.resx - - - Code - - - Form - - - - - Designer - frmSample45.cs - - - frmSample46.cs - Designer - - - - - - - frmSample14.cs - - - frmSample19.cs - - - frmSample21.cs - - - frmSample24.cs - - - frmSample25.cs - - - frmSample26.cs - - - frmSample27.cs - - - frmSample28.cs - - - frmSample4.cs - - - frmSample42.cs - - - frmSample43.cs - - - frmSample44.cs - - - Designer - frmSample47.cs - - - Designer - frmSample48.cs - - - Designer - frmSample49.cs - - - Designer - frmSample50.cs - - - Designer - frmSample51.cs - - - frmSample9.cs - - - - - - Designer - ResXFileCodeGenerator - Resources.Designer.cs - - - StartForm.cs - Designer - @@ -324,16 +117,26 @@ - - {2a5a1657-dba8-4117-8e2a-9f1236ace9e2} - SourceGrid - + + + + + + + + + + + + + + + + + + - - - - - + 1.0.%2a \ No newline at end of file diff --git a/Src/WindowsFormsSample/WindowsFormsSample.sln b/Src/WindowsFormsSample/WindowsFormsSample.sln index 38078dd..b7146fd 100644 --- a/Src/WindowsFormsSample/WindowsFormsSample.sln +++ b/Src/WindowsFormsSample/WindowsFormsSample.sln @@ -1,11 +1,11 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27703.2018 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceGrid", "..\SourceGrid.csproj", "{2A5A1657-DBA8-4117-8E2A-9F1236ACE9E2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsSample-WithoutExtensions", "WindowsFormsSample-WithoutExtensions.csproj", "{524BB84A-1662-47A6-9BE0-506638657C3F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsFormsSample-WithoutExtensions", "WindowsFormsSample-WithoutExtensions.csproj", "{524BB84A-1662-47A6-9BE0-506638657C3F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution