关于xp风格界面的问题。

xiaoyao888 2006-05-04 08:06:00
我使用在资源文件里加manifest文件的方法来实现XP风格界面
可是只有我自定义的工具栏是XP风格的,MDI框架的菜单和工具栏都是原来的样子。
不知道菜单和工具栏怎么才能像系统自带的程序那样有XP的风格?
难道只有自己定义的才行?
...全文
306 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoyao888 2007-03-29
  • 打赏
  • 举报
回复
为了结贴,转到这里来了
长尾巴的悟空 2007-03-29
  • 打赏
  • 举报
回复
真强
xiaoyao888 2006-05-14
  • 打赏
  • 举报
回复
老大们帮帮忙
xiaoyao888 2006-05-11
  • 打赏
  • 举报
回复
正相反,是MDI的,我用基于对话框的对菜单进行操作却没有问题,但在MDI下同样的操作却不起作用。
hjf80531 2006-05-11
  • 打赏
  • 举报
回复
楼主可能是一个基于对话框的程序:
如果的话..请手动添加以下内容:

1.在CPP文件中
BEGIN_MESSAGE_MAP
...
ON_WM_INITMENUPOPUP()
...
END_MESSAGE_MAP()

void CXXXDlg::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
{
ASSERT(pPopupMenu != NULL);
// Check the enabled state of various menu items.

CCmdUI state;
state.m_pMenu = pPopupMenu;
ASSERT(state.m_pOther == NULL);
ASSERT(state.m_pParentMenu == NULL);

// Determine if menu is popup in top-level menu and set m_pOther to
// it if so (m_pParentMenu == NULL indicates that it is secondary popup).
HMENU hParentMenu;
if (AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu)
state.m_pParentMenu = pPopupMenu; // Parent == child for tracking popup.
else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
{
CWnd* pParent = this;
// Child windows don't have menus--need to go to the top!
if (pParent != NULL &&
(hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)
{
int nIndexMax = ::GetMenuItemCount(hParentMenu);
for (int nIndex = 0; nIndex < nIndexMax; nIndex++)
{
if (::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu)
{
// When popup is found, m_pParentMenu is containing menu.
state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
break;
}
}
}
}

state.m_nIndexMax = pPopupMenu->GetMenuItemCount();
for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
state.m_nIndex++)
{
state.m_nID = pPopupMenu->GetMenuItemID(state.m_nIndex);
if (state.m_nID == 0)
continue; // Menu separator or invalid cmd - ignore it.

ASSERT(state.m_pOther == NULL);
ASSERT(state.m_pMenu != NULL);
if (state.m_nID == (UINT)-1)
{
// Possibly a popup menu, route to first item of that popup.
state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
if (state.m_pSubMenu == NULL ||
(state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
state.m_nID == (UINT)-1)
{
continue; // First item of popup can't be routed to.
}
state.DoUpdate(this, TRUE); // Popups are never auto disabled.
}
else
{
// Normal menu item.
// Auto enable/disable if frame window has m_bAutoMenuEnable
// set and command is _not_ a system command.
state.m_pSubMenu = NULL;
state.DoUpdate(this, FALSE);
}

// Adjust for menu deletions and additions.
UINT nCount = pPopupMenu->GetMenuItemCount();
if (nCount < state.m_nIndexMax)
{
state.m_nIndex -= (state.m_nIndexMax - nCount);
while (state.m_nIndex < nCount &&
pPopupMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
{
state.m_nIndex++;
}
}
state.m_nIndexMax = nCount;
}
}

在.H文件中
afx_msg void OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu);

这样你就可以用

ON_UPDATE_COMMAND_UI( ..., ... )
来更新你的菜单了
xiaoyao888 2006-05-11
  • 打赏
  • 举报
回复
不行啊,不管用啊
coolzdp 2006-05-08
  • 打赏
  • 举报
回复
CMenu menu;

VERIFY(menu.LoadMenu(IDR_MENU_REPORTITEM));

menu.EnableMenuItem(ID_DELETE, MF_BYCOMMAND | MF_GRAYED);
xiaoyao888 2006-05-05
  • 打赏
  • 举报
回复
就是在XP下
whwjn 2006-05-04
  • 打赏
  • 举报
回复
要在XP系统下才行
xiaoyao888 2006-05-04
  • 打赏
  • 举报
回复
还有个问题是我用
CMenu* pPopup = AfxGetMainWnd()->GetMenu();
pPopup->EnableMenuItem(ID_AA_START,MF_GRAYED|MF_BYCOMMAND| MF_DISABLED);
来禁用菜单项但却不起作用,该菜单项既没有变灰也没有变得无效,点它还是有反应,不知道为什么。我用
用MF_BYPOSITION的方式也不行。是MDI的。
难道是获得的菜单的指针不对吗?

1,649

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 非技术类
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧