C# GUI programming for beginners: Where to start? [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
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.

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.
This other question gives some useful resources when getting started with WPF.
Also check out this tutorial at MSDN.
WpfTutorial obviously has a few nice hints for you too!
Good luck!

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.

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!

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.

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
Are Confirmation Dialogs Harmful? A blog entry by Guido van Rossum (creator of Python)
GUI Articles A few articles about GUIs by Joel Spolsky (joelonsoftware.com)
Interfaced Systems International Has a lot of resources, especially on their UI References page
User Experience Guidelines for Windows Vista

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.

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.

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)

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.

Related

Win CE 7 application development

I have requirement that we need to develop a rich UI application(similar to WPF or silverlight). The target device is having embedded OS Win CE 7. how can i achieve this, after so much R&D i got to know that
1. we have to user Silverlight for GUI and C++ as backend coding
2. we can create the MFC application using some third party SDK we will not be able to get rich UI
Also, i read that we can add components in WIN CE 7 for compact framework.
Is my above understanding correct, can someone throw some light on this?
Just to add my 2 cents to Chris and Paolo's replies, if you are not building the OS image for the target device or, at least, can't control the features it supports, your choice may be limited by the set of components that were included into the OS image provided with the device.
Windows CE is highly componentized and both the badly named "Silverlight for Windows Embedded" (XAML) and .NET Compact Framewor runtimes can be left out of the OS image to save storage space and memory.
The XAML runtime can leverage graphic acceleration (if the HW you are using provides it and the BSP includes drivers to use it, of course) and this may lead to a more responsive system, compared to a full .NET implementation.
I would also try to stay away from MFC for new implementation. The only good reason to use MFC is that you already have an UI framework that fit your needs and is based on it.
Currently on CE you can decide between an easy to design and rich UI with complex to develop and debug code-behind (XAML) or an easy to develop .NET application with an ugly windows 95-like UI that require lot of work to be "beautified". XAML in the hand may merge the best of both worlds (requiring additional cost and two heavvy runtimes on your target, but this may not be an issue if you have a powerful x86 machine or a graphic accelerated ARM Cortex).
To develop application on WEC 7 you need an SDK built from OEM that give you the target board.
If you want to develop on a Virtual PC image you need Platform Builder to use CEPC BSP and create an O.S. image and the corresponding SDK.
After that, you can develop using Silverlight only with C++ but you can use .Net Compact Framework and managed code for Windows Forms development.
Paolo.
It really, really depends on both your definition of "rich" and the graphics capability of the hardware you're targeting.
CE 7 supports the .NET Compact Framework. Many people will say that you can't do "rich" UI in the CF, but that's not really true. You can't do it with the standard controls, but if you do your own custom control drawing, you can do pretty well. Yet, it's a lot of work, but it can be done. The limitations here are in alphablending (not fun to get working) and animation (also not fun), but with dedication you can work around many issues.
CE 7.0 also supports "Silverlight for Windows Embedded" (a.k.a. SWE). First thing to know there is that it's really not Silverlight. It's a XAML rendering engine, but any other Silverlight assets you might have won't work with it.
SWE supports only C++, though since it is COM based, it can be wrapped in CF classes and then used from managed code. I've seen a couple of companies do this, and one even offers it as a product.
MFC is available, but since MFC was crap even 10 years ago, I definitely wouldn't use it today. If you want to use C++ but not SWE, there are better options than MFC. STL and WTL come to mind for windowing apps.

Best Windows language for multitouch and large bitmaps?

I will be developing an interactive application, involving multitouch, several layers of large bitmaps, and video playback. The screen resolution will be fairly large (1920x1280).
For several years, I have developed interactives in Flash, iOS, and OS X Cocoa. However, this project must run on a Windows box, so iOS & Cocoa are impossible. Also, I'm concerned about performance in Flash, since there may be 3 videos playing simultaneously, and large bitmaps moving around.
I know little about the technologies available on Windows. I'm investigating Silverlight, C#, Unity, Processing, and Java. If anyone can offer advice, it will be greatly appreciated.
You seem to be investigating several technologies on different levels:
C# and Java are programming languages. What you prefer may depend on your existing skills, but C# is from Microsoft so chances are that you will experience less friction using this language if you develop for Windows. Picking the right programming language is an important decision.
Silverlight is a "technology stack" from Microsoft. It enables you to develop XAML based applications that run in the browser. Compared to the native WPF stack it is less powerful. Choosing Silverlight, WPF or another technology stack like Processing.js is an important decision.
Unity is a dependency injection container from Microsoft. You can use this or any other suitable container if you like. Or none at all. You don't really have to think about this until you have made some of the more important decisions about your project.
Personally, I don't have experience with the type of application you describe, but I would go with C# and WPF. WPF has some support for multitouch on Windows, and only if it isn't adequate for your requirements you need to to go native and develop in say C++ which tends to require more work.
Multitouch in Windows 8 has been redesigned but unless you want to develop for a yet to be release operating system this is not an option.
Use Visual C++ if you like to create a LAN based Application, C++ is known for it's power and you could have many resources that could help you in developing this application. If you're going to create this application for web Use ASP.net(C#) C# is known for its flexibility and class libraries dedicated for web and client appilcation i also advice the use of WPF and Silverlight applications.
I suggest you have a look at Windows 8 and Metro Apps. Here is a link to start with this: The Microsoft BUILD conference, Windows 8, and the new UX Challenge. C# (.NET languages in fact), HTML5 and XAML are clearly the direction. Native C++ is back in town with WinRT. Silverlight is now in the gray area :-)
Even if you don't use Windows 8, it will give you a good overview of multitouch future in the Windows space.

A good starting point for development Windows utilities interfacing with OS

I would like you to give me some good resources regarding Windows development of applications that integrates with OS like Application managers, Docks, Task-bar\System tray etc.
Resources like how to interact with particular subsystems are welcome.
Thank you
What you are looking for is information on writing shell extensions. Generally it is not recommended that you write shell extensions in .NET though the landscape might be much better now with Framework 4.0 supporting side by side loading of the framework.
Searching with Bing/Google for shell extension c# will yield a number of results that might be relevant.
As for the docking part of your question, the most reliable way would be to register your application as an Application Desktop Toolbar (AppBar), here is a Code Project article on doing this with C#, it should be a fair starting point. http://www.codeproject.com/KB/dotnet/AppBar.aspx
It appears much of what you would like to know about involves using the Windows API. Its documentation might give you a start: http://msdn.microsoft.com/en-us/library/aa383749(v=vs.85).aspx

Is Mono for OSX viable for learning C#?

I need to learn C#. All of my computers are Macs running the latest version of OS X. I do not want to use Windows, but I will if I must.
That being said, as a new programmer, can I learn C# efficiently with this Mono platform on OS X?
Edit I'm looking to learn C# to gain programming knowledge and start indie game development. After a reasonable understanding is achieved I will then look at some gaming frameworks/platforms and or a more OS specific language.
In a word: Yes.
First of all, thanks Jonathan Pobst for updating What Is Mono page. With that said, Mono supports all versions of C# at present, that is 1.0 to 4.0.
Since your plan is to learn the language first before looking into other things, such as frameworks and tools, you should be fine with Mono. Once you start getting into platform-specific development (i.e., Windows GUI), then you might want to consider switching over to a Windows machine.
http://mono-project.com/What_is_Mono
http://en.wikipedia.org/wiki/C_Sharp_(programming_language)#Versions
If you are going to be developing for Windows, then using a Windows machine is your best bet. If you are simply trying to learn the language, Mono should be fine.
You should be able to, but just keep in mind that while most of the example code will work, some may not on the Mono framework as the implementation is not 100% compatible with .NET Framework. Also, of course some things like WPF aren't be supported by Mono.
I have used Monodevelop on Linux and it mostly works but because I also develop on Windows with VS2010, I am put off by using the inferior Monodevelop but as a newbie it shouldn't matter to you much.
Yes that should be fine seeing as MonoMac has come out. http://www.mono-project.com/MonoMac
If your wanting to use it for games with OpenGL, download this repo and look at the openGL stuff to get started. Then go to places like NeHe to learn more about GL ect..
You will need to download & install git to pull the repo:: http://git-scm.com/download
MonoMac Samples:: https://github.com/mono/monomac/tree/master/samples/
NeHe:: http://nehe.gamedev.net/
Code Sampler:: http://www.codesampler.com/
Depends.
To just learn the C# language and CLR core libraries which are not graphics related, C# / MonoDevelop is okay.
To learn graphics programming, game programming for OS X, I suggest you first learn Objective-C, Cocoa and then MonoDevelop/MonoMac. The reason is that the Cocoa API's are designed around the Objective-C language which has fundamental differences to C#. Using Cocoa via C# is easy to begin with, but quickly makes little sense unless you understand Cocoa patterns & Objective-C.

Comprehensive tutorial for beginners on how to write Windows GUI programs

I'm trying to learn how to write Windows GUI* programs in C++, using Visual Studio 2008, but I haven't found any more comprehensive tutorial for beginners.
The more comprehensive tutorials I have found are either only about how to make buttons, menus, etc. OR only about how to write basic C++ console programs.
What I haven't found is a more comprehensive tutorial for beginners on how to combine buttons, menus, etc. with C++ code.
In other words, I'm looking for answers to the question: How do I link menus, buttons etc. to C++ code?
If you know where I can find answers to that question, post them here, please!
Note: "Graphical User Interface (GUI): Includes such things as icons, panels, and interactive windows, to enable users to perform such actions as opening files and creating applications with the click of the mouse" (intoweb.co.za/et-linux-tips.html).
I'm currently reading a C# tutorial at techotopia.com, that seems to include not only C# basics but also useful information on how to use C# to get buttons, menus. etc. to actually do something. I only started reading the tutorial, though, so how useful it actually is I don't know yet.
I've now finished reading the C# tutorial at techotopia.com and learned some basic facts about how to actually make controls on a windows form do something. Had I known what I now know about C# earlier, I most likely would have chosen to learn that language before I started learning C++.
It's beyond me why each and every C++ GUI programs tutorial for beginners aren't written in the same style as the tutorials at techotopia.com. I see no reason why C++ GUI programs tutorials for beginners can't be both crammed with basic facts AND explain even the simplest things to people like me, that need such explanations to understand a new subject. Well, there probably are such tuturials, only I haven't found them.
Now is the time, I think, to make a short list of what steps I have taken to get where I am today when it comes to computer skills in general and ability to write computer programs in particular. I'm posting the list here for the benefit of people who wants to become good at writing computer programs but don't know how to reach that goal or have mislead themselves, as I have time and time again. It's not a final list in any way. It's just a short account of what have worked for me.
Step 1. Use lots of computer programs (word processors, image editors and what else you're interested in) to see what can be done with a computer.
Step 2. Write web pages with HTML and CSS. HTML, Hypertext Markupup Language, are used to tell browsers things like the beginning and end of paragraphs, the structure of tables and where to include images. CSS, Cascading Style Sheets, are used to add things like text-size and background-color to web pages.
Step 3. Improve your web pages with PHP. PHP, Hypertext Preprocessor, reminds of C# and C++ and is a server-side scripting language. Server-side means that something is done to a web page before it is sent to a visitor's browser, like adding code that makes it possible to send a message. PHP is easier for a beginner than C# and C++. Also, if you have written some HTML pages, you can gradually add PHP to these pages. In other words, you can learn how to use PHP in a familiar context.
Step 4. Learn C#. Reminds of PHP and C++. More difficult for a beginner than PHP but easier than C++. This is where I am right now. These links may be of at least some use:
Quick And Dirty Guide To Migrating PHP Code To C#
C# Station C# Tutorial on how to write console programs
dotnetperls.com
George Shepherd's Windows Forms FAQ
C# Corner
csharp-examples.net/examples (very short code snippets)
Visual C# at msdn.microsoft.com (probably more useful when you're no longer an absolute beginner; at least I think so)
Some basic C# tutorials (written by me and not amongst the best tutorials you can find; however, I would have found a page similar to this one useful when I first started learning C#)
Step 5. Learn C++. Reminds of PHP and C#. More difficult for a beginner than PHP and C#. Allows the programmer to control more than C#. Some people say it's faster than C#, while other people don't. This is where I hopefully will be within a year or so.
Since there are as many roads as there are budding programmers, these steps may not be right for you. Hopefully, though, the list above is of at least some assistence to you when you decide what steps to take to reach your goal.
If you know more about programming than I do and disagree with the list above, feel free to provide your own list. If you do, I think you should also explain why you think your list is better.
Charles Petzold wrote a book on that.
I haven't read it, but his Win32 UI book is widely known as hilarious, so it is expected to be good for beginners.
As you can probably already tell from other answers and comments, the term "Windows Forms" is the name for a specific .NET technology.
You seem to want to ask a question more along line of how to learn to write Windows programs that have a GUI (menus, buttons, windows, etc).
There is no single way to write a Windows program. C++ itself doesn't know anything about Windows. Instead you will end up using some API or framework. So what you need to do is choose which particular one you want to use and then learn that.
At the lowest level there is the raw
Windows API. However it is a very
C-like interface and few people would
recommend starting there.
Microsoft's C++ based framework for building Windows programs is MFC (Microsoft Foundation Classes). It was created long before .NET and C++/CLI and such. Being so old, there are aspects of it that haven't been able to change to keep with the times and so some people don't like it. But it's still supported and used. In fact, if you have a full version (not an express version) of Visual Studio then you already have MFC available.
There are various other C++ frameworks that have come along more recently. Qt and WxWidgets are a couple of the bigger names. Many of these not only give you a way to create Windows programs, but also try to abstract away all the OS-specific details so that your code can be compiled to work on other OS's (like Linux or Mac) too. In my opinion, these are often more pleasant to work with than MFC once you learn how.
Even though its not what you're asking for, many people would actually recommend using C# and .NET for making GUI programs in Windows. There are some nice aspects of that language and framework that make GUI programming easier.
So you probably need to do a little investigation to determine what technology you actually want to learn and use. Then you can go searching for appropriate tutorials.
A somewhat old thread but here's what could arguably be the updated Petzold replacement:
"Windows System Programming (4th Edition) (Addison-Wesley Microsoft Technology Series)"

Categories