深汕特别合作区属于深圳吗,广州营销优化,网站建设工作室制作平台,公司建立网站的步骤目录
1 结论
2 项目结构
3 项目代码 1 结论
新建C#工程来说#xff0c;Trae的Chat比DeepSeek的Coder好用。 2 项目结构
MyWinFormsApp/ │ ├── Program.cs ├── Form1.cs ├── Form1.Designer.cs ├── MyResources/ │ └── MyResources.resx └── MyWin…目录
1 结论
2 项目结构
3 项目代码 1 结论
新建C#工程来说Trae的Chat比DeepSeek的Coder好用。 2 项目结构
MyWinFormsApp/ │ ├── Program.cs ├── Form1.cs ├── Form1.Designer.cs ├── MyResources/ │ └── MyResources.resx └── MyWinFormsApp.csproj 3 项目代码
根据AI提示反复迭代修改这几个文件可以实现C#窗口程序的生成。
//Form1.csusing System;
using System.Windows.Forms;namespace MyWinFormsApp
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){// 使用 .resx 文件中的资源this.Text MyWinFormsApp.MyResources.FormTitle;label1.Text MyWinFormsApp.MyResources.WelcomeMessage;}}
} //Form1.Designer.cs
namespace MyWinFormsApp
{partial class Form1{private System.ComponentModel.IContainer components null;private System.Windows.Forms.Label label1;protected override void Dispose(bool disposing){if (disposing (components ! null)){components.Dispose();}base.Dispose(disposing);}private void InitializeComponent(){this.label1 new System.Windows.Forms.Label();this.SuspendLayout();// // label1// this.label1.AutoSize true;this.label1.Location new System.Drawing.Point(100, 100);this.label1.Name label1;this.label1.Size new System.Drawing.Size(100, 20);this.label1.TabIndex 0;// // Form1// this.ClientSize new System.Drawing.Size(300, 200);this.Controls.Add(this.label1);this.Name Form1;this.Load new System.EventHandler(this.Form1_Load);this.ResumeLayout(false);this.PerformLayout();}}
} //MyWinFormsApp.csproj
Project SdkMicrosoft.NET.SdkPropertyGroupOutputTypeWinExe/OutputTypeTargetFrameworknet9.0-windows/TargetFrameworkNullableenable/NullableUseWindowsFormstrue/UseWindowsFormsEnableDefaultEmbeddedResourceItemsfalse/EnableDefaultEmbeddedResourceItemsEnableDefaultCompileItemsfalse/EnableDefaultCompileItems/PropertyGroupItemGroupEmbeddedResource IncludeMyResources\MyResources.resxGeneratorPublicResXFileCodeGenerator/GeneratorLastGenOutputMyResources.Designer.cs/LastGenOutput/EmbeddedResourceCompile IncludeForm1.cs /Compile IncludeForm1.Designer.cs /Compile IncludeProgram.cs /Compile IncludeMyResources\MyResources.Designer.csDependentUponMyResources.resx/DependentUponAutoGenTrue/AutoGenDesignTimeTrue/DesignTime/Compile/ItemGroup
/Project //Program.cs
using System;
using System.Windows.Forms;namespace MyWinFormsApp
{static class Program{[STAThread]static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new Form1());}}
} //MyResources/MyResources.Designer.cs
namespace MyWinFormsApp {using System;[global::System.CodeDom.Compiler.GeneratedCodeAttribute(System.Resources.Tools.StronglyTypedResourceBuilder, 17.0.0.0)][global::System.Diagnostics.DebuggerNonUserCodeAttribute()][global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]public class MyResources {private static global::System.Resources.ResourceManager resourceMan;private static global::System.Globalization.CultureInfo resourceCulture;[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(Microsoft.Performance, CA1811:AvoidUncalledPrivateCode)]internal MyResources() {}[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]public static global::System.Resources.ResourceManager ResourceManager {get {if (object.ReferenceEquals(resourceMan, null)) {global::System.Resources.ResourceManager temp new global::System.Resources.ResourceManager(MyWinFormsApp.MyResources.MyResources, typeof(MyResources).Assembly);resourceMan temp;}return resourceMan;}}[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]public static global::System.Globalization.CultureInfo Culture {get {return resourceCulture;}set {resourceCulture value;}}public static string FormTitle {get {return ResourceManager.GetString(FormTitle, resourceCulture);}}public static string WelcomeMessage {get {return ResourceManager.GetString(WelcomeMessage, resourceCulture);}}}
}
//MyResources/MyResources.resx?xml version1.0 encodingutf-8?
rootxsd:schema idroot xmlns xmlns:xsdhttp://www.w3.org/2001/XMLSchema xmlns:msdataurn:schemas-microsoft-com:xml-msdataxsd:element nameroot msdata:IsDataSettruexsd:complexTypexsd:choice maxOccursunboundedxsd:element namedataxsd:complexTypexsd:sequencexsd:element namevalue typexsd:string minOccurs0 msdata:Ordinal1 /xsd:element namecomment typexsd:string minOccurs0 msdata:Ordinal2 //xsd:sequencexsd:attribute namename typexsd:string msdata:Ordinal1 /xsd:attribute nametype typexsd:string msdata:Ordinal3 /xsd:attribute namemimetype typexsd:string msdata:Ordinal4 //xsd:complexType/xsd:element/xsd:choice/xsd:complexType/xsd:element/xsd:schemadata nameFormTitle xml:spacepreservevalue我的窗体应用/value/datadata nameWelcomeMessage xml:spacepreservevalue欢迎使用/value/data
/root