Visual c++ 通过鼠标单击选项卡来捕获选项卡更改事件
我有一个带有多个选项卡的Visual c++ 通过鼠标单击选项卡来捕获选项卡更改事件,visual-c++,mfc,Visual C++,Mfc,我有一个带有多个选项卡的CPropertySheet。每个选项卡都有不同的CPropertyPage类。如果用户单击一个页面(选项卡),则该页面将被激活。我如何知道用户是否单击了该选项卡或该页面中的其他位置 我试图在属性表类的PreTranslateMessage()中获取该事件(WM_LBUTTONDOWN) BOOL CMyPropertySheet::PreTranslateMessage(MSG* pMsg) { switch (pMsg->message) { c
CPropertySheet
。每个选项卡都有不同的CPropertyPage
类。如果用户单击一个页面(选项卡),则该页面将被激活。我如何知道用户是否单击了该选项卡或该页面中的其他位置
我试图在属性表类的PreTranslateMessage()
中获取该事件(WM_LBUTTONDOWN
)
BOOL CMyPropertySheet::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDOWN:
{
// here I need to handle if user clicks on page (Tabs)
// But this is invoking if user clicking inside page also
}
return CPropertySheet::PreTranslateMessage(pMsg);
}
我不知道该怎么办我真的很感激任何帮助 使用
TCN\u SELCHANGE
函数体是这样的
void CDlgName::OnTcnSelchangeFuncName(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: Add your control notification handler code here
int nCur = m_tabSettings.GetCurSel();
if(nCur == 0) //first tab clicked
{
//your code
}
else if(nCur == 1){ //Second tab clicked
//your code
}
else if(nCur == 2){ //Third tab clicked
{
//your code
}
*pResult = 0;
}
这可能会对您有所帮助。您想看一看并查看 它们提供了一个例子:
// CShapePage is the last wizard property page. Enable the Back
// button and change the Next button to Finish. The "Finish" button
// will have "Done" as its caption.
BOOL CShapePage::OnSetActive()
{
CPropertySheet* psheet = (CPropertySheet*) GetParent();
psheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH);
psheet->SetFinishText(_T("Done"));
return CPropertyPage::OnSetActive();
}
这就是我用的。您可以从类向导中实现它们。是否有任何理由需要知道工作表本身而不是页面?这两种功能都有各自的缺点。在处理页面更改时,根据一些输入,我必须关闭属性页并重新打开它(比如刷新之类的东西)。看见这就是为什么我需要在PretranslateMessage()中处理页面更改的原因。当然。PTM来营救。我有属性页和属性页。我不知道如何将它们转换为选项卡控件。如果你能提供更多的代码,我会很有帮助的。