From 6632fc2817a435b63c66f6100f6b7f08bb926032 Mon Sep 17 00:00:00 2001 From: Mark Daniel Osborne Date: Fri, 20 Dec 2024 16:15:27 +1000 Subject: [PATCH] Add ScratchProject2 project for testing #12042 --- .../ScratchProject2/Form1.Designer.cs | 106 ++++++++++++++++ .../IntegrationTests/ScratchProject2/Form1.cs | 23 ++++ .../ScratchProject2/Form1.resx | 120 ++++++++++++++++++ .../ScratchProject2/Program.cs | 20 +++ .../ScratchProject2/ScratchProject2.csproj | 35 +++++ .../ScratchProject2/readme.txt | 1 + 6 files changed, 305 insertions(+) create mode 100644 src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.Designer.cs create mode 100644 src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.cs create mode 100644 src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.resx create mode 100644 src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Program.cs create mode 100644 src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/ScratchProject2.csproj create mode 100644 src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/readme.txt diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.Designer.cs b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.Designer.cs new file mode 100644 index 00000000000..20afa170cc2 --- /dev/null +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.Designer.cs @@ -0,0 +1,106 @@ +namespace ScratchProject2 +{ + 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() + { + TreeNode treeNode1 = new TreeNode("Node1"); + TreeNode treeNode2 = new TreeNode("Node0", new TreeNode[] { treeNode1 }); + TreeNode treeNode3 = new TreeNode("Node3"); + TreeNode treeNode4 = new TreeNode("Node4"); + TreeNode treeNode5 = new TreeNode("Node5"); + TreeNode treeNode6 = new TreeNode("Node2", new TreeNode[] { treeNode3, treeNode4, treeNode5 }); + TreeNode treeNode7 = new TreeNode("Node6"); + ListViewItem listViewItem1 = new ListViewItem(new string[] { "1", "q", "w", "e" }, -1); + ListViewItem listViewItem2 = new ListViewItem(new string[] { "2", "a", "s", "d" }, -1); + ListViewItem listViewItem3 = new ListViewItem(new string[] { "3", "z", "x", "c" }, -1); + treeView1 = new TreeView(); + listView1 = new ListView(); + columnHeader1 = new ColumnHeader(); + columnHeader2 = new ColumnHeader(); + columnHeader3 = new ColumnHeader(); + SuspendLayout(); + // + // treeView1 + // + treeView1.LabelEdit = true; + treeView1.Location = new Point(24, 59); + treeView1.Name = "treeView1"; + treeNode1.Name = "Node1"; + treeNode1.Text = "Node1"; + treeNode2.Name = "Node0"; + treeNode2.Text = "Node0"; + treeNode3.Name = "Node3"; + treeNode3.Text = "Node3"; + treeNode4.Name = "Node4"; + treeNode4.Text = "Node4"; + treeNode5.Name = "Node5"; + treeNode5.Text = "Node5"; + treeNode6.Name = "Node2"; + treeNode6.Text = "Node2"; + treeNode7.Name = "Node6"; + treeNode7.Text = "Node6"; + treeView1.Nodes.AddRange(new TreeNode[] { treeNode2, treeNode6, treeNode7 }); + treeView1.Size = new Size(161, 199); + treeView1.TabIndex = 0; + + + // + // listView1 + // + listView1.Columns.AddRange(new ColumnHeader[] { columnHeader1, columnHeader2, columnHeader3 }); + listView1.Items.AddRange(new ListViewItem[] { listViewItem1, listViewItem2, listViewItem3 }); + listView1.LabelEdit = true; + listView1.Location = new Point(254, 61); + listView1.Name = "listView1"; + listView1.Size = new Size(159, 160); + listView1.TabIndex = 1; + listView1.UseCompatibleStateImageBehavior = false; + listView1.View = View.Details; + // + // Form1 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(591, 334); + Controls.Add(listView1); + Controls.Add(treeView1); + Name = "Form1"; + Text = "Form1"; + ResumeLayout(false); + } + + #endregion + + private TreeView treeView1; + private ListView listView1; + + private ColumnHeader columnHeader1; + private ColumnHeader columnHeader2; + private ColumnHeader columnHeader3; + } +} diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.cs b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.cs new file mode 100644 index 00000000000..c6fbad07b6c --- /dev/null +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.cs @@ -0,0 +1,23 @@ + +namespace ScratchProject2 +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + Load += Form1_Load; + } + + private void Form1_Load(object? sender, EventArgs e) + { + treeView1.BeforeLabelEdit += treeView1_BeforeLabelEdit; + } + + private void treeView1_BeforeLabelEdit(object? sender, NodeLabelEditEventArgs e) + { + Console.WriteLine("Here!"); + } + + } +} diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.resx b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.resx new file mode 100644 index 00000000000..8b2ff64a113 --- /dev/null +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Program.cs b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Program.cs new file mode 100644 index 00000000000..1a7e680f92f --- /dev/null +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/Program.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace ScratchProject2; + +// This project is meant for temporary testing and experimenting and should be kept as simple as possible. + +internal static class Program +{ + [STAThread] + public static void Main() + { + Application.EnableVisualStyles(); + Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); +#pragma warning disable WFO5001 + Application.SetColorMode(SystemColorMode.Dark); + Form1 form = new(); + Application.Run(form); + } +} diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/ScratchProject2.csproj b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/ScratchProject2.csproj new file mode 100644 index 00000000000..3d6e407ec73 --- /dev/null +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/ScratchProject2.csproj @@ -0,0 +1,35 @@ + + + + WinExe + enable + enable + true + true + + false + false + true + + + + + false + false + win-x64 + False + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/readme.txt b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/readme.txt new file mode 100644 index 00000000000..739914eee0e --- /dev/null +++ b/src/System.Windows.Forms/tests/IntegrationTests/ScratchProject2/readme.txt @@ -0,0 +1 @@ +This project is meant for doing temporary testing and should be left as simple and basic as possible. \ No newline at end of file