25

I'm a C++/Java developer and have no idea about .Net or GUIs. I need to develop a windows app for 2000/XP/Vista/7.

I think I've come to conclusion that C# is the best and the fastest way to go (please correct me if I'm wrong). What do you recommend? Which GUI approach should I learn? (Forms? Any other stuff?)

Is it the best way to compile in .Net 2.0 mode? It's going to be an application for the public to download.

Rakete1111
  • 47,013
  • 16
  • 123
  • 162
user63898
  • 29,839
  • 85
  • 272
  • 514

9 Answers9

20

For desktop applications there are basically two options; WinForms and Windows Presentation Foundation (WPF).

WinForms is more traditionally built and hence easier to learn. WinForms might therefore be a simpler start, but if you plan on actually using your gained knowledge in GUI development for .NET I'd say you're better of diving into WPF from the start. It's a much richer framework, and where Microsoft is putting their effort for desktop applications. It is also similar to Silverlight, meaning you can easily get into Silverlight too when you know WPF.

Good luck!

Community
  • 1
  • 1
stiank81
  • 25,418
  • 43
  • 131
  • 202
  • 2
    Could whoever gave me -1 make a comment about what they disagree on such that we can all learn from this? – stiank81 Jan 06 '10 at 22:20
  • 1
    @bambuska - "WinForms is more traditionally built and hence easier to learn" It's not, generally. It only is if you come from an event driven GUI background. – codekaizen Jan 07 '10 at 00:19
  • 3
    Thanks for commenting. You're right about this, but compared to WPF I still think this is valid. Many other GUI options are event driven and hence comparable to WinForms (Java Swing, Delphi, Qt, ..), while WPF is different from most other options. – stiank81 Jan 07 '10 at 06:55
15

In my personal development experience Windows Forms is just about as easy as it gets when it comes to rapidly deploying a GUI application on Windows. WPF is of course another option, but using it would likely require you spend some time familiarizing yourself with XAML. Windows Forms look and feel like a lot of the available GUI options for Java, it's just much better than the majority of them, in my opinion.

If you want the fastest possible GUI development time in .NET, Windows Forms is it.

Nathan Taylor
  • 24,423
  • 19
  • 99
  • 156
  • 2
    I disagree. WPF is faster, especially if coming from a web background. The WPF design story is much nicer as well as having at least as good code access as WinForms. – codekaizen Jan 06 '10 at 22:07
  • 8
    I disagree with codekaizen. If we're talking speed, WinForms is way faster for someone who hasn't met either. Plus, the visual designers actually work and do not require a separate program (that would be Blend) to use. – Dmitri Nesteruk Jan 06 '10 at 22:13
  • 1
    Remember though that the OP is already an experienced Java developer - wouldn't it be easier for him to just learn a Java GUI framework than an _entirely_ new platform & set of tools? – Duncan Bayne Jan 06 '10 at 22:15
  • 1
    @Dmitri - Do you have experience with someone new learning WPF vs. Winforms? I do. WPF is easy for them. It's just hard for you since you have experience with WinForms's traditional approach. Also, you don't need a separate program. What gives you that idea? VS Express works just fine. – codekaizen Jan 06 '10 at 22:16
  • 2
    My point was made in light of someone coming from Java to .NET for GUI development. WPF is a very powerful (and fairly easy) platform, but the learning curve is likely to be steeper for someone who has never used something like it before. The decent Java GUI tools are all fairly similar to the Windows Forms designer, but I know of none that are like WPF. – Nathan Taylor Jan 06 '10 at 22:21
  • 1
    @codekaizen, WPF may be faster ONLY if coming from a web background. Absolute positioning as is default in WinForms (ie the button stays exactly where I put it and the same size) is just more obvious than flow layout (why does my button move to the top of the form and change size?). – Ash Jan 07 '10 at 00:19
  • The Windows Form designer is a true WYSIWYG editor. There are very few fancy visual effects that can be achieved, but with that limitation comes the confidence that what you create in the designer is exactly what the end user is going to see. If you've got a background in web development then the limitations of Windows Forms may decrease the appeal and draw you more toward WPF, but there is, without a doubt, a great deal more to think about when working with XAML. – Nathan Taylor Jan 07 '10 at 16:34
  • I have a Java background and i am currently learning C# with WPF. The worst thing is, that there is no main-method! It is completely different than developing with Java Swing. That's why i think it would be better to start with Windows Forms and later switch to WPF. – kiltek Oct 21 '13 at 11:56
9

Yes. C# is the language of choice when it comes to .NET development. Since you've programmed in Java, you'll find that the language looks very familiar (it looks a bit cleaner though and has some very nice features like delegates and you can even use pointers if you really want to, although you won't need to in most circumstances).

It's SWF (System Windows Forms) or MWF (Managed Windows Forms - a lightweight version of SWF written in managed Code using System.Drawing - it frees you from the WinAPI that's underlying classical SWF) all the way.

There's also GTK-Sharp, a GTK+ binding for C-Sharp, but since you're developing for Windows, users will find it strange to install a third-party GUI framework for your application.

I wouldn't recommend using WPF though. It makes direct calls to the underlying graphics hardware, which means it's quite fast, but not portable at all. It will only run on x86 systems (not SPARC, etc.) with DirectX compliant hardware rendering units (graphics cards) and it will not run on a system with strong hardware abstraction (like most Unices like BSD or Linux or Solaris).

Novell also stated that they will never implement WPF in the near future due to it's strong hardware dependencies (Novell wants Mono to be portable across many processor platforms). Don't use WPF. Software is no longer just a throw-away-product and when it comes to operating systems we're in the age of spin. The platform you're running today isn't necessarily the platform you're gonna run tomorrow. WPF is a proprietary and patent-encumbered technology developed by Microsoft and Intel. If you use it, you'll find yourself in a very nice Win32-on-x86 vendor lock in. And this means that you'll most definitely find yourself completely re-writing your application sooner or later. Just write portable software from the beginning, even if you don't need that portability today. I'm telling you from experience, you will need portability tomorrow. Definitely!

  • 1
    SWF and MWF are not valid terms talking about Windows Forms development on Windows. System.Windows.Forms = WinForms = Managed windows forms. Are you talking about WinForms on Linux using Mono? If so you should clarify in your answer so the OP is not confused. – Ash Jan 07 '10 at 00:28
3

You could use Windows Forms or Windows Presentation Foundation to develop your GUI; although, Windows Forms might feel more familiar to you. If you search on Google for Windows Forms tutorial, you will get many options for getting started.

If you need to use .NET 2.0, you will be limited to Win Forms. WPF requires .NET 3.5.

I would suggest downloading Microsoft's free Visual Studio Express Edition to use for developemnt. it includes an excellent drag-and-drop GUI design tool.

Adam Crossland
  • 14,198
  • 3
  • 44
  • 54
3

I would recommend learning Winforms first, then move the WPF. Winforms is easier to learn and get something working quickly. The future however is WPF, so I wouldnt leave that in the dark. I posted some good books and links for GUI development work.

Books

  • Design of Everyday Things A really good book about design of interfaces. It's not software specific but a must read for GUI designers.
  • Coding Horror. He recommends a lot of development books on his book list, but these ones are specifically interface-related:

Don't Make Me Think
About Face 3.0
The Inmates Are Running the Asylum
GUI Bloopers

Web Links

SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
3

I disagree with all the WinForms advocates. It's not easier. It may be easier for someone who has traditional experience with GUI programming, but this poster doesn't have that.

WPF has a better design story and the databinding is much, much better than WinForms. You can get up and running on WPF at least as fast as WinForms, and then go much further without running into the limitations that WinForms has. Couple this with the design-time databinding in VS 2010, and I'd say that anyone starting out on GUI development should completely bypass Winforms.

codekaizen
  • 26,990
  • 7
  • 84
  • 140
  • 1
    I would also strongly suggest that start directly with WPF. I maintain a complex winforms app and I wish that we had WPF when started. – softveda Jan 06 '10 at 23:25
1

C# WinForms will be the fastest in terms of getting a practical GUI working rapidly. Though if you think on making a complex GUI, with animations, 3D etc, WPF would be better.

You can use CodePlex to find some good working projects to learn from in terms of best practice, both for WinForms and WPF.

You can also look here for some good books on both WPF and WinForms.

Amirshk
  • 8,170
  • 2
  • 35
  • 64
1

C# for sure. Use Winforms for line of business app / classic GUI.

read petzold 'programming windows with c#'

Or just dive in with visual studio. Creating GUI with VS is really easy - you will like it

You will find the langauge transition from java to c# pretty simple (not the gui bit tho)

pm100
  • 48,078
  • 23
  • 82
  • 145
-3

I think I've come to conclusion that C# is the best and the fastest way to go (please correct me if I'm wrong). What do you recommend?

Personally, I would stick with Java. We (meaning OffByZero, the company I co-founded) have released an encrypted text editor called OBZVault, which is written in Java.

We originally wrote it in Linux, and then ported to Mac OS X and Windows. We found that the Windows port provided a perfectly acceptable look & feel - almost (but not exactly) like a native Windows app.

We used InnoSetup to build a native Windows installer, and found that quite good as well.

Bottom line: unless you want to learn a new language & platform, or you have a specific need for functionality provided by a different platform like .NET, stick with Java for your Windows development too. You'll need to learn a Java GUI framework, but then you'd have to learn WPF or WinForms if you switched to .NET anyway.

It may be faster for an experienced .NET developer to build a Windows app in WinForms or WPF, but if you're already well versed in Java I say stick with the tools (language, libraries, IDE) that you know.

Duncan Bayne
  • 3,870
  • 4
  • 39
  • 64
  • 6
    This does not answer the question and looks too much like an ad of your company. – yu_sha Jan 06 '10 at 21:57
  • Bottom line: You didn't understand his question and want to sell him your app? –  Jan 06 '10 at 21:59
  • "I think I've come to conclusion that C# is the best and the fastest way to go (please correct me if I'm wrong)" Well, personally I think he is wrong; if he's already an experienced Java dev and has no need for specific .NET functionality, there's no point in learning a new dev environment just to write a Windows app. I believe it'd be faster for him to learn how to write GUI apps in Java, than it would be for him to learn how to write GUI apps in C#. _Based on my own commercial experience_, the resultant Windows app would probably be close enough to a native look & feel to suffice. – Duncan Bayne Jan 06 '10 at 22:09
  • 2
    Yeah, I am. The OP is an experienced Java developer. Why learn an entirely new platform & set of tools, if all you want to do is produce a single GUI app? I mean if you're doing it as a learning exercise, go right ahead, but it makes no sense from any other perspective. – Duncan Bayne Jan 06 '10 at 22:19
  • A question for those who voted my answer down - was it because I suggested the OP was wrong to pick C# over Java, or because I linked to my own commercial Java app? – Duncan Bayne Jan 06 '10 at 22:37
  • this is a reason i hate stackoverflow. you get downvoted for having a legitimate idea or theory that doesnt jive with the mainstream. booo on all you downvoters. – D3vtr0n Jan 06 '10 at 22:52
  • +1 from me. even if it is crazy talk. – D3vtr0n Jan 06 '10 at 22:53
  • @yu_sha: What question do you think I left unanswered? I thought the OP was wrong about C# being the best & fastest way to go, & said so. @Jan J: Of course I want to sell him my app. I want to ell everyone my app. But linking to it shows that I'm not simply blowing smoke; I have a valid basis for my opinion that the OP should stick with Java (as I've done a _lot_ of C# dev in both WinForms and WPF as well). – Duncan Bayne Jan 06 '10 at 23:08
  • +100 from me just being an Aussie. She'll be right, mate :) – D3vtr0n Jan 06 '10 at 23:22