Windows.Form c# 没有 Visual Studio

发布于 2024-07-29 19:08:08 字数 525 浏览 4 评论 0原文

我正在尝试学习 Windows.Forms,虽然我有 Visual Studio(编辑,显然是我的错误),但我觉得通过在记事本中完成所有操作可以更有效地学习。 我到处寻找采用这种方法的教程。 我终于开始使用 http://www.geekpedia.com/tutorial33_Windows-forms-programming。 html,但在第一个示例之后,它也开始处理多个文件? 以某种方式用 Visual Studio 生成。 我如何在记事本中执行此操作? 谁能指出我有帮助的地方吗?

谢谢!

**虽然压倒性的反应似乎强烈反对这一点,并且我开始相信这一点,但我看到 SmokingRope 谈论它就像将所有类写入一个文件一样简单。 到目前为止,这就是我一直在为大型非 Windows.Form 项目所做的事情。 您能否帮助解释如何使用此方法包含这些必要的文件?*

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. 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? somehow generated with 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. This is what I have been doing up till now for sizable, just non Windows.Form projects into. Can you maybe help explain how those necessary files can be included using this method?*

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(17

平安喜乐 2024-08-05 19:08:08

说实话……我很欣赏你的火力,但你疯了! 您可能希望通过 NotePad 来了解 .NET 的哪些内容,而通过 Visual Studio 无法以数百万倍的速度学习? 这就像问:“我想学开车。我在沙发上装了轮子。接下来我应该做什么?”

我无意冒犯,只是与 Visual Studio 交朋友并忙于学习。 否则你就是在浪费时间。

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? 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. You're wasting your time otherwise.

你对谁都笑 2024-08-05 19:08:08

实际上,在 IDE 之外编写 C# 代码非常容易。 基本上可以归结为从命令行提示符使用csc.exe编译器。

此过程中最困难的部分是确保正确配置环境变量,Microsoft 提供了 vsvars32.bat 批处理文件来完成此任务。

以下是有关如何从命令行使用此批处理文件和编译器的简短教程: http://www.zeusedit.com/forum/viewtopic.php?t=1235

更好但稍微复杂的方法是使用 MsBuild 实用程序来管理项目构建:http://www.zeusedit.com/forum/viewtopic。 php?t=2518

最后,您甚至可以使用外部C# 调试器来调试程序:http://www.zeusedit.com/forum/viewtopic.php?t=2507

It is actually quite easy to code C# outside of the IDE. It will basically come down to using the csc.exe compiler from the command line prompt.

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.

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

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

Finally you can even use the external C# Debugger to debug you programs: http://www.zeusedit.com/forum/viewtopic.php?t=2507

ㄖ落Θ余辉 2024-08-05 19:08:08

我在这里违背了原则......但我认为你的想法并不是那么糟糕......特别是对于一个小项目。

但是使用记事本(或至少使用 Notepad++)将教您更多有关 MSBuild 和 VBC 或 CSC 编译器语法的知识,而不是教您有关语言功能的知识。 正如其他人所说,学习该语言的最佳方法是使用 Visual Studio。 智能感知是一种很好的学习方式。

但它也让我们变得懒惰,而且确实我们不需要记住那么多……有时记住东西会派上用场。 (即...我在客户处并远程登录到服务器...没有安装 Visual Studio...但是...yippee....NET 2 就在那里...在那一刻您将很欣赏这个练习...)

老实说,为一个相当小的项目做这个,我认为这将是一个很好的学习练习。 我说去吧。 天啊,我什至可能会加入你。

但是,话虽如此,我认为最好的方法是并行使用这两种方法。 例如...如果您想使用多个文件,方法是创建一个文件夹并在其中放入 vbproj(或 csproj)文件。 MSBuild.exe 接收 vbproj 文件(以及与此相关的 sln 文件)作为参数。 因此,学习 vbproj 文件语法的最快方法之一是使用 Visual Studio 创建项目...然后在 Notepad++ 中打开 vbproj 文件。

问题是 Visual Studio 太棒了,因为它从开发人员那里抽象了太多东西。 但不承认这有一个缺点是愚蠢的。 这种抽象意味着我们不需要有那么深刻的理解。 一切都会自动进行。 所以我说再深入一点。 我认为你不会后悔的。

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. The best way to learn the language, is, as other have said, using Visual Studio. The intellisense is a great way to learn.

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...)

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. MSBuild.exe receives vbproj files (and sln files for that matter) as arguments. 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++.

The problem is that Visual Studio IS SO AWESOME BECAUSE it abstracts so much away from the developer. 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.

慈悲佛祖 2024-08-05 19:08:08

最好的方法实际上是学习如何在 Visual Studio 中编写代码。 您将获得大量编码帮助(智能感知、语法检查等),这将有助于您学习该语言。

如果您确实想使用记事本,则可以根据需要创建任意数量的文件,然后使用命令行编译器将它们编译为程序集,将每个文件列为编译器的输入。

现实情况是,使用记事本和命令行编译器是可能的,但非常麻烦,并且除了显示简单的“Hello,world”类型示例之外几乎从未使用过。

Your best approach is really to learn how to write code from within 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.

漫雪独思 2024-08-05 19:08:08

假设您想要避免的是神奇生成的代码和可视化设计器,您只需打开 System.Windows.Forms 命名空间并开始针对 API 进行编码即可。 从第一个示例开始,然后以编程方式添加按钮和文本框等等。 您不必创建表单项目或与设计人员合作,您只需在 VS 中“编写代码”即可关闭所有魔力。

如果您正在寻找示例代码,您可以考虑查看 F# 示例,例如

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

了解一些可以添加到表单中以执行基本 UI 操作的基本控件的想法。

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. 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.

If you're looking for example code, you might consider looking at F# samples, e.g. the UI stuff at

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

for ideas of a few basic controls you can add to forms to do basic UI stuff.

牵你的手,一向走下去 2024-08-05 19:08:08

您可以在单个 C# 文件中编写多个类(尽管普遍接受的最佳实践是每个文件放置一个类):

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

您还可以从命令行了解 MSBuild 系统的工作原理。 我相信您仍然需要维护一个项目文件(xml 类型语法,使用 Visual Studio 创建一个项目,然后在记事本中打开它作为示例),但我个人没有任何经验。

可以通过记事本和命令提示符完成这一切。 然而,您可能会发现它会花费更多的时间。

You can write multiple classes in a single C# file (despite the generally accepted best-practice of putting one class per file):

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

You also could look into how the MSBuild system works from the commandline. 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.

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.

长亭外,古道边 2024-08-05 19:08:08

如果您想学习 C# 和 winforms,您需要的部分技能就是精通 Visual Studio。

你可以在记事本中做一些事情(我曾经在记事本中写过一些Web服务,因为我没有可用的VS),但最终你会想要利用VS中可用的工具。

If you want to learn c# and winforms, part of the skill set you need is being proficient in 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.

千年*琉璃梦 2024-08-05 19:08:08

我强烈建议您使用 Visual Studio(Microsoft 提供免费的 Express 版本可以满足您的需求)。 学习该语言的语法固然很棒,但您必须能够在 VS 环境中工作才能在 C#(以及任何 .NET 语言)方面取得真正的成功。 正确地做并一起学习比稍后尝试将它们拼凑起来更有益于你。 只是我自己的两分钱。

I highly recommend you use Visual Studio (Microsoft offers free Express versions that will meet your needs). 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). 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.

姜生凉生 2024-08-05 19:08:08

只是重复一下已经说过的话,再次强调,无意冒犯,您不会在记事本中学习 .NET。 这只是不太可能。 您不仅无法提高工作效率,而且也无法学习行业中使用的工具、最佳实践以及有关 .NET 的其他重要因素。 这不仅仅是坐下来编写代码。 通过限制自己使用记事本,就像限制自己每月只吃一顿饭一样:您缺乏继续以良好的速度前进所需的营养。

利用您可用的工具和资源。 像这样限制自己是一种后脚踢。

Just to repeat what's already said, again with no disrespect, you are not going to learn .NET in notepad. 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. 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.

笑叹一世浮沉 2024-08-05 19:08:08

使用 Sharpdevelop (Windows) 或 Monodevelop (*nix)。 两者都有 Windows.Form 支持。 尽管他们提供的功能不如 VS 那么多,但至少可以帮助您入门。 我从未使用过 VS Express 版本,所以我不知道它的局限性是什么。

Use sharpdevelop (Windows) or monodevelop (*nix). Both have Windows.Form support. Although they dont offer as much as VS, they'll at least get you started. I've never used the VS Express edition, so I don't know what it's limitations are.

欢烬 2024-08-05 19:08:08

请注意,记事本甚至不能与 vi 等同,更不用说 vim 了。

如果您想使用文本编辑器,那么您可以尝试一下,但我不认为使用记事本有什么意义。 使用真正的文本编辑器,不一定是 vim/emacs,您可以选择一个不错的 gui 文本编辑器,如 notepad++ 或 kate。

记事本甚至无法显示unix行结尾(我认为)。

Note that notepad is not even the equal of vi not to speak of 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.

Notepad can't even display unix line endings(I think).

寒冷纷飞旳雪 2024-08-05 19:08:08

下载 Visual Studio Express 版本。 我知道通过记事本彻底学习这一点的可能性,但是有了免费的 IDE,这是没有意义的。

Go download an Express edition of Visual Studio. I understand the possibility of thoroughly learning this via notepad, but with a free IDE out there, it makes no sense.

奈何桥上唱咆哮 2024-08-05 19:08:08

如果你对 MS 或 VS.net 有异议,你可以尝试 Sharpdevelop
http://www.icsharpcode.net/OpenSource/SD/

上次我看它xcopy 是否可部署:)

if u have something against MS or VS.net u can try sharpdevelop
http://www.icsharpcode.net/OpenSource/SD/

last time i looked it was xcopy deployable :)

回首观望 2024-08-05 19:08:08

我不知道在哪里可以找到教程,但方法非常简单:导入 System.Windows.Forms,从 Form 派生一个类,并给它一个 .Show()。 您的组件是该类的成员,可以使用其各自的位置/大小属性进行定位。 事件通过代表来处理。

我确实看到了这种技术的用处,尽管我会使用像样的 IDE 而不是记事本。 .NET 实在是太丰富了。 了解如何即时构建表单会派上用场。

如果您正在寻找替代 IDE,请查看 icSharpCode 的 SharpDevelop。

另外,请查看 JScript.NET 教程 - 该语言没有表单编辑器,因为继承根本不可能。 但它仍然基于.NET,因此基本动作是相同的。 这是一个不错的:

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

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(). 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. .NET is just too prolific. 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.

Also, look into JScript.NET tutorials - there is no forms editor for that language, as inheritance simply isn't possible. But it's still based on .NET, so the basic motions are the same. Here's a decent one:

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

南冥有猫 2024-08-05 19:08:08

我知道这个问题的回答很奇怪,我没有看到有人谈论 NAnt。

多年来,我在 TextPad 中进行开发,并使用一些语法突出显示 + NAnt 来进行构建。 如今,这会变得更加容易,因为您可以让构建服务器为您准备适当的 msbuild (CC.NET + NAnt)。

我还了解了一些在 Visual Studio 中实际上无法完成的事情(当时是 .net 1.1)。 绝对是一次很好的体验,我真的会推荐它。 但可能不适用于 winforms,因为设计器实际上对此很有用。

I know this is answered by strangely I haven't seen anyone talk about NAnt.

For years I developed in TextPad, with some syntax highlighting, + NAnt to do my builds. These days it'd be even easier as you can have your buildserver prep a proper msbuild for you (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). Definitely a good experience, and I'd recommend it really. Probably not for winforms though, because the designer is actually useful for that.

冷血 2024-08-05 19:08:08

我是记事本用户。 :) 我的计算机上没有安装 Visual Studio。

这就是我正在做的事情。

第一你必须在环境变量..路径上注册你的.net框架文件夹
或在 CMD 上运行此行
path=%path%;(这是你的.net框架地址所在的位置)
(例如路径=%path%;C:\Windows\Microsoft.NET\Framework\v4.0.30319)
然后按回车

2nd编译单个记事本(另存为.cs),使用cmd找到文件的目标位置。 然后。 输入“csc nameOfCS.cs”
对于多文件..“csc ManinCsForname.csclasses.csclasses.cs”
它将编译为 exe。
以获得更多命令。
“CSC/?”

使用Visual Studio就可以了。 但如果你想更熟悉 C# 和结构。 或者可以在任何PC上制作一个系统。 无需使用任何IDE。 你可以做到这一点。

i am a notepad user. :) i don't have visual studio installed on my computer.

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

2nd to compile a single notepad(save as .cs), locate the destination of the file using cmd. then. type "csc nameOfCS.cs"
for multi file.. "csc ManinCsForname.cs classes.cs classes.cs"
it will compile as exe.
for more command.
"csc /?"

its ok to use Visual Studio. but if you want to become more familiar with C# and structure. or can make a system on any PC. without using any IDE. u can do this.

千纸鹤 2024-08-05 19:08:08

不使用记事本会有帮助。 Crimson Editor 或 TextPad 或其他编辑器具有行编号、语法突出显示和许多您需要的功能。 我确信记事本有您可能会遇到的文件大小限制。

sans-IDE元素我只能从Java的角度来完整回答。 我有时使用 Crimson Editor、Java SDK、批处理文件和/或 ANT 或 Maven 完成了大量 Java UI 开发。 如果您开发通用的 UI 代码或动态执行大量操作,那么就可以了。 如果您的工作涉及设计许多不同的特定表单(即具有许多客户表单且不会过多重用的屏幕),那么 IDE 的设计器功能将非常有用。

然而,我发现上述 Java 开发模型使 .NET IDE 开发有点令人沮丧。

Not using Notepad will help. Crimson Editor or TextPad or others have line numbering, syntax highlighting and many features you'd need. 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. 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. If you developing UI code that's generic or does a fair amount in dynamically then its ok. If your work involves designing many different specific Forms (i.e. screens that have many customer forms and aren't subject too much reuse) then the Designer features of the IDE are extremely useful.

However, I have found .NET IDE development a little frustrating coming from the above model of Java development.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文