[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2722
  • Last Modified:

TrackBar control on TabPage

I have TrackBar control on TabPage of TabControl (Windows Forms). Background color of TrackBar differs from TabPage background color. TabPage BackColor value is Transparent, and TrackBar BackColor is Control.
Transparent value is not allowed for a control. I tried to set it programmatically:

        private void FormOptions_Load(object sender, EventArgs e)
              trackBar1.BackColor = tabPage1.BackColor;

but this doesn't work. How can I set TrackBar BackColor to have the same background, without hardcoding which can fail on different display settings?
1 Solution
TrackBar doesn't support transparent background color for some strange reason... complain to microsoft..
The tabPage1.BackColor isn't used when TabPage.UseVisualStyleBackColor is true, for the standard windows theme the tabpage background is actually a gradient.

Here is a discussion about the problem, there is a link to a modified trackbar dll there, but no source code (I think).

AlexFMAuthor Commented:
Setting UseVisualStyleBackColor to false is quite enough for me, thanks.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now