change tab control bg color
-
how to change the tab contol background color? thnx in advance
-
how to change the tab contol background color? thnx in advance
You'll have to handle painting yourself since
TabControl.BackColor
always returnsSystemColors.Control
. You'll have to extendTabControl
with your own class and overrideOnPaint
to do so. There should be several articles here on CP ( I knew of a good one, but the bastard went commercial and pulled all his articles off CP after he got all our free help and beta testing! :mad: ) Why is this so hard? Because almost every control inSystem.Windows.Forms
is just a wrapper for its Windows Common Controls equivalent where such details are often abstracted or don't fit the .NET pattern at all times. It is possible, though. I used a similar approach to override the painting for the actualTagPage
s in order to make them use the Theme API (for Visual Styles) correctly (they don't by default). [EDIT] Note: this is only for theTabControl
itself. To paint theTabPage
s, see the next message I posted (memory slipped!). [/EDIT]-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
how to change the tab contol background color? thnx in advance
You can set the
TabControl.DrawMode
toTabDrawMode.OwnerDrawFixed
and 1) handle theTabControl.DrawItem
event if handling the painting from another control, or 2) override theTabControl.OnDrawItem
if extending theTabControl
with your own class (faster than handling the event inside a derivitive class). [EDIT] Note: this is only for theTabPage
s. See the previous message about theTabControl
itself. [/EDIT]-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----