OJW
OJW

Reputation: 4632

Client-area of Tab control?

How to get the "inside" of a tab control, i.e. the area in which you can place controls?

// doesn't work:
WINDOWINFO tabsInfo;
GetWindowInfo(GetDlgItem(hwndDialog, IDC_TABS), &tabsInfo);
MoveWindow(someHwnd, tabsInfo.rcClient.left, tabsInfo.rcClient.top, ...

tabsInfo.rcClient gives the entire region used by the tab control, including its own controls

Upvotes: 4

Views: 2636

Answers (1)

casablanca
casablanca

Reputation: 70731

You can use TabCtrl_AdjustRect -- pass in the bounding rectangle of the tab control and on output, the rectangle will be adjusted to the content area.

Also, if you only need the client rectangle of the window, it's simpler to use GetClientRect instead of GetWindowInfo.

Upvotes: 8

Related Questions