Jump to content

Getbkcolor Not Working On A Tab Control


jpm
 Share

Recommended Posts

// NOT WORKING WHY ???? nColor= -1
HDC hDC=GetDC(m_hWndGUITab);
nColor = GetBkColor(hDC);
ReleaseDC(m_hWndGUITab,hDC);

Why this code set always ncolor to -1 the Handle is a tab control? :D

Thanks for the help

Link to comment
Share on other sites

Hi JP,

maybe this one from MSDN says why:

http://msdn.microsoft.com/library/default.....setbkcolor.asp

CTabCtrl::SetBkColor

Remarks

The SetBkColor and GetBkColor member functions are not valid for class CTabCtrl. These member functions are not implemented in MFC because the underlying Windows 95 TCM_SETCOLOR message was not implemented.

Link to comment
Share on other sites

JP, I searched MSDN library for "TCM_SETCOLOR" and it turned up 2 results, both saying what Holger posted. I also searched in Visual Studio for TCM_SETCOLOR and it couldn't find the symbol. I don't know exactly how much stock I would put in an example from MFC, but I would recommend first searching CodeProject.com and if you can't find anything there, search the web.

Link to comment
Share on other sites

JP, I searched MSDN library for "TCM_SETCOLOR" and it turned up 2 results, both saying what Holger posted.  I also searched in Visual Studio for TCM_SETCOLOR and it couldn't find the symbol.  I don't know exactly how much stock I would put in an example from MFC, but I would recommend first searching CodeProject.com and if you can't find anything there, search the web.

Thanks Valik,

I am not use to codeproject but I will have a try.

Holger or CyberSlug point me to the whole stuff to paint the tab control in fact it is only painting the tabs names but that a lot of code for small impact.

I just want to manage the may the color for control created for a tab fit with the tab default background color.

Link to comment
Share on other sites

@jpm: is it possible (somehow) to 'paint' a rectangle with the backgroundcolor over the tab-control?

Like if you write an empty label-control over the false-colored area...

But after that the added tabs should be visible...

I don't know...a big MS-logical problem I think... I don't know if other programming-languages has this feature...

Link to comment
Share on other sites

@jpm: is it possible (somehow) to 'paint' a rectangle with the backgroundcolor over the tab-control?

Like if you write an empty label-control over the false-colored area...

But after that the added tabs should be visible...

I don't know...a big MS-logical problem I think... I don't know if other programming-languages has this feature...

Thanks,

That's a solution I first use for painting before Larry and Valik found more basic way to do it perhaps I will came back to the tabitem being a control with color attribute. That's not solving the gray left top corner.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...