Link to home
Start Free TrialLog in
Avatar of Ahmet Ekrem SABAN
Ahmet Ekrem SABANFlag for Austria

asked on

How to get filling effects for a colour under Windows Forms?

Hello!

I am involved in a C# Windows Forms project, where I am making the GUI. It is my first C# and Windows Forms project.

I have created several forms where I want to have a background colour with filling effects. The same is true for the buttons.

What I want is similar to that one can achieve with Microsoft Office applications, like Word, where you can add a drawing to a document over the menu "Insert" > "Graphic..." > "New drawing". You may change the colour of an object by clicking on it, then by clicking the right mouse button and selecting "Format AutoForm...", where the filling effects can be seen on the Color combo box (see the bottom of the colour list).

Thank you for your replies!
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

What you want to do requires a lot of work. Something like the gradient is quite easy, but textures usually require a lot of work if you want to end up with smooth operations, and patterns force you to be at ease with drawing with your code.

Just the form that is needed for user selection can end up being quite an endeavour.

If this is for a library that you want to reuse and have plenty of time, you could go for it, but if it is for use in only on or two applications, the time needed is probably an overkill.

If I were you, I would look for a kit of components that have the feature already built-in. And the results might look a lot more professional than what you could achieve unless you already have a good experience in graphics and working with the GDI+ library that is used for drawings.

The price you would pay for that would probably be a lot less than what it would cost you in time. There are many sources for those collections of components.

ComponentOne has a good set at http://www.componentone.com/SuperProducts/StudioWinForms/. Infragistics are also appreciated by most of the programmers who use their controls. Another good place to look is ComponentSource. If it exists, they have it, and they often have prices that are lower than what you could get by going straight to the vendor's site.

I don't do textures and patterns in my work, but if you want I can send you some sample code for gradients. It's from a VB application, but the code is similar in C# since we use the same classes.
Avatar of Ahmet Ekrem SABAN

ASKER

I am on vacation for a week.

I do not think that this much has to be spend for that, as I heard that a colleague here at our customer did it with Microsoft Visual Studio 2010. I will inform you, if it is true what I heard.
Your colleague might have found some OpenSource components.

Personally, specially for my professional jobs, I shy away from those, because they are often buggy or incomplete, and I always fear maintenance problems the day where Microsoft decides to drop or change something that makes a component unusable.

Reputable vendors usually will make their best to develop controls that comply with Microsoft recommandations, and they are close enough to Microsoft that they have access to early builds of a new OS or a new version of VS, so they are ready to send you an update when you need one.
ASKER CERTIFIED SOLUTION
Avatar of Ahmet Ekrem SABAN
Ahmet Ekrem SABAN
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found the solution by myself on the Internet
This is not a texture, this is a gradient.
That's correct! But I do not need any textures, but only a gradual change of colour from one to another.