views:

666

answers:

6

Hi, I was just wondering if there are ways of creating my own custom winforms controls? I've been plundering with Visual Studio 2008 now trying to do some c# apps. And the GUI end up looking terrible because of the standard winforms limitations.

And I noticed that I can add images to buttons for example, but ther's no hover effect. Or, the hover effect makes the whole button area gray. I don't want any of that, I just want to either create my own graphics for the controls or find some free (opensource perhaps) controls that already exist.

Any light on any of this, anyone? :)

A: 

First - may be more pragmatic to look at WPF, or hosting some WPF elements inside winforms (which is supported - like so). Other than that - you can do all your own painting if you want; but it is a lot of work.

Marc Gravell
Yeah, have gotten to know Expression Blend almost as good as Photoshop! :) It's fantastic! But I don't want the application to only work on Windows plattform. And that's the real problem. Whats Spotify written on excactly? They've been able to do it. So should I right? :)
Kenny Bones
Well, moonlight works on more than just windows, too.
Marc Gravell
+2  A: 

You can write complete Winforms controls from scratch, doing all the painting and input processing yourself - you just create a class derived from 'Control' and get on with it.

There's a fair bit to making a first-class control which integrates nicely with the VS designer, so people tend to derive their custom control from an existing control which has most of the behaviour they want.

Here would be a good place to start: http://msdn.microsoft.com/en-us/library/6hws6h2t.aspx

Will Dean
A: 

Any reason why you don't use WPF? You have much more more UI control if you went down the route.

If you must go with WinForms then there are many commercial solutions like DevExpress. If you really want you own look and feel it'll be alot of work.

Arkain
I know, I've already done alot of WPF the past year and have gotten to know it quite a bit. The "problem" is so to say that the application I'm working on should be able to port to other systems besides Windows. As far as I know, WPF can't be ported right?
Kenny Bones
WPF can rather easily be ported to SilverLight. But no it can't be ported to run on Mono yet. It seems you'll have to do this the hard way.
Arkain
A: 

Yes. You can create your own controls. It is called a User Control. Just select Add->and User Control.

WPF is a good alternative if you want your windows form to look fancy.

Wolf5
A "User Control" is really for controls which host other controls - it sounds like a "Custom Control" is what he wants
Will Dean
I just want to be able to design my own GUI, that's it. Don't know how I'm supposed to do this with winforms since I'm no programmer percé.I'm a designer and WPF is pretty nice. It's just the part of having it run on Linux and MAC that might make the decition.
Kenny Bones
A: 

Some very useful information on custom graphic you will find there (bobpowell). And some free, but nice looking user controls there (Componentfactory).

bezieur
A: 

I'm puzzled, you are doing WinForms development, yet in comments say you have done many months of WPF development, but WPF is not good enough because it is not cross platform.

How is WinForm more cross platform, and have you seen how ugly WinForms looks under mono on a Mac as it's draw via X11.

If you want style and cross platform, go for Flex or Silverlight, as your already know WPF I'd go the Silverlight route.

It's cross platform, and has all the beauty of WPF, but at the cost of reduced functionality out of the box.

Simeon Pilgrim
Interesting. I got pretty far in the WPF development, although, I didn't have any actual code implemented yet. Just spent countless hours doing the design. And everything stagnated because I couldn't find enough good info on WPF and how to do what I wanted. And now I'm picking it up again.
Kenny Bones
But can I create a standalone application based on SilverLight, not going through a webbrowser? Cause that's the whole point as well, I don't want to rely on internet access. Perhaps I use a webbrowser element and host it through there? That could have been smart.
Kenny Bones
The newest 'to be released' version of Silverlight 3.5 has standalone applications. Otherwise you could just self host the browser component.
Simeon Pilgrim