 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Lars Guest
|
Posted: Wed Feb 22, 2006 11:03 am Post subject: TTrackBar Colors |
|
|
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
|
Posted: Wed Feb 22, 2006 5:03 pm Post subject: Re: TTrackBar Colors |
|
|
"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
|
Posted: Wed Mar 29, 2006 11:03 am Post subject: Re: TTrackBar Colors |
|
|
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 |
|
 |
|
|
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
|
|