请问怎样固定一个窗口的大小?
也就是不允许把窗口拉大或缩小!
也就是不允许把窗口拉大或缩小!
解决方案 »
- 获得分割窗口子窗口大小
- 正式上岗,发贴散分
- 关于导出dll类指针实例问题
- CListCtrl如何对其单元项进行实时编辑?
- ClassWizard出现错误:Parsing error:Identifier expected.Input Line:"private:"
- 关于PDF控件的问题~!要做一个类似Acrobat Distiller5.0的工具
- 请问拿儿有三元光栅操作的详细讲解(最好有源码)
- 剩下11分了 ;) 谁给我1个简单的directshow做的播放器?
- 如何拉长CComboBox(注:窗口本身,而不是下拉框)
- 用VC怎么实现打印预览(没装打印机)
- 如何设置CTreeCtrl 对象中的 ToolTip 的弹出延迟时间 ?
- 带CheckBox的ClistCtrl在Item被Check的时候激发的是什么消息?
//
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
if (m_dibImage.m_hObject) {
CSize sz = m_dibImage.GetSize(); // size of bitmap
CRect rcWin, rcClient;
GetWindowRect(&rcWin);
GetClientRect(&rcClient);
lpMMI->ptMaxSize = lpMMI->ptMinTrackSize = lpMMI->ptMaxTrackSize =
CPoint(sz.cx + rcWin.Width() - rcClient.Width(),
sz.cy + rcWin.Height()- rcClient.Height());
}
}
OnGetMinMaxInfo - Traps the WM_GETMINMAXINFO message to allow you to increase the size of the window.
IsFullScreen- Tests whether the application is in full screen mode.
OnUpdateViewFullScreen - Checks or unchecks the Full Screen menu item depending on the mode the application is in.
Sample Code void CMainFrame::OnViewFullScreen()
{
RECT rectDesktop;
WINDOWPLACEMENT wpNew; if (!IsFullScreen())
{
// need to hide all status bars
m_wndStatusBar.ShowWindow(SW_HIDE);
m_wndToolBar.ShowWindow(SW_HIDE); // We'll need these to restore the original state.
GetWindowPlacement (&m_wpPrev); m_wpPrev.length = sizeof m_wpPrev; //Adjust RECT to new size of window
::GetWindowRect ( ::GetDesktopWindow(), &rectDesktop );
::AdjustWindowRectEx(&rectDesktop, GetStyle(), TRUE,
GetExStyle()); // Remember this for OnGetMinMaxInfo()
m_FullScreenWindowRect = rectDesktop; wpNew = m_wpPrev;
wpNew.showCmd = SW_SHOWNORMAL;
wpNew.rcNormalPosition = rectDesktop; m_pwndFullScrnBar=new CToolBar; if(!m_pwndFullScrnBar->Create(this,
CBRS_SIZE_DYNAMIC|CBRS_FLOATING)
|| !m_pwndFullScrnBar->LoadToolBar(IDR_FULLSCREEN))
{
TRACE0("Failed to create toolbar\n");
return; // fail to create
} //don't allow the toolbar to dock
m_pwndFullScrnBar->EnableDocking(0);
m_pwndFullScrnBar->SetWindowPos(0,100,100,
0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);
m_pwndFullScrnBar->SetWindowText(_T("Full Screen"));
FloatControlBar(m_pwndFullScrnBar, CPoint(100,100));
m_bFullScreen=TRUE;
}
else
{
m_pwndFullScrnBar->DestroyWindow();
delete m_pwndFullScrnBar; m_bFullScreen=FALSE; m_wndStatusBar.ShowWindow(SW_SHOWNORMAL);
m_wndToolBar.ShowWindow(SW_SHOWNORMAL);
wpNew = m_wpPrev;
} SetWindowPlacement ( &wpNew );
} void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
if (IsFullScreen())
{
lpMMI->ptMaxSize.y = m_FullScreenWindowRect.Height();
lpMMI->ptMaxTrackSize.y = lpMMI->ptMaxSize.y;
lpMMI->ptMaxSize.x = m_FullScreenWindowRect.Width();
lpMMI->ptMaxTrackSize.x = lpMMI->ptMaxSize.x;
} } BOOL CMainFrame::IsFullScreen()
{
return m_bFullScreen;
} void CMainFrame::OnUpdateViewFullScreen(CCmdUI* pCmdUI)
{
pCmdUI->Enable(); if (IsFullScreen())
pCmdUI->SetCheck();
else
pCmdUI->SetCheck(0);
}