Link to home
Start Free TrialLog in
Avatar of VSmolensky
VSmolensky

asked on

Completely changing the color of a form

Hi,

In Delphi, changing the color of a form doesn't affect the colors of buttons on this form, as well as the color of its main menu. Is there any way to totally change the color of the form, with all its controls?

Vadim Smolensky,
Saint-Petersburg, Russia
Avatar of DarkCore_
DarkCore_

Directly I think not ... but you can do a cursor for all components ...

for i := 0 to ComponentCount - 1 do Begin
    Components[i].Color := FormColor;
End;
there is some buttons that have a property Color in the JEDI package of components (TJvImgBtn, TJvHTButton)
http://homepages.borland.com/jedi/jvcl/
about TJvHTButton, when the property ParentColor is True (it is as defalt True) the button gets the color from the parent Form
Well there's a lot of problems with changing colors of components. Most are using winApi and their color cannot be changed. There is a way to do this but it will also change colors in all other apps. I was recently writing an app for a client who insisted to have all controls green. Some controls as buttons can be changed easily, but i was forced to write scrollbar component and use xp style mainmenu to fulfill client demands. One solution to make custom look for an app you can find here -> https://www.experts-exchange.com/questions/21184223/Defining-Classic-Windows-style-for-one-application.html i won't repeat myself the question was similiar...
Avatar of VSmolensky

ASKER

Thank you all for your comments.

Unfortunately, Components[i].Color doesn't work, which is only natural because TComponent has no Color property. Either I didn't understand something or you meant something different.

I've downloaded the JEDI package of components but can't understand what to do next. It seems to be an independent software which I have to install and use it for generating all their components. It that right? Isn't there a way of just installing the component I need?
As Said by esoftbg ... you can't control the back color of  most of components located in "Standard" Palette, but you can do with TMenuItems ( defining the OnDrawItem Event )

Also, all other components that have the property "Color" , as an example:
  if Components[i] is TMemo then TMemo( Components[i] ).Color := clWhite;

TButtons doesn't have the TColor Property or the OnDraw event, because are "painted" directly by windows, also the TBitButton. Of course you can use TSpeedButtons, but then you can't focus them with keyboard.

jedi is a collection of components that install into your Delphi Palette and becomes integrated with Delphi and your applications ( if you use them ). Then you can use the Jedi replacement for TButton,but this implies You must replace your buttons for this Jedi's button in all your application.

Edu
you have yet a directory:
....\JCL+JVCL210FullInstall
run from it:
Install.bat
and it will be apper:
Project JEDI Delphi Installer
Read carefully the check boxes to see what will be installed
Click on the button Install
and you will have JEDI - VCL Package installed
> you have yet a directory:
> ....\JCL+JVCL210FullInstall

Sorry, I haven't got a directory with such a name. Install.bat lies in the root directory called jvcl. When I run it, the installation started, but stopped at the step "Choose IDE targets" with the message "No JCL 1.9 found" - and it's still there, whatever directory I choose.
o.k. the direct link for JEDI package version 2.10 stable is:
http://belnet.dl.sourceforge.net/sourceforge/jvcl/JCL+JVCL210FullInstall.zip
download and unzip the file and you will have  directory ....\JCL+JVCL210FullInstall
I have already downloaded JVCL300BETA2Complete.zip - isn't it more or less the same?
Following the advice of phervers, I've downloaded the evaluation version of ThemeEngine. It seems to be a very powerful instrument. Would it be better to use ThemeEngine for making proper buttons than JEDI?
I am using vrsion 2.10, but it may be doesn't matter .... I hope it is a stable version ....
Just install it and from the tab Jv Additional you could be able to use the component TJvHTButton
About the ThemeEngine I don't know .... I don't use it yet .... Sorry. You may try it.
Theme Engine is commercial product so you have to pay for it. But it can do a lot more than changing button color you can make a completely theme'able application, here's a small example what you can make using it   http://vteam.webpark.pl/cuemaker.rar . But if you only want to change color of your buttons JVCL should make it for you. Or if u don't want to use any external components you can use bitmap buttons.
I'm thingking about buying ThemeEngine but I have some difficulties with its evaluation verion (for Delphi 6). After the installation, all its components are available in the palette, but applications with them don't run. The compiler says "File not found: te_engine.dcu". Though all the .dcu files lie in the directory ...Delphi6\themeengine and finding then shouldn't be a problem. Should I configure anything else? I couln't find the answer in the attached documents.
Well, try to add Delphi6\themeengine into your library path, in Menu Tools\Environment Options .. tab Library.

Edu
I am probably misunderstanding this but isn't there a property value called parentcolor?

IF this is set to true then the component adopts the color of the form otherwise it maintains its set colour.

Regards,

Hypoviax
The jvhtbutton allows this parentcolor property value (jvAdditional) unlike normal buttons

Regards,

Hypoviax
I tested TJvHTButton, when the property ParentColor is True with the Form that contains a Panel:
  Color of the form is clBtnFace - when I drop a JvHTButton on the Form it's color is clBtnFace;
  Color of the Panel is clMaroon - when I drop a JvHTButton on the Panel it's color is clMaroon;
  Then I did change the color of the Form to clBlue - the color of the JvHTButton which Parent is Form becomes clBlue, but other JvHTButton which Parent is Panel is still clMaroon as it's Parent color ....

So, JvHTButton gets the color from it's parent Component (Form, Panel, GroupBox ....)
So i am right am i not?

Regards,

Hypoviax
Sorry, i didn't read all your previous posts, my comments are what you, esoftbg were saying ;).

Oh well, it just confirms your post

Hypoviax
ASKER CERTIFIED SOLUTION
Avatar of phervers
phervers

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
Thank you, everybody, and sorry for my disappearance. I've purchased ThemeEngine. In many aspects it looks very impressive but still not free from some shortcomings. For example, the menu bar component they provide doesn't support radio items. The Theme Editor seems to be a powerful instrument but the help system is designed rather poorly and it's really difficult to understand how to use all its features. Is there any experts here who is an experienced user of ThemeEngine and especially of Theme Editor? Is there any material to read about it? Any discussions? The newsgroups on Theme Engine page are announced but closed.

V.S.