本文介绍了如何在MFC中显示和隐藏选项卡控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想显示和隐藏changeTab上的控件.
我在尝试..
在头文件中

I want to show and hide the controls on changeTab.
I am trying..
In header file

struct ITEM
    {
        //HWND h;
        CWnd* wnd;      //our control
        int nID;
        int iTab;       //which tab it belongs to
        BOOL bTabStop;  //does this control allow tabstop
    };


在C ++文件中


In c++ file

m_cTab.InsertItem(0,"Register new user");
	m_cTab.InsertItem(1,"Identify fingerprints");



void CMyTabCtrl::ShowTab(int iTab)
{

	iCtrl = -1;//reset any control which may be selected in a tab

	if(iCurrentTab == iTab)//already focused on selected tab
	{
		return;
	}
	//save old tab location so we can hide its controls
	int iOldTab = iCurrentTab;
	iCurrentTab = iTab;

	//check if tab is in focus, if not, put it in focus
	int t = GetCurFocus();
	if(iTab != t)
	{
		SetCurSel(iTab);
	}

	//hide old tabs controls, show the selected tab's controls
	INT_PTR iCount = obArray.GetCount();
	for(INT_PTR i=0; i<iCount; i++)
	{

		ITEM* pItem = (ITEM*)obArray[i];
		if(pItem->iTab == iOldTab)
		{
			pItem->wnd->ShowWindow(SW_HIDE);
		}
		else if(pItem->iTab == iCurrentTab)
		{
			pItem->wnd->ShowWindow(SW_SHOW);
		}
	}
}


当我单击Tab 1时,即iTab = 1,它显示Tab 1项,但隐藏Tab 0项.


When I click Tab 1 i.e. iTab=1,It shows Tab 1 item but does hide Tab 0 items.

推荐答案



这篇关于如何在MFC中显示和隐藏选项卡控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:17