关于Form.designer.cs,Program.cs,Form1.cs这三个文件

yixinC 2010-05-02 05:10:32
如题
我敲了一个Windows窗体程序,是在Form1.cs这个文件中,
但是我发现Form.designer.cs,Program.cs中也有一部分程序
我现在搞不懂的是这三个文件之间的关系
为什么会生成另外两个文件
...全文
1692 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
youhaoxinqin2013 2011-08-31
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 xiaozhi_5638 的回复:]
这就像C++中个的.h文件和.cpp文件啊,一个文件负责声明,一个文件处理逻辑或者实现,program.cs是程序入口点,main函数
[/Quote]
+1
pwcpp 2011-03-24
  • 打赏
  • 举报
回复
汗,才搞明白用例程是用visual c#而不是c++ 创建的 囧
yangzhao988229 2011-03-24
  • 打赏
  • 举报
回复
这个真的很好哦
pwcpp 2011-03-24
  • 打赏
  • 举报
回复
文件结构是这样的
pwcpp 2011-03-24
  • 打赏
  • 举报
回复
搭车问一下,刚安装了vs2008,看到一些例程提及创建windows form application后会有Form1.cs、Form.designer.cs、Program.cs等几个文件,但我创建后只有Form1.h等几个文件,是不是非托管、托管的关系?请问如何得到Form1.cs等几个文件呢?谢谢!
spmzfz 2010-05-02
  • 打赏
  • 举报
回复
如果你的工程有多个窗口,你可在Program.cs中修改 Application.Run(new Form1 ()); 代码行以启动你所需要的窗口。

如果你在 窗口设计器中从工具栏拖放控件到窗口上,则VS 同时也会在Form.Designer.cs 作写入一些代码,以作出一些对控件操作的初始化信息等,一般情况下,最好不要直接在Form.Designer.cs 中修改代码,事实上,你也无需去理它。不过有时,当你在Form.cs 中删除某一控件的事件处理代码段时,会编译出错,这时你可转到Form.Designer.cs 删除那行相应的控件事件注册代码行。
wuyq11 2010-05-02
  • 打赏
  • 举报
回复
默认情况下,C# 会将一个窗体添加到项目中,并为其命名为 Form1。表示该窗体的两个文件称为 Form1.cs 和 Form1.designer.cs。Form1.cs 中写入的是你自己的代码;designer.cs 文件是C# Windows 窗体设计器自动写入代码的文件,这些代码用于实现所有通过从“工具箱”中拖放控件执行的操作
public partial class Form1 : Form
通过partial关键字可以把一个类写在多个文件中。
捷哥1999 2010-05-02
  • 打赏
  • 举报
回复
楼主需要看看基本的.net winform编程的资料!
请叫我卷福 2010-05-02
  • 打赏
  • 举报
回复
这就像C++中个的.h文件和.cpp文件啊,一个文件负责声明,一个文件处理逻辑或者实现,program.cs是程序入口点,main函数
bom.b 2010-05-02
  • 打赏
  • 举报
回复
InitializeComponent();是初始化窗口的。
Dispose(bool disposing);释放资源
如有错误希望大家指正!
yixinC 2010-05-02
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 cja03 的回复:]
那是VS自带的模板(你可以到安装目录找到相应的模板自己修改),你也可以自己手写。

Program默认包含Main方法(程序入口点),当然你也可以把它移到别的地方
designer放着你在设计界面时,VS自动生成的代码
Form1.cs在这里你可以编写一些逻辑代码
[/Quote]


System.ComponentModel.Container components = null
这个是什么意思啊
还有这个
public Form1()
{
InitializeComponent();
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}

呵呵、帮下忙哈
yixinC 2010-05-02
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 skep99 的回复:]
Main方法在program.cs中,它是程序的入口点。
程序模板生成的界面代码在Form.designer.cs中
你自己要实现的逻辑,写在Form1.cs里
[/Quote]


那也就是说把Main()函数写在program.cs里
界面设计的代码放在Form.designer.cs
是这样的么?
cja03 2010-05-02
  • 打赏
  • 举报
回复
那是VS自带的模板(你可以到安装目录找到相应的模板自己修改),你也可以自己手写。

Program默认包含Main方法(程序入口点),当然你也可以把它移到别的地方
designer放着你在设计界面时,VS自动生成的代码
Form1.cs在这里你可以编写一些逻辑代码
skep99 2010-05-02
  • 打赏
  • 举报
回复
Main方法在program.cs中,它是程序的入口点。
程序模板生成的界面代码在Form.designer.cs中
你自己要实现的逻辑,写在Form1.cs里
├─WAW在线考试系统源码WAWExam_ │ │ │ │ from.gif │ │ 在线考试系统.sln │ │ │ │ │ ├─DB_51aspx │ │ Exam.mdf │ │ Exam_log.ldf │ │ │ ├─在线考试系统 │ │ │ Client.cs │ │ │ EditTest.cs │ │ │ EditTest.Designer.cs │ │ │ EditTest.resx │ │ │ Login.cs │ │ │ Login.Designer.cs │ │ │ Login.resx │ │ │ Management.cs │ │ │ Management.Designer.cs │ │ │ Management.resx │ │ │ Program.cs │ │ │ TestManagement.cs │ │ │ TestManagement.Designer.cs │ │ │ TestManagement.resx │ │ │ TestPaperManagement.cs │ │ │ TestPaperManagement.Designer.cs │ │ │ TestPaperManagement.resx │ │ │ UserManagement.cs │ │ │ UserManagement.Designer.cs │ │ │ UserManagement.resx │ │ │ 在线考试系统.csproj │ │ │ │ │ ├─App_Data │ │ │ Exam.mdf │ │ │ Exam_log.ldf │ │ │ │ │ ├─bin │ │ │ ├─Debug │ │ │ │ 在线考试系统.exe │ │ │ │ 在线考试系统.pdb │ │ │ │ 在线考试系统.vshost.exe │ │ │ │ 在线考试系统.vshost.exe.manifest │ │ │ │ │ │ │ └─Release │ │ ├─obj │ │ │ └─x86 │ │ │ └─Debug │ │ │ │ DesignTimeResolveAssemblyReferences.cache │ │ │ │ DesignTimeResolveAssemblyReferencesInput.cache │ │ │ │ GenerateResource.read.1.tlog │ │ │ │ GenerateResource.write.1.tlog │ │ │ │ ResolveAssemblyReference.cache │ │ │ │ 在线考试系统.csproj.FileListAbsolute.txt │ │ │ │ 在线考试系统.csproj.GenerateResource.Cache │ │ │ │ 在线考试系统.EditTest.resources │ │ │ │ 在线考试系统.exe │ │ │ │ 在线考试系统.Login.resources │ │ │ │ 在线考试系统.Management.resources │ │ │ │ 在线考试系统.pdb │ │ │ │ 在线考试系统.Properties.Resources.resources │ │ │ │ 在线考试系统.TestManagement.resources │ │ │ │ 在线考试系统.TestPaperManagement.resources │ │ │ │ 在线考试系统.UserManagement.resources │ │ │ │ │ │ │ └─TempPE │ │ │ Properties.Resources.Designer.cs.dll │ │ │ │ │ ├─Properties │ │ │ AssemblyInfo.cs │ │ │ Resources.Designer.cs │ │ │ Resources.resx │ │ │ Settings.Designer.cs │ │ │ Settings.settings │ │ │ │ │ └─Resources │ │ 016.jpg │ │ 54.jpg │ │ │ ├─学生端 │ │ │ 学生端.sln │ │ │ │ │ └─学生端 │ │ │ Exam.cs │ │ │ Exam.Designer.cs │ │ │ Exam.resx │ │ │ Exam.zu.resx │ │ │ Form1.cs │ │ │ Form1.Designer.cs │ │ │ Form1.resx │ │ │ Login.cs │ │ │ Login.Designer.cs │ │ │ Login.resx │ │ │ Program.cs │ │ │ 学生端.csproj │ │ │ 学生端.csproj.user │ │ │ │ │ ├─bin │ │ │ ├─Debug │ │ │ │ │ 学生端.exe │ │ │ │ │ 学生端.pdb │ │ │ │ │ 学生端.vshost.exe │ │ │ │ │ 学生端.vshost.exe.manifest │ │ │ │ │ │ │ │ │ └─zu │ │ │ │ 学生端.resources.dll │ │ │ │ │ │ │ └─Release │ │ ├─imag │ │ │ 22.jpg │ │ │ │ │ ├─obj │ │ │ └─x86 │ │ │ └─Debug │ │ │ │ DesignTimeResolveAssemblyReferences.cache │ │ │ │ DesignTimeResolveAssemblyReferencesInput.cache │ │ │ │ GenerateResource.read.1.tlog │ │ │ │ GenerateResource.write.1.tlog │ │ │ │ ResolveAssemblyReference.cache │ │ │ │ 学生端.csproj.FileListAbsolute.txt │ │ │ │ 学生端.csproj.GenerateResource.Cache │ │ │ │ 学生端.Exam.resources │ │ │ │ 学生端.Exam.zu.resources │ │ │ │ 学生端.exe │ │ │ │ 学生端.Form1.resources │ │ │ │ 学生端.Login.resources │ │ │ │ 学生端.pdb │ │ │ │ 学生端.Properties.Resources.resources │ │ │ │ │ │ │ ├─TempPE │ │ │ │ Properties.Resources.Designer.cs.dll │ │ │ │ │ │ │ └─zu │ │ │ 学生端.resources.dll │ │ │ │ │ ├─Properties │ │ │ AssemblyInfo.cs │ │ │ Resources.Designer.cs │ │ │ Resources.resx │ │ │ Settings.Designer.cs │ │ │ Settings.settings │ │ │ │ │ └─Resources │ │ 016.jpg │ │ 0161.jpg │ │ 未命名.jpg │ │ │ └─教师端 │ │ 教师端.sln │ │ │ └─教师端 │ │ AddTest.cs │ │ AddTest.Designer.cs │ │ AddTest.resx │ │ AlterPwd.cs │ │ AlterPwd.Designer.cs │ │ AlterPwd.resx │ │ Login.cs │ │ Login.Designer.cs │ │ Login.resx │ │ Program.cs │ │ ScoreSelect.cs │ │ ScoreSelect.Designer.cs │ │ ScoreSelect.resx │ │ Teacher.cs │ │ Teacher.Designer.cs │ │ Teacher.resx │ │ 教师端.csproj │ │ │ ├─bin │ │ ├─Debug │ │ │ 教
C#的条形码打印程序,带源码和测试程序 ......\WindowsApplication2 ......\...................\debug ......\...................\.....\BarCode.dll ......\...................\WebSite1 ......\...................\........\App_Data ......\...................\........\BarCode.aspx ......\...................\........\BarCode.aspx.cs ......\...................\........\Bin ......\...................\........\...\BarCode.dll ......\...................\........\...\BarCode.dll.refresh ......\...................\........\Default.aspx ......\...................\........\Default.aspx.cs ......\...................\........\Web.Config ......\...................\WindowsApplication1 ......\...................\...................\bin ......\...................\...................\...\Debug ......\...................\...................\...\.....\BarCode.dll ......\...................\...................\...\.....\WindowsApplication1.exe ......\...................\...................\...\.....\WindowsApplication1.pdb ......\...................\...................\...\.....\WindowsApplication1.vshost.exe ......\...................\...................\...\.....\WindowsApplication1.xml ......\...................\...................\Form1.Designer.vb ......\...................\...................\Form1.resx ......\...................\...................\Form1.vb ......\...................\...................\My Project ......\...................\...................\..........\Application.Designer.vb ......\...................\...................\..........\Application.myapp ......\...................\...................\..........\AssemblyInfo.vb ......\...................\...................\..........\Resources.Designer.vb ......\...................\...................\..........\Resources.resx ......\...................\...................\..........\Settings.Designer.vb ......\...................\...................\..........\Settings.settings ......\...................\...................\obj ......\...................\...................\...\Debug ......\...................\...................\...\.....\ResolveAssemblyReference.cache ......\...................\...................\...\.....\TempPE ......\...................\...................\...\.....\......\My Project.Resources.Designer.vb.dll ......\...................\...................\...\.....\WindowsApplication1.exe ......\...................\...................\...\.....\WindowsApplication1.Form1.resources ......\...................\...................\...\.....\WindowsApplication1.pdb ......\...................\...................\...\.....\WindowsApplication1.Resources.resources ......\...................\...................\...\.....\WindowsApplication1.vbproj.GenerateResource.Cache ......\...................\...................\...\.....\WindowsApplication1.xml ......\...................\...................\...\WindowsApplication1.vbproj.FileList.txt ......\...................\...................\WindowsApplication1.vbproj ......\...................\...................\WindowsApplication1.vbproj.user ......\...................\WindowsApplication2 ......\...................\...................\bin ......\...................\...................\...\Debug ......\...................\...................\...\.....\BarCode.dll ......\...................\...................\...\.....\WindowsApplication2.exe ......\...................\...................\...\.....\WindowsApplication2.pdb ......\...................\...................\...\.....\WindowsApplication2.vshost.exe ......\...................\...................\Form1.cs ......\...................\...................\Form1.designer.cs ......\...................\...................\Form1.resx ......\...................\...................\obj ......\...................\...................\...\Debug ......\...................\...................\...\.....\ResolveAssemblyReference.cache ......\...................\...................\...\.....\TempPE ......\...................\...................\...\.....\......\Properties.Resources.Designer.cs.dll ......\...................\...................\...\.....\WindowsApplication2.csproj.GenerateResource.Cache ......\...................\...................\...\.....\WindowsApplication2.exe ......\...................\...................\...\.....\WindowsApplication2.Form1.resources ......\...................\...................\...\.....\WindowsApplication2.pdb ......\...................\...................\...\.....\WindowsApplication2.Properties.Resources.resources ......\...................\...................\...\WindowsApplication2.csproj.FileList.txt ......\...................\...................\Program.cs ......\...................\...................\Properties ......\...................\...................\..........\AssemblyInfo.cs ......\...................\...................\..........\Resources.Designer.cs ......\...................\...................\..........\Resources.resx ......\...................\...................\..........\Settings.Designer.cs ......\...................\...................\..........\Settings.settings ......\...................\...................\WindowsApplication2.csproj ......\...................\...................\WindowsApplication2.csproj.user ......\...................\WindowsApplication2.ncb ......\...................\WindowsApplication2.sln ......\...................\WindowsApplication2.suo
CSharp 调用C++ DLL; 参数为指针类型导出函数 c# Csharp调用 c++库 参数为导入和导出指针两种 包含C++ DLL源码 如fun(cont char* A,char*B) A为输入参数,B为输出参数-C# CSharp call C++ DLL lib dll function param use export and import eg: fun(cont char* A,char*B) A IN,B OUT TestDll\Debug\TestCallDll.exe .......\.....\TestCallDll.vshost.exe .......\.....\TestCallDll.vshost.exe.manifest .......\.....\TestDll.dll .......\.....\TestDll.lib .......\TestCallDll\Form1.cs .......\...........\Form1.Designer.cs .......\...........\Form1.resx .......\...........\obj\Debug\TestCallDll.csproj.FileListAbsolute.txt .......\...........\...\.....\TestCallDll.csproj.GenerateResource.Cache .......\...........\...\.....\TestCallDll.exe .......\...........\...\.....\TestCallDll.Form1.resources .......\...........\...\.....\TestCallDll.pdb .......\...........\...\.....\TestCallDll.Properties.Resources.resources .......\...........\Program.cs .......\...........\...perties\AssemblyInfo.cs .......\...........\..........\Resources.Designer.cs .......\...........\..........\Resources.resx .......\...........\..........\Settings.Designer.cs .......\...........\..........\Settings.settings .......\...........\TestCallDll.csproj .......\....Dll\dllmain.cpp .......\.......\ReadMe.txt .......\.......\stdafx.cpp .......\.......\stdafx.h .......\.......\targetver.h .......\.......\TestDll.cpp .......\.......\TestDll.def .......\.......\TestDll.h .......\.......\TestDll.vcproj .......\.......\TestDll.vcproj.PC-201008261742.Administrator.user .......\TestDll.sln .......\TestDll.suo .......\....CallDll\obj\Debug\TempPE .......\...........\...\Debug .......\...........\obj .......\...........\Properties .......\Debug .......\TestCallDll .......\TestDll TestDll

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧