本文整理汇总了C++中GetTabControl函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTabControl函数的具体用法?C++ GetTabControl怎么用?C++ GetTabControl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTabControl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dc
void CXTPColorDialog::SetNewColor(COLORREF clr, BOOL bNotify/*= TRUE*/)
{
m_clrNew = clr;
if (IsWindowVisible())
{
CClientDC dc(this);
dc.FillSolidRect(&m_rcNew, m_clrNew);
if (m_dwStyle & CPS_XTP_SHOWHEXVALUE)
{
m_wndHexEdit.SetWindowText(RGBtoHex(m_clrNew));
}
}
if (bNotify && GetTabControl() && GetTabControl()->GetSafeHwnd())
{
int iPage;
for (iPage = 0; iPage < GetPageCount(); ++iPage)
{
CWnd* pWnd = GetPage(iPage);
if (::IsWindow(pWnd->GetSafeHwnd()))
{
pWnd->SendMessage(WM_XTP_UPDATECOLOR,
(WPARAM)m_clrNew, (LPARAM)m_hWnd);
}
}
}
}
示例2: GetClientRect
void CResizableSheet::PresetLayout()
{
CWnd* pWnd; // points to various children
CRect wndrc, objrc;
GetClientRect(&wndrc);
// tab control or wizard line position
if (m_psh.dwFlags & PSH_WIZARD) // wizard mode
{
// get wizard line's bottom-right corner
pWnd = GetDlgItem(ID_WIZLINE);
// hide tab control
GetTabControl()->ShowWindow(SW_HIDE);
}
else // tabbed mode
{
// get tab control's bottom-right corner
pWnd = GetTabControl();
}
// whatever it is, take the right margin
pWnd->GetWindowRect(&objrc);
ScreenToClient(&objrc);
m_szLayoutTabLine.cx = objrc.right - wndrc.right;
m_szLayoutTabLine.cy = objrc.bottom - wndrc.bottom;
// get child dialog's bottom-right corner
pWnd = GetActivePage();
pWnd->GetWindowRect(&objrc);
ScreenToClient(&objrc);
m_szLayoutPage.cx = objrc.right - wndrc.right;
m_szLayoutPage.cy = objrc.bottom - wndrc.bottom;
// store buttons position
for (int i = 0; i < 7; i++)
{
pWnd = GetDlgItem(_propButtons[i]);
if (pWnd == NULL)
{
// invalid position, button does not exist
// (just to initialize, any button you may activate
// in the future is present, but hidden)
m_szLayoutButton[i].cx = 0;
m_szLayoutButton[i].cy = 0;
continue;
}
pWnd->GetWindowRect(&objrc);
ScreenToClient(&objrc);
m_szLayoutButton[i].cx = objrc.left - wndrc.right;
m_szLayoutButton[i].cy = objrc.top - wndrc.bottom;
}
}
示例3: switch
void CEOSSPropertySheet::SetTabColor(int Tab,COLORREF Color)
{
if (Tab != IDC_EOSSDATA_TAB) return;
int ColorIndex;
int tab = 0;
switch(Color) {
case COLOR_RED:
ColorIndex = 0;
break;
case COLOR_GREEN:
ColorIndex = 1;
break;
case COLOR_BLUE:
ColorIndex = 2;
break;
case COLOR_YELLOW:
ColorIndex = 3;
break;
case COLOR_CYAN:
ColorIndex = 4;
break;
case COLOR_MAGENTA:
ColorIndex = 5;
break;
case COLOR_WHITE:
ColorIndex = 6;
break;
case COLOR_BLACK:
ColorIndex = 7;
break;
case COLOR_GREENRED:
ColorIndex = 8;
break;
case COLOR_BLUERED:
ColorIndex = 9;
break;
case COLOR_REDYELLOW: // jfl, note map of status 3 to image 10
ColorIndex = 10;
break;
default:
ColorIndex = 6;
};
TC_ITEM pTabCtrlItem;
pTabCtrlItem.mask = TCIF_IMAGE;
pTabCtrlItem.iImage = ColorIndex;
switch (Tab) {
case IDC_EOSSDATA_TAB: tab = 1; break;
// case IDC_BINARYEOSSDATA_TAB: tab = 2; break;
// case IDC_UGRANDEOSSDATA_TAB: tab = 3; break;
// case IDC_GPSDATA_TAB: tab = 3; break;
// case IDC_VACOSSDATA_TAB: tab = 4; break;
};
GetTabControl()->SetItem(tab,&pTabCtrlItem);
GetTabControl()->Invalidate();
}
示例4: GetWindowRect
void CResizableSheet::PresetLayout()
{
// set the initial size as the min track size
CRect rc;
GetWindowRect(&rc);
SetMinTrackSize(rc.Size());
if (GetStyle() & WS_CHILD)
{
GetClientRect(&rc);
GetTabControl()->MoveWindow(&rc);
}
if (IsWizard()) // wizard mode
{
// hide tab control
GetTabControl()->ShowWindow(SW_HIDE);
AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT);
}
else // tab mode
{
AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT);
}
// add a callback for active page (which can change at run-time)
m_nCallbackID = AddAnchorCallback();
// use *total* parent size to have correct margins
CRect rectPage, rectSheet;
GetTotalClientRect(&rectSheet);
GetActivePage()->GetWindowRect(&rectPage);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2);
// pre-calculate margins
m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft();
m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight();
// add all possible buttons, if they exist
for (int i = 0; i < _propButtonsCount; i++)
{
if (NULL != GetDlgItem(_propButtons[i]))
AddAnchor(_propButtons[i], BOTTOM_RIGHT);
}
// prevent flickering
GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS);
}
示例5: ASSERT_VALID
//***************************************************************************************
void CBCGPropertySheet::AddPageToTree (CBCGPropSheetCategory* pCategory,
CBCGPropertyPage* pPage, int nIconNum,
int nSelIconNum)
{
ASSERT_VALID (this);
ASSERT_VALID (pPage);
ASSERT (m_look == PropSheetLook_Tree);
if (pCategory != NULL)
{
ASSERT_VALID (pCategory);
pCategory->m_lstPages.AddTail (pPage);
}
pPage->m_pCategory = pCategory;
pPage->m_nIcon = nIconNum;
pPage->m_nSelIconNum = nSelIconNum;
CPropertySheet::AddPage (pPage);
if (GetSafeHwnd () != NULL)
{
CTabCtrl* pTab = GetTabControl ();
ASSERT_VALID (pTab);
InternalAddPage (pTab->GetItemCount () - 1);
}
}
示例6: ModifyStyleEx
BOOL OptionsDialog::OnInitDialog()
{
CPropertySheet::OnInitDialog();
// Enable context sensitive help
ModifyStyleEx(0,WS_EX_CONTEXTHELP);
// Create the font to use
m_font.CreateFontIndirect(&m_logFont);
// Set the font for the property pages
ChangeDialogFont(this,&m_font);
CPropertyPage* page = GetActivePage();
for (int i = 0; i < GetPageCount(); i++)
{
SetActivePage(i);
CPropertyPage* page = GetActivePage();
ChangeDialogFont(page,&m_font);
}
SetActivePage(page);
// Resize the property page
CTabCtrl* tab = GetTabControl();
tab->GetWindowRect(&m_page);
ScreenToClient(&m_page);
tab->AdjustRect(FALSE,&m_page);
page->MoveWindow(&m_page);
return TRUE;
}
示例7: CRect
BOOL CPropSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
// TODO: Add your specialized code here
CRect rect, tabrect;// = CRect (800, 440, 950, 645);//, tabrect;
int width;
//Get button sizes and positions
GetDlgItem(IDCANCEL)->GetWindowRect(rect);
GetTabControl()->GetWindowRect(tabrect);
ScreenToClient(rect); ScreenToClient(tabrect);
//New button - width, height and Y-coordiate of IDOK
// - X-coordinate of tab control
width = rect.Width();
rect.left = tabrect.left; rect.right = tabrect.left + width;
CString FeedbackChoice = GetGlobal("FeedbackChoice");
CString FeedbackButtonName = GetGlobal("FeedbackButtonName");
if (FeedbackChoice.Compare("Yes") == 0)
{
//Create new "Add" button and set standard font
m_ButtonCopy.Create(FeedbackButtonName,
BS_PUSHBUTTON|WS_CHILD|WS_VISIBLE|WS_TABSTOP,
rect, this, IDC_FEEDBACK_BUTTON);
m_ButtonCopy.SetFont(GetFont());
}
else
;
SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE);
SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE);
return bResult;
}
示例8: MinMaxInfo
void CResizableSheet::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
MinMaxInfo(lpMMI);
CTabCtrl* pTab = GetTabControl();
if (!pTab)
return;
int nCount = GetPageCount();
for (int idx = 0; idx < nCount; ++idx)
{
if (IsWizard()) // wizard mode
{
// use pre-calculated margins
CRect rectExtra(-CPoint(m_sizePageTL), -CPoint(m_sizePageBR));
// add non-client size
::AdjustWindowRectEx(&rectExtra, GetStyle(), !(GetStyle() & WS_CHILD) &&
::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
ChainMinMaxInfo(lpMMI, *GetPage(idx), rectExtra.Size());
}
else // tab mode
{
ChainMinMaxInfoCB(lpMMI, *GetPage(idx));
}
}
}
示例9: PropSheet_GetCurrentPageHwnd
void CTreePropSheet::UpdateCaption()
{
HWND hPage = PropSheet_GetCurrentPageHwnd(GetSafeHwnd());
BOOL bRealPage = IsWindow(hPage) && ::IsWindowVisible(hPage);
HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
if (!hItem)
return;
CString strCaption = m_pwndPageTree->GetItemText(hItem);
// if empty page, then update empty page message
if (!bRealPage)
m_pFrame->SetMsgText(GenerateEmptyPageMessage(m_strEmptyPageMessage, strCaption));
// if no captions are displayed, cancel here
if (!m_pFrame->GetShowCaption())
return;
// get tab control, to the the images from
CTabCtrl *pTabCtrl = GetTabControl();
if (!IsWindow(pTabCtrl->GetSafeHwnd()))
{
ASSERT(FALSE);
return;
}
if (m_bTreeImages)
{
// get image from tree
int nImage;
m_pwndPageTree->GetItemImage(hItem, nImage, nImage);
HICON hIcon = m_Images.ExtractIcon(nImage);
m_pFrame->SetCaption(strCaption, hIcon);
if (hIcon)
DestroyIcon(hIcon);
}
else if (bRealPage)
{
// get image from hidden (original) tab provided by the original
// implementation
CImageList *pImages = pTabCtrl->GetImageList();
if (pImages)
{
TCITEM ti;
ZeroMemory(&ti, sizeof(ti));
ti.mask = TCIF_IMAGE;
HICON hIcon = NULL;
if (pTabCtrl->GetItem((int)m_pwndPageTree->GetItemData(hItem), &ti))
hIcon = pImages->ExtractIcon(ti.iImage);
m_pFrame->SetCaption(strCaption, hIcon);
if (hIcon)
DestroyIcon(hIcon);
}
else
m_pFrame->SetCaption(strCaption);
}
else
m_pFrame->SetCaption(strCaption);
}
示例10: ScreenToClient
void CitPropertySheet::listinit()
{
LVITEM lvi;
::ZeroMemory(&lvi,sizeof(lvi));
CHeaderCtrl* pHeader=m_wndList.GetHeaderCtrl();
pHeader->ShowWindow(SW_HIDE);
CRect rectList;
m_wndList.GetWindowRect(&rectList);
ScreenToClient(&rectList);
//添加列表头,前面已经隐藏
m_wndList.InsertColumn(0,_T("设置"),LVCFMT_CENTER,rectList.Width(),0);
CString str;
CTabCtrl* pTab=GetTabControl();
TCITEM tci;
::ZeroMemory(&tci,sizeof(tci));
tci.mask=TCIF_TEXT;
tci.cchTextMax=256;
TCHAR szBuf[256]={0};
tci.pszText=szBuf;
for(int idxPge=0;idxPge<GetPageCount();idxPge++)
{
if(pTab->GetItem(idxPge,&tci))
{
lvi.iItem=idxPge;
lvi.iSubItem=0;
//lvi.iImage=idxPge;
lvi.mask=LVIF_TEXT; //LVIF_IMAGE;
lvi.pszText=tci.pszText;
m_wndList.InsertItem(&lvi);
}
}
}
示例11: GetTabControl
void CResizableSheet::PresetLayout()
{
if (IsWizard()) // wizard mode
{
// hide tab control
GetTabControl()->ShowWindow(SW_HIDE);
AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT);
}
else // tab mode
{
AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT);
}
// add a callback for active page (which can change at run-time)
AddAnchorCallback(1);
// use *total* parent size to have correct margins
CRect rectPage, rectSheet;
GetTotalClientRect(&rectSheet);
GetActivePage()->GetWindowRect(&rectPage);
ScreenToClient(&rectPage);
// pre-calculate margins
m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft();
m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight();
// add all possible buttons, if they exist
for (int i = 0; i < 7; i++)
{
if (NULL != GetDlgItem(_propButtons[i]))
AddAnchor(_propButtons[i], BOTTOM_RIGHT);
}
}
示例12: ZeroMemory
void CResizableSheet::SaveWindowRect()
{
CString data;
WINDOWPLACEMENT wp;
ZeroMemory(&wp, sizeof(WINDOWPLACEMENT));
wp.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(&wp);
RECT& rc = wp.rcNormalPosition; // alias
// also saves active page index, zero (the first) if problems
// cannot use GetActivePage, because it always fails
CTabCtrl *pTab = GetTabControl();
int page = 0;
if (pTab != NULL)
page = pTab->GetCurSel();
if (page < 0)
page = 0;
// always save page
data.Format(PROFILE_FMT, rc.left, rc.top,
rc.right, rc.bottom, wp.showCmd, wp.flags, page);
AfxGetApp()->WriteProfileString(m_sSection, m_sEntry, data);
}
示例13: GetActivePage
BOOL CCustomPropSheet::OnInitDialog(void)
{
__super::OnInitDialog();
// get the font for the first active page
CPropertyPage* pCurPage = GetActivePage();
ASSERT(pCurPage != NULL);
// change the font for the sheet
ChangeDialogFont(this, &m_fontPage, CDF_CENTER);
// change the font for each page
for (int i = 0, cPages = GetPageCount(); i < cPages; ++i)
{
CPropertyPage* pPage = GetPage(i);
ASSERT(pPage != NULL);
#if !defined(_BUGFIX_)
ChangeDialogFont(pPage, &m_fontPage, CDF_CENTER);
#else
ChangeDialogFont(pPage, &m_fontPage, CDF_TOPLEFT);
#endif // _BUGFIX_
}
// set and save the size of the page
CTabCtrl* pTab = GetTabControl();
ASSERT(pTab != NULL);
if ((m_psh.dwFlags & PSH_WIZARD) != 0)
{
pTab->ShowWindow(SW_HIDE);
#if !defined(_BUGFIX_)
GetClientRect(&m_rcPage);
CWnd* pButton = GetDlgItem(ID_WIZBACK);
ASSERT(pButton != NULL);
CRect rectButton;
pButton->GetWindowRect(rectButton);
ScreenToClient(rectButton);
m_rcPage.bottom = rectButton.top - 2;
#else
CRect rectDivider;
CWnd* pDivider = GetDlgItem(0x3026);
ASSERT(pDivider != NULL);
pDivider->GetWindowRect(rectDivider);
ScreenToClient(rectDivider);
m_rcPage.bottom = rectDivider.top - 2;
#endif // _BUGFIX_
}
else
{
pTab->GetWindowRect(&m_rcPage);
ScreenToClient(&m_rcPage);
pTab->AdjustRect(FALSE, &m_rcPage);
}
// resize the page
pCurPage->MoveWindow(&m_rcPage);
return (TRUE);
}
示例14: GetTabControl
BOOL CTreePropSheet::SelectCurrentPageTreeItem()
{
CTabCtrl *pTab = GetTabControl();
if (!IsWindow(pTab->GetSafeHwnd()))
return FALSE;
return SelectPageTreeItem(pTab->GetCurSel());
}
示例15: GetTabControl
//****************************************************************************************
void CBCGPropertySheet::InternalAddPage (int nTab)
{
CTabCtrl* pTab = GetTabControl ();
ASSERT_VALID (pTab);
TCHAR szTab [256];
TCITEM item;
item.mask = TCIF_TEXT;
item.cchTextMax = 255;
item.pszText = szTab;
pTab->GetItem (nTab, &item);
if (m_wndOutlookBar.GetSafeHwnd () != NULL)
{
HICON hIcon = m_Icons.ExtractIcon (nTab);
m_wndOutlookBar.AddButton (hIcon, szTab, 0, (UINT) -1, (UINT) -1, m_bAlphaBlendIcons);
::DestroyIcon (hIcon);
}
if (m_wndTree.GetSafeHwnd () != NULL)
{
CBCGPropertyPage* pPage = DYNAMIC_DOWNCAST (CBCGPropertyPage, GetPage (nTab));
if (pPage == NULL)
{
ASSERT (FALSE);
return;
}
HTREEITEM hParent = NULL;
if (pPage->m_pCategory != NULL)
{
ASSERT_VALID (pPage->m_pCategory);
hParent = pPage->m_pCategory->m_hTreeItem;
}
HTREEITEM hTreeItem = m_wndTree.InsertItem (szTab,
I_IMAGECALLBACK, I_IMAGECALLBACK, hParent);
m_wndTree.SetItemData (hTreeItem, (DWORD_PTR) pPage);
pPage->m_hTreeNode = hTreeItem;
}
if (m_wndTab.GetSafeHwnd () != NULL)
{
CBCGPropertyPage* pPage = DYNAMIC_DOWNCAST (CBCGPropertyPage, GetPage (nTab));
if (pPage == NULL)
{
ASSERT (FALSE);
return;
}
UINT uiImage = m_Icons.GetSafeHandle () == NULL ? (UINT)-1 : nTab;
m_wndTab.AddTab (pPage, szTab, uiImage);
}
}