开发者

Visual C# GUI Designer basic tutorial [closed]

开发者 https://www.devze.com 2022-12-25 11:04 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently acc开发者_C百科epting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently acc开发者_C百科epting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 5 years ago.

Improve this question

can you recommend a Visual C# Form Designer tutorial that is targeted at experienced programmers who have at least a basic knowledge of C# but are new to the VS C# Form Designer. At least it shouldn't be targeted at programming newbs, like Introduction to Visual C# 2008 Express Edition (it explains how a comment looks like in C#).

So far I've found C# Programming Tutorial - Programming Winforms in C# on stackoverflow.

Wishlist: ;-)

I'm more interested in focus on the designer itself rather than an explanation of single gui-elements. In other words explaining separation between generated-code, what to not edit manually (visual-c#-designer-responsibility) and on the other hand the parts for which the programmer himself is responsible. So a little more abstract best-practice point of view pointing out some caveats would be great as well.

I would prefer text over video as well, but that's minor.

/Wishlist

Perhaps even a Microsoft reference specific to the Visual c# forms designer (which I seem to have been unable to find) would be helpful.


The forms designer, as you know, is just a code generator. There's nothing preventing you from editing the code it generates. You can add controls, remove controls, and so forth. Some people use this ability to add and remove controls at runtime.

If you modify the designer-generated code, the designer will pick up your changes and display them in the form. This is why you can take someone else's code in toto and drop it into a new C# project, and it will "just work."

I hope that clears things up. The designer is just a "convenience," especially for things like controls positioning and alignment.

Note that this is a little different than, for example, changing code in a data access object, where the class members must match fields in a database. In that scenario, there is a real chance you can break things if you modify the generated code. This is why partial classes are used in those scenarios. Partial classes allow you to tack on your own code without worrying about breaking the generated code, or the code generator wiping out your code additions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号