views:

998

answers:

4

Coming from a background, I'm familiar with GUI editors that do a poor job of producing code. However, I've never written a GUI using .NET. Does the GUI editor in Visual Studio have the same problem(s)? Are both the source files and output GUI good?

+9  A: 

The GUI editor in Visual Studio is probably the best I've used. Also, because C# supports partial classes, there is a clean separation between the IDE-generated code and your own.

Ben Hoffstein
It's awesome, use it and see. ;o)
Gary Willoughby
I love the the partial classes too.
Maudite
+3  A: 

Yes, for the most, you should use the GUI editor. Not that you won't have to work around it every now and again.

Also it depends if you are talking WPF or Winforms.

Winforms I'd use it almost the majority of the time. WPF, I'd hand roll a lot of it and occassionally use blend or something to do some of the more tricky layout things.

Keith Nicholas
+2  A: 

If you're doing WinForms then VS2005 and 2008 are fine - in fact no point using anything else as it creates classes/code in partial classes that take a lot of hand coding away from you.

If you're doing ASP.NET then some of the HTML outputted can be a little funky, but there are way's around this - CSSControlAdapters for example.

If you're doing WPF then Notepad it is, unless you have VS2008, which I believe has a built in GUI editor for WPF - but don't do WPF so not sure...

KiwiBastard
VS 2008 has a gui for editing WPF, however i think most people use the Expression suite as it lets you edit a lot more.
Lounges
+2  A: 

The designer is the way to go. If you are very concerned about the quality of the code that is generated one tip i will give you is to make sure you are only setting what values you need.

Anything that shows up as bold in the property window will be serialized to the InitComponent routine. Thus if you want the cleanest code possible you will want to make sure you are serializing only what is changed from the defaults. If you want to reset to the default simply right click the property and select "Reset".

Also keep in mind that most components (buttons, labels, etc) will inherit many properties (Fonts, Colors, etc) from their parent. Thus if you want to say have a default font of "Tahoma" on your form you should only set it for the form and not for each individual control.

Lounges