How to change color of Tab View in MFC
-
Hi. In my MFC application, i created a class which is derived from CTabView and created few tabs(views) using AddView(). Now i want to change the color of the tab views. May i know how to change the background color of those views? Thanks in Advance.
-
Hi. In my MFC application, i created a class which is derived from CTabView and created few tabs(views) using AddView(). Now i want to change the color of the tab views. May i know how to change the background color of those views? Thanks in Advance.
Do you want t change the color of the view (your CView derived class added using AddView)? Or the color of the tabview control itself? if the former - see [Paint back color of CScrollView derived class.](http://forums.codeguru.com/showthread.php?393096.html) if the latter - see [CMFCBaseTabCtrl::SetActiveTabTextColor](https://msdn.microsoft.com/en-us/library/bb983503.aspx#cmfcbasetabctrl\_\_setactivetabcolor), [CMFCBaseTabCtrl Class](https://msdn.microsoft.com/en-us/library/bb983503.aspx#cmfcbasetabctrl\_\_setactivetabtextcolor)
-
Do you want t change the color of the view (your CView derived class added using AddView)? Or the color of the tabview control itself? if the former - see [Paint back color of CScrollView derived class.](http://forums.codeguru.com/showthread.php?393096.html) if the latter - see [CMFCBaseTabCtrl::SetActiveTabTextColor](https://msdn.microsoft.com/en-us/library/bb983503.aspx#cmfcbasetabctrl\_\_setactivetabcolor), [CMFCBaseTabCtrl Class](https://msdn.microsoft.com/en-us/library/bb983503.aspx#cmfcbasetabctrl\_\_setactivetabtextcolor)
I want the first one i.e., changing the background color of the CView. I tried with below call SetClassLong(GetActiveView()->GetSafeHwnd(), 0, RGB(255, 0, 0)); but it dint work.
-
I want the first one i.e., changing the background color of the CView. I tried with below call SetClassLong(GetActiveView()->GetSafeHwnd(), 0, RGB(255, 0, 0)); but it dint work.
Sampath579 wrote:
I tried with below call SetClassLong(GetActiveView()->GetSafeHwnd(), 0, RGB(255, 0, 0)); but it dint work.
And how should it "work"? Where did you find this strange code? Did you read the [SetClassLong function (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ms633588(v=vs.85).aspx) documentation in MSDN? :confused: I posted you a link to the Forum where you can find a working code. Why did you ignore it? :confused:
-
Sampath579 wrote:
I tried with below call SetClassLong(GetActiveView()->GetSafeHwnd(), 0, RGB(255, 0, 0)); but it dint work.
And how should it "work"? Where did you find this strange code? Did you read the [SetClassLong function (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ms633588(v=vs.85).aspx) documentation in MSDN? :confused: I posted you a link to the Forum where you can find a working code. Why did you ignore it? :confused:
Thanks. Its working fine.
-
Thanks. Its working fine.
:thumbsup: :)