UAC后TabControl显示异常 [英] TabControl shows abnormal after UAC
问题描述
大家好:
我用正常方式在MFC中创建Tab,
我发现有关Tab控件的问题最近。
在Win7中用用户帐户控制(UAC)打开另一个应用程序后,Tab变得异常。
喜欢这张图片:http://i.imgur.com/xntxhDV.jpg [ ^ ]
当问题发生时,它仍然可以使用,如果我在Tab中选择了另一个页面,它会正常!
我认为这是因为UAC之后显示的切片不正常...
希望有人可以帮我一把,
谢谢!!
我粘贴了下面的选项卡代码:
OnInitDialog()中的
:
Hi all:
I use the normal way to create the Tab in MFC,
and I find a problem about Tab control, recently.
The Tab is abnormal after I opened the another application with User Account Control(UAC) in Win7.
Like this picture: http://i.imgur.com/xntxhDV.jpg[^]
When the problem happened, it still can use, and if I selected the another page in Tab, it's gonna normal!
I think it happened because the slices of display is not normal after the UAC...
Hope someone can give me a hand,
thank you!!
I pasted my Tab code below:
in OnInitDialog( ):
TCITEM tc1,tc2;
tc1.mask = TCIF_TEXT;
tc1.pszText = _T("page1");
tc2.mask = TCIF_TEXT;
tc2.pszText = _T("page2");
m_tab.InsertItem(0, &tc1);
m_tab.InsertItem(1, &tc2);
CRect rec;
m_tab.GetClientRect(&rec);
//I don't show the edge about Tab
rec.bottom += 0;
rec.left -= 0;
rec.top += 20;
rec.right -= 0;
m_page1.Create(IDD_DIALOG1, GetDlgItem(IDC_TAB1));
m_page2.Create(IDD_DIALOG2, GetDlgItem(IDC_TAB1));
m_page1.MoveWindow(&rec);
m_page2.MoveWindow(&rec);
m_page1.ShowWindow(SW_SHOW);
m_page2.ShowWindow(SW_HIDE);
void Ctab3Dlg::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult)
{
switch (m_tab.GetCurSel())
{
case 0:
m_page1.ShowWindow(SW_SHOW);
m_page2.ShowWindow(SW_HIDE );
break;
case 1:
m_page1.ShowWindow(SW_HIDE);
m_page2.ShowWindow(SW_SHOW);
break;
default:
break;
}
*pResult = 0;
}
推荐答案
我们已经做了一些互动实验(请参阅问题的评论),试图更准确地描述症状,并最终找到问题。正如我所怀疑的那样,代码中的一些东西,我从代码示例中看不到,阻止了所有图形的正确重新渲染。对于下一步,尝试尝试两个函数:CWnd :: Invalidate
(首先)或CWnd :: RedrawWindow
:
http://msdn.microsoft.com/en-us /library/ax04k970.aspx [ ^ ],
http://msdn.microsoft.com/en -us / library / 0fdz8ey6.aspx [ ^ ]。
参见: http://msdn.microsoft.com/en-us/library/btaacw58.aspx [ ^ ]。
特别是,要在处理程序中使其无效或重绘消息WM_ACTIVATE
:
http: //msdn.microsoft.com/en-us/library/windows/desktop/ms646274%28v=vs.85%29.aspx [ ^ ]。
-SA
We have done some interactive experiments (please see comments to the question) in attempts to more accurately characterize the symptom and eventually locate the problem. As I suspected, something in the code, which I cannot see from the code sample, prevents proper re-rendering of all the graphics. For the next step, try to experiment with two functions:CWnd::Invalidate
(first of all) orCWnd::RedrawWindow
:
http://msdn.microsoft.com/en-us/library/ax04k970.aspx[^],
http://msdn.microsoft.com/en-us/library/0fdz8ey6.aspx[^].
See also: http://msdn.microsoft.com/en-us/library/btaacw58.aspx[^].
In particular, the to invalidate or redraw it in a handler of the messageWM_ACTIVATE
:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646274%28v=vs.85%29.aspx[^].
—SA
这篇关于UAC后TabControl显示异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!