简体   繁体   English

Windows.Form c#没有visual studio

[英]Windows.Form c# without visual studio

I am trying to learn Windows.Forms, and while I have Visual Studio (edit, my mistake obviously), I feel that I learn much more effectively by doing everything in Notepad. 我正在尝试学习Windows.Forms,虽然我有Visual Studio(编辑,显然我的错误),但我觉得通过在记事本中做所有事情我可以更有效地学习。 I have searched everywhere for a tutorial that takes this approach. 我到处搜索了一个采用这种方法的教程。 I finally got started with http://www.geekpedia.com/tutorial33_Windows-forms-programming.html , but after the first example, it too begins working with multiple files? 我终于开始使用http://www.geekpedia.com/tutorial33_Windows-forms-programming.html ,但在第一个例子之后,它也开始使用多个文件了? somehow generated with Visual Studio. 以某种方式使用Visual Studio生成。 How can I do this in Notepad? 我怎么能在记事本中这样做? Can anyone point me somewhere helpful? 任何人都可以指点我有帮助吗?

Thanks! 谢谢!

**While the overwhelming response seems seems strongly against this and I started to be convinced, I saw SmokingRope talking about it being as simple as writing all classes into one file. **虽然压倒性的反应似乎强烈反对这一点,但我开始被说服,我看到SmokingRope谈论它就像把所有类写成一个文件一样简单。 This is what I have been doing up till now for sizable, just non Windows.Form projects into. 这是我迄今为止所做的大型非Windows.Form项目。 Can you maybe help explain how those necessary files can be included using this method?* 您可以帮助解释如何使用此方法包含这些必要的文件吗?*

Seriously... I admire your fire, but you are out of your mind! 说真的......我很佩服你的火,但你不在乎! What you can possibly hope to learn about .NET with NotePad that you couldn't learn a zillion times faster with Visual Studio? 你可能希望通过NotePad了解.NET,你用Visual Studio学习的速度要快几倍吗? It's like asking, "I want to learn to drive a car. I have put wheels on my couch. What should I do next?" 这就像是在问:“我想学开车。我把轮子放在沙发上。接下来我该怎么办?”

I mean no disrespect, but make friends with Visual Studio and get busy learning. 我的意思是没有不尊重,但与Visual Studio交朋友,忙着学习。 You're wasting your time otherwise. 否则你会浪费你的时间。

It is actually quite easy to code C# outside of the IDE. 在IDE之外编写C#实际上非常容易。 It will basically come down to using the csc.exe compiler from the command line prompt. 它基本上归结为从命令行提示符使用csc.exe编译器。

The hardest part of this process is making sure the environment variables are correctly configure and Microsoft provides the vsvars32.bat batch file to do exactly that. 此过程中最难的部分是确保正确配置环境变量,Microsoft提供vsvars32.bat批处理文件来完成此操作。

Here is a short tutorial on how to do use this batch file and the compiler from the command line: http://www.zeusedit.com/forum/viewtopic.php?t=1235 这是一个简短的教程,介绍如何从命令行使用此批处理文件和编译器: http//www.zeusedit.com/forum/viewtopic.php?t = 1235

And an even better, but slightly more complicate approach is to use MsBuild utility to manage the building of the project: http://www.zeusedit.com/forum/viewtopic.php?t=2518 一个更好但更复杂的方法是使用MsBuild实用程序来管理项目的构建: http//www.zeusedit.com/forum/viewtopic.php?t = 2518

Finally you can even use the external C# Debugger to debug you programs: http://www.zeusedit.com/forum/viewtopic.php?t=2507 最后,您甚至可以使用外部C#Debugger来调试程序: http ://www.zeusedit.com/forum/viewtopic.php?t = 2507

Your best approach is really to learn how to write code from within Visual Studio. 您最好的方法是学习如何从Visual Studio中编写代码。 You gain a lot of coding assistance (IntelliSense, syntax checking, etc.) that will help you learn the language. 您可以获得大量的编码帮助(智能感知,语法检查等),可以帮助您学习语言。

If you really want to use Notepad, then you create as few or as many files as you want and then compile them in to an assembly using the command line compiler by listing each file as an input to the compiler. 如果您真的想使用记事本,那么您可以根据需要创建少量或多个文件,然后使用命令行编译器将它们编译为汇编,方法是将每个文件列为编译器的输入。

The reality of this is that using notepad and the command line compiler is possible but very cumbersome and almost never used outside of showing simple "Hello, world" type examples. 这样做的实际情况是使用记事本和命令行编译器是可能的,但非常麻烦,几乎从未在显示简单的“Hello,world”类型示例之外使用。

I am going against the grain here... But I think that your idea is not such a bad one... especially for a small project. 我在这里反对的是......但我认为你的想法并不是那么糟糕......特别是对于一个小项目。

But using Notepad (or at LEAST use Notepad++) will teach you more about MSBuild and the VBC or CSC compiler syntax than it will teach you about the language features. 但是使用记事本(或者至少使用Notepad ++)将教你更多关于MSBuild和VBC或CSC编译器语法的知识,而不是教你语言功能。 The best way to learn the language, is, as other have said, using Visual Studio. 正如其他人所说,学习语言的最佳方式是使用Visual Studio。 The intellisense is a great way to learn. intellisense是一种很好的学习方式。

But it also makes us lazy and it is true that we don't have to memorize as much...and sometimes having things memorized comes in handy. 但它也让我们变得懒惰,而且我们不必记住那么多......而且有时候记住的东西会派上用场。 (ie.... I am at a customer and logged in remotely to the servers... no visual studio is installed... BUT... yippee... .NET 2 is there... at that moment you will have appreciated the exercise...) (即......我是客户并远程登录到服务器......没有安装视觉工作室......但是... yippee ... .NET 2就在那里......那时候你会赞赏这次演习...)

Honestly, to do this for a reasonably small project I think would be a good exercise in learning. 老实说,为了一个相当小的项目,我认为这将是一个很好的学习练习。 I say go for it. 我说去吧。 Hell, I might even join you. 见鬼,我甚至可能会加入你。

But, that said, I think the very best way to do it would be to use both methods side-by-side. 但是,那就是说,我认为最好的方法就是并排使用这两种方法。 For example... If you want to use multiple files the way to do that is to create a folder and put an vbproj (or csproj) file in it. 例如......如果你想使用多个文件,那么这样做的方法是创建一个文件夹并在其中放入一个vbproj(或csproj)文件。 MSBuild.exe receives vbproj files (and sln files for that matter) as arguments. MSBuild.exe接收vbproj文件(以及相关的sln文件)作为参数。 So, one of the quickest ways to learn the vbproj file syntax is to use visual studio to create a project... and then open the vbproj file in Notepad++. 因此,学习vbproj文件语法的最快方法之一是使用visual studio创建项目...然后在Notepad ++中打开vbproj文件。

The problem is that Visual Studio IS SO AWESOME BECAUSE it abstracts so much away from the developer. 问题是Visual Studio真是太棒了,因为它抽象了很多开发人员。 But it is silly to not acknowledge there is a downside to that. 但不承认存在不利因素是愚蠢的。 That abstraction means that we don't need to have as deep an understanding. 这种抽象意味着我们不需要那么深刻的理解。 Things just work automagically. 事情就是自动完成的。 So I say dig a little deeper. 所以我说要深入挖掘一下。 I don't think you will regret it. 我不认为你会后悔的。

You can write multiple classes in a single C# file (despite the generally accepted best-practice of putting one class per file): 您可以在单个C#文件中编写多个类(尽管通常认为每个文件放置一个类的最佳实践):

using System;
namespace Test{
  class Class1{ }
  class Class2{ }
}

You also could look into how the MSBuild system works from the commandline. 您还可以从命令行了解MSBuild系统的工作原理。 I believe you will still have to maintain a project file (xml type syntax, use visual studio to create a project and then open that in notepad for an example) but i don't have any experience with it personally. 我相信你仍然需要维护一个项目文件(xml类型语法,使用visual studio创建一个项目,然后在记事本中打开它作为一个例子),但我个人没有任何经验。

It's possible to do it all from notepad and the command prompt. 可以从记事本和命令提示符完成所有操作。 You will probably find it to be a little more time consuming however. 然而,您可能会发现它需要更多时间。

If you want to learn c# and winforms, part of the skill set you need is being proficient in Visual Studio. 如果你想学习c#和winforms,你需要的部分技能是精通Visual Studio。

You can do things in Notepad for awhile (I wrote some web services in notepad once because I didn't have VS available), but eventually you will want to take advantage of the tools available in VS. 你可以在记事本中做一段时间(我在记事本中写了一些因为我没有VS可用的web服务),但最终你会想要利用VS中提供的工具。

I highly recommend you use Visual Studio (Microsoft offers free Express versions that will meet your needs). 我强烈建议您使用Visual Studio(Microsoft提供可满足您需求的免费Express版本)。 Learning the syntax of the language is wonderful, but you must be able to work within the VS environment to be truly successful in C# (and any of the .NET languages). 学习语言的语法很棒,但是你必须能够在VS环境中工作才能真正成功地使用C#(以及任何.NET语言)。 It benefits you more to do it right and learn it all together rather than try and piece it together later. 它可以让你更好地做到正确并一起学习,而不是试着将它拼凑起来。 Just my own two cents. 只是我自己的两分钱。

Assuming that the thing you want to avoid is magically-generated-code and visual designers, you can just open the System.Windows.Forms namespace and start coding against the APIs. 假设你要避免的东西是神奇生成的代码和可视化设计器,你可以打开System.Windows.Forms命名空间并开始编写API代码。 Start with that first example, and then programmatically add buttons and textboxes and whatnot. 从第一个示例开始,然后以编程方式添加按钮和文本框等等。 You don't have to create a forms project or work with the designers, you can just 'write code' in VS and turn off all the magic. 您不必创建表单项目或与设计人员合作,您可以在VS中“编写代码”并关闭所有魔法。

If you're looking for example code, you might consider looking at F# samples, eg the UI stuff at 如果您正在寻找示例代码,您可以考虑查看F#示例,例如UI的内容

http://code.msdn.microsoft.com/fsharpsamples http://code.msdn.microsoft.com/fsharpsamples

for ideas of a few basic controls you can add to forms to do basic UI stuff. 对于一些基本控件的想法,您可以添加到表单来执行基本的UI工作。

Just to repeat what's already said, again with no disrespect, you are not going to learn .NET in notepad. 只是为了重复已经说过的话,再一次没有不尊重,你不会在记事本中学习.NET。 It's just not probable . 可能不太可能 Not only are you not be productive, but you're also not going to learn the tools used in the industry, best practices, and other important factors about .NET. 不仅没有高效率,而且还不会学习行业中使用的工具,最佳实践以及有关.NET的其他重要因素。 It's not just about sitting down and writing code. 这不仅仅是坐下来编写代码。 By limiting yourself to notepad, it's like limiting yourself to one meal a month: you lack the nutrition needed to keep moving forward at a good pace. 通过将自己限制在记事本中,这就像限制自己一个月一餐:你缺乏必要的营养,以保持良好的步伐前进。

Utilize the tools and resources available to you. 利用您可用的工具和资源。 Limiting yourself like that is a kick in the rear end. 像这样限制自己是后端的一脚。

Use sharpdevelop (Windows) or monodevelop (*nix). 使用sharpdevelop(Windows)或monodevelop(* nix)。 Both have Windows.Form support. 两者都有Windows.Form支持。 Although they dont offer as much as VS, they'll at least get you started. 虽然他们不提供与VS一样多的东西,但他们至少会让你开始。 I've never used the VS Express edition, so I don't know what it's limitations are. 我从未使用过VS Express版本,因此我不知道它的局限性。

Go download an Express edition of Visual Studio. 去下载Visual Studio的Express版本。 I understand the possibility of thoroughly learning this via notepad, but with a free IDE out there, it makes no sense. 我理解通过记事本彻底学习这个的可能性,但是在那里有一个免费的IDE,这没有任何意义。

if u have something against MS or VS.net u can try sharpdevelop http://www.icsharpcode.net/OpenSource/SD/ 如果你有针对MS或VS.net的东西你可以尝试sharpdevelop http://www.icsharpcode.net/OpenSource/SD/

last time i looked it was xcopy deployable :) 上次我看起来是xcopy可部署的:)

I don't know where to find tutorials, but the approach is pretty straightforward: import System.Windows.Forms, derive a class from Form, and give it a .Show(). 我不知道在哪里可以找到教程,但方法非常简单:导入System.Windows.Forms,从Form派生一个类,并给它一个.Show()。 Your components are members of the class, and can be positioned using their respective position/size properties. 您的组件是类的成员,可以使用各自的位置/大小属性进行定位。 Events are handled through delegates. 事件通过代表处理。

I do see where this technique is useful, though I'd use a decent IDE instead of Notepad. 我确实看到了这种技术有用的地方,尽管我使用的是体面的IDE而不是Notepad。 .NET is just too prolific. .NET太多了。 Knowing how to construct forms on the fly can come in handy. 知道如何在运行中构建表单可以派上用场。

If you're looking for an alternate IDE, check out icSharpCode's SharpDevelop. 如果您正在寻找备用IDE,请查看icSharpCode的SharpDevelop。

Also, look into JScript.NET tutorials - there is no forms editor for that language, as inheritance simply isn't possible. 另外,查看JScript.NET教程 - 该语言没有表单编辑器,因为继承是不可能的。 But it's still based on .NET, so the basic motions are the same. 但它仍然基于.NET,因此基本动作是相同的。 Here's a decent one: 这是一个体面的:

http://www.webreference.com/js/column117/ http://www.webreference.com/js/column117/

I know this is answered by strangely I haven't seen anyone talk about NAnt. 我知道这是奇怪的回答我没有见过有人谈论过NAnt。

For years I developed in TextPad, with some syntax highlighting, + NAnt to do my builds. 多年来我一直在TextPad中开发,有一些语法高亮,+ NAnt来做我的构建。 These days it'd be even easier as you can have your buildserver prep a proper msbuild for you (CC.NET + NAnt). 这些天你会更容易,因为你可以让你的构建服务器为你准备一个合适的msbuild(CC.NET + NAnt)。

I also learned about a few things that physically couldn't do in Visual Studio (at the time it was .net 1.1). 我还了解了一些在Visual Studio中实际上无法做到的事情(当时它是.net 1.1)。 Definitely a good experience, and I'd recommend it really. 绝对是一个很好的经历,我真的推荐它。 Probably not for winforms though, because the designer is actually useful for that. 可能不适合winforms,因为设计师实际上对此有用。

i am a notepad user. 我是记事本用户。 :) i don't have visual studio installed on my computer. :)我没有在我的电脑上安装visual studio。

this is what im doing. 这就是我正在做的事情。

1st u must register your .net framework folder on Environmen Variables.. Path or run on CMD this lines path=%path%;(this is where ur .net framework address were) (ex path=%path%;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319) then hit enter 第一个你必须在Environmen Variables上注册你的.net框架文件夹..路径或在CMD上运行此行path =%path%;(这是你的.net框架地址所在的位置)(ex path =%path%; C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319)然后点击回车

2nd to compile a single notepad(save as .cs), locate the destination of the file using cmd. 第二个编译单个记事本(另存为.cs),使用cmd找到文件的目标。 then. 然后。 type "csc nameOfCS.cs" for multi file.. "csc ManinCsForname.cs classes.cs classes.cs" it will compile as exe. 为多文件键入“csc nameOfCS.cs”..“csc ManinCsForname.cs classes.cs classes.cs”它将编译为exe。 for more command. 更多命令。 "csc /?" “csc /?”

its ok to use Visual Studio. 可以使用Visual Studio。 but if you want to become more familiar with C# and structure. 但如果你想更熟悉C#和结构。 or can make a system on any PC. 或者可以在任何PC上制作系统。 without using any IDE. 不使用任何IDE。 u can do this. 你能做到这一点。

Not using Notepad will help. 不使用记事本会有所帮助。 Crimson Editor or TextPad or others have line numbering, syntax highlighting and many features you'd need. Crimson Editor或TextPad或其他人都有行编号,语法高亮和许多你需要的功能。 I'm sure Notepad has file size limitations which you might run into. 我确定记事本有可能遇到的文件大小限制。

The sans-IDE element I can only fully answer from a Java point of view. sans-IDE元素我只能从Java的角度来完全回答。 I've done a fair amount of Java UI development using Crimson Editor, the Java SDK, batch files and/or either ANT or Maven at times. 我有时使用Crimson Editor,Java SDK,批处理文件和/或ANT或Maven进行了大量的Java UI开发。 If you developing UI code that's generic or does a fair amount in dynamically then its ok. 如果你开发的UI代码是通用的,或者动态地做了相当数量的UI代码,那么就可以了。 If your work involves designing many different specific Forms (ie screens that have many customer forms and aren't subject too much reuse) then the Designer features of the IDE are extremely useful. 如果您的工作涉及设计许多不同的特定表单(即具有许多客户表单且不会过多重用的屏幕),那么IDE的Designer功能非常有用。

However, I have found .NET IDE development a little frustrating coming from the above model of Java development. 但是,我发现.NET IDE开发有点令人沮丧,来自上面的Java开发模型。

Note that notepad is not even the equal of vi not to speak of vim. 请注意,记事本甚至不等于vi,更不用说vim了。

If you want to use a text editor then you could try it but I don't see the point of using notepad. 如果你想使用文本编辑器,那么你可以试试但我没有看到使用记事本的意义。 Use a real text editor, not necessarily vim/emacs, you could pick a nice gui text editor like notepad++ or kate. 使用真正的文本编辑器,不一定是vim / emacs,你可以选择一个很好的gui文本编辑器,如notepad ++或kate。

Notepad can't even display unix line endings(I think). 记事本甚至无法显示unix行结尾(我认为)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM