BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TTrackBar Colors

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Lars
Guest





PostPosted: Wed Feb 22, 2006 11:03 am    Post subject: TTrackBar Colors Reply with quote



Hi

How to change colors on a TTrackBar?

I put a TTrackBar on a TPanel and I want the TrackBar to use the same
background color as the Panel.
But the TrackBar color dos not change, it is the same as the Panel color at
design / build time.

tryed to find any ->Color property on TTracBar but I faild.

It woud be nice to set color for the handel, background and window in the
TTrackBar, is it posible?

/ Lars
Back to top
Thorsten Kettner
Guest





PostPosted: Wed Feb 22, 2006 5:03 pm    Post subject: Re: TTrackBar Colors Reply with quote



"Lars" <lgu (AT) promare (DOT) se> wrote:
Quote:
I put a TTrackBar on a TPanel and I want the TrackBar to use
the same background color as the Panel. But the TrackBar color
dos not change, it is the same as the Panel color at design /
build time.

The Trackbar is supposed to take the same color as its parent
control (your panel). It just doesn't work correctly. In my
version of BCB (6 Ent) the color changes, when the trackbar
gets focus. So I can solve the problem here as follows:

Panel1->Color = clRed;
TrackBar1->SetFocus();

Maybe that works for you, too?

If want the tackbar to have another color, then set the brush
color. Try this:

Panel1->Color = clRed;
TrackBar1->Brush->Color = clBlue;
TrackBar1->SetFocus();

Quote:
It woud be nice to set color for the handel, background and
window in the TTrackBar, is it posible?

Yes. You would have to use Windows API functions. The trackbar
is actually a Windows control wrapped by the VCL TTrackBar. Use
the TrackBar's Handle to access the underlying Windows trackbar,
catch Windows messages and do the painting. If you google for
"windows trackbar colors" in Google Groups you will find some
code snippets to show what I am talking about.
Back to top
Lars
Guest





PostPosted: Wed Mar 29, 2006 11:03 am    Post subject: Re: TTrackBar Colors Reply with quote



Thank you!
It is a bit of work to fix it!
I have to check if the trackbar are visible first to be abel to setfocus.

if(ControlPanel->Visible){
try {
FrekvensTB->SetFocus();
GainTB->SetFocus();
PreGainTB->SetFocus();
}
}

And I have alot of TTrackBars in my program....

/Lars

"Thorsten Kettner" <ANSWERBYthorsten.kettner (AT) otto (DOT) de> skrev i meddelandet
news:43fc8903$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Lars" <lgu (AT) promare (DOT) se> wrote:
I put a TTrackBar on a TPanel and I want the TrackBar to use
the same background color as the Panel. But the TrackBar color
dos not change, it is the same as the Panel color at design /
build time.

The Trackbar is supposed to take the same color as its parent
control (your panel). It just doesn't work correctly. In my
version of BCB (6 Ent) the color changes, when the trackbar
gets focus. So I can solve the problem here as follows:

Panel1->Color = clRed;
TrackBar1->SetFocus();

Maybe that works for you, too?

If want the tackbar to have another color, then set the brush
color. Try this:

Panel1->Color = clRed;
TrackBar1->Brush->Color = clBlue;
TrackBar1->SetFocus();

It woud be nice to set color for the handel, background and
window in the TTrackBar, is it posible?

Yes. You would have to use Windows API functions. The trackbar
is actually a Windows control wrapped by the VCL TTrackBar. Use
the TrackBar's Handle to access the underlying Windows trackbar,
catch Windows messages and do the painting. If you google for
"windows trackbar colors" in Google Groups you will find some
code snippets to show what I am talking about.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.