I created a tab control and several tab items on it. I want my tab control (the region where no items ) background have a good appearence. So I used GradientFill to draw the tab control. But doing this, the tab items are disappeared. This is not the same situation for parent-child window. So am I supposed to draw the tab items also if I want to change the background of the tab control?
Here is the code:
switch(message) {
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
RECT rectTabControl;
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rectTabControl);
TRIVERTEX vert[2] ;
GRADIENT_RECT gRect;
vert [0] .x = 0;
vert [0] .y = 0;
vert [0] .Red = 0x1000;
vert [0] .Green = 0x0000;
vert [0] .Blue = 0x0000;
vert [0] .Alpha = 0x0000;
vert [1] .x = rectTabControl.right;
vert [1] .y = rectTabControl.bottom;
vert [1] .Red = 0xff00;
vert [1] .Green = 0x0000;
vert [1] .Blue = 0x0000;
vert [1] .Alpha = 0x0000;
gRect.UpperLeft = 0;
gRect.LowerRight = 1;
GradientFill(hdc,vert,2,&gRect,1,GRADIENT_FILL_RECT_H);
EndPaint(hwnd, &ps);
return 0;
}
“So am I supposed to draw the tab items also if I want to change the background of the tab control?”
Yes.