Esempio n. 1
0
void CGrabSpecalRedPacket::OnSize(UINT nType, int cx, int cy)
{
	CDialogEx::OnSize(nType, cx, cy);

	// TODO: 在此处添加消息处理程序代码
	if( NULL != GetSafeHwnd() ) {
		CWnd *pst = GetDlgItem( IDC_LIST_BOX ) ;
		if ( NULL != pst ) {
			pst->SetWindowPos( NULL ,0 , 25 , 424, 120  ,SWP_SHOWWINDOW ) ; 
		}
		pst = GetDlgItem( IDC_BUTTON_UP ) ;
		if ( NULL != pst ) {
			pst->SetWindowPos( NULL ,424-140 , 120+25 , 20, 20  ,SWP_SHOWWINDOW ) ; 
		}
		pst = GetDlgItem( IDC_EDIT_PAGE ) ;
		if ( NULL != pst ) {
			pst->SetWindowPos( NULL ,424 - 115, 120+25 , 40, 20  ,SWP_SHOWWINDOW ) ; 
		}
		pst = GetDlgItem( IDC_BUTTON_NEXT ) ;
		if ( NULL != pst ) {
			pst->SetWindowPos( NULL ,424-70 , 120+25 , 20, 20  ,SWP_SHOWWINDOW ) ; 
		}
		pst = GetDlgItem( IDC_STATIC_COUNT_PAGE ) ;
		if ( NULL != pst ) {
			pst->SetWindowPos( NULL ,424-50 ,120+28 , 50, 20  ,SWP_SHOWWINDOW ) ; 
		}
	}
}
Esempio n. 2
0
void CDocumentPreview::SizePreviewWindow(int nWidth, int nHeight)
{
	m_crPreview.left = (m_crFullPreview.left+m_crFullPreview.right-nWidth)/2;
	m_crPreview.top = (m_crFullPreview.top+m_crFullPreview.bottom-nHeight)/2;
	m_crPreview.right = m_crPreview.left + nWidth;
	m_crPreview.bottom = m_crPreview.top + nHeight;

	CRect r = m_crPreview;

	// We can't both set and show the window at the same time
	// with SetWindowPos. So, we call it twice as needed.
	CWnd* pPreviewWnd = GetPreviewWnd();
	pPreviewWnd->SetWindowPos(NULL, r.left-1, r.top-1, nWidth+2, nHeight+2,
									  SWP_NOZORDER | SWP_NOREDRAW);

	pPreviewWnd->SetWindowPos(NULL, 0, 0, 0, 0,
									  SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_SHOWWINDOW);

	// Invalidate ourselves to avoid background draw.
	CWnd* pDialog = GetDialog();
	pDialog->ClientToScreen(&m_crPreview);
	pPreviewWnd->ScreenToClient(&m_crPreview);
	r = m_crPreview;
	r.left--;
	r.top--;
	r.right++;
	r.bottom++;
	pPreviewWnd->InvalidateRect(&r, FALSE);
}
Esempio n. 3
0
// OnSize is a message handler of WM_SIZE messge, 
// it is reimplemented in order to reposition the buttons
// (keep them always in the bottom part of the dialog)
// and resize the rich edit controls as user resized THIS dialog.
void CResultDialog::OnSize(UINT nType, int cx, int cy) 
{ 
  // call the base class handler
  CDialog::OnSize(nType, cx, cy);
  
  //resizes internal GUI controls (rich edit control and 3 buttons)
  //according to given values of this dialog width (cx) and height (cy).
  //the method is called from OnSize message handler and 
  //from InitInstance of OCCDemo to do initial resize
  CWnd *pEd = (CWnd *) GetDlgItem (IDC_RICHEDIT_ResultDialog);
  CWnd *pBCopy = (CWnd *) GetDlgItem (IDC_CopySelectionToClipboard);
  CWnd *pBCopyAll = (CWnd *) GetDlgItem (IDC_CopyAllToClipboard);
  CWnd *pBClose = (CWnd *) GetDlgItem (IDCANCEL);

  if (pEd != NULL) // it is NULL when dialog is being created and OnSize is called
  {
    int butY = cy-bh-d; // y coordinate of buttons' top left corner

    pEd->SetWindowPos(&wndTop, 0, 0, cx, butY-4*d, SWP_NOMOVE);
    pBCopy->SetWindowPos(&wndTop, d, butY, 0, 0, SWP_NOSIZE); 
    pBCopyAll->SetWindowPos(&wndTop, d+bw+d, butY, 0, 0, SWP_NOSIZE);
    pBClose->SetWindowPos(&wndTop, cx-bw-d, butY, 0, 0, SWP_NOSIZE);
  }

  RedrawWindow();
}
void CProgStatusBar::OnSize(UINT nType, int cx, int cy)
{
	CDialogBar::OnSize(nType, cx, cy);

	// TODO: 在此处添加消息处理程序代码
	CRect rect ;
	int Width = 0;
	CWnd *pst = GetDlgItem( IDC_ST_NET_TB ) ;
	if ( NULL != pst ) {
		pst->GetWindowRect( rect ) ;
		pst->SetWindowPos( NULL ,8 , 12, rect.Width(), rect.Height()  ,SWP_SHOWWINDOW ) ; 
		Width += rect.Width();
	}

	pst = GetDlgItem(IDC_ST_HEIGHT);
	if( NULL != pst)
	{
		pst->GetWindowRect(rect);
		pst->SetWindowPos( NULL ,Width + 20, 12, rect.Width(), rect.Height()  ,SWP_SHOWWINDOW ) ; 
		Width += rect.Width();
	}
	/*
	pst = GetDlgItem(IDC_PROGRESS);
	if( NULL != pst)
	{
		pst->GetWindowRect(rect);
		pst->SetWindowPos( NULL ,Width , rect.top, rect.Width(), rect.Height()  ,SWP_SHOWWINDOW ) ; 
		Width += rect.Width();
	}*/

	int nVerWidth = 0;
	pst = GetDlgItem(IDC_ST_VERSION);
	if(NULL != pst)
	{
		pst->GetWindowRect(rect);
		nVerWidth = rect.Width();
		pst->SetWindowPos( NULL ,900 - 80 - nVerWidth - 25, 12, rect.Width(), rect.Height()  ,SWP_SHOWWINDOW ) ; 
	}

	int nQQWidth = 0;
	if(::IsWindow(m_vlinkCtrlQQ.m_hWnd))
	{
		m_vlinkCtrlQQ.GetWindowRect(rect);
		nQQWidth = rect.Width();
		m_vlinkCtrlQQ.SetWindowPos( NULL ,900 - 80 - nVerWidth - nQQWidth - 46, 12, rect.Width(), rect.Height()  ,SWP_SHOWWINDOW ) ; 
	}
	
	int nblockWidth = 0;
	if(::IsWindow(m_vlinkCtrlBlock.m_hWnd))
	{
		m_vlinkCtrlBlock.GetWindowRect(rect);
		nblockWidth = rect.Width();
		m_vlinkCtrlBlock.SetWindowPos( NULL ,900 - 80 - nVerWidth - nQQWidth - nblockWidth - 68 , 12, rect.Width(), rect.Height()  ,SWP_SHOWWINDOW ) ; 
	}

}
Esempio n. 5
0
BOOL CDisplayDlg::OnInitDialog() 
{
	SetBackGround(IDB_DD_BACKGROUND);

	if (!g_pDisplayMgr)
	{
		g_pDisplayMgr = new CDisplayMgr();
		if (!g_pDisplayMgr->Init("", "display.cfg"))
		{
			OnDestroy();
			return TRUE;
		}
	}

	
	CMoveDialog::OnInitDialog();

	AddButton(IDC_DD_CLOSE,DD_CLOSE_X,DD_CLOSE_Y);
	AddButton(IDC_DD_OK,DD_OK_X,DD_OK_Y);
	AddButton(IDC_DD_CANCEL,DD_CANCEL_X,DD_CANCEL_Y);

	CWnd* pWnd = GetDlgItem(IDC_RENDERER_LIST);
	if(pWnd)
	{
		//pWnd->SetFont(&theApp.m_Font);
		pWnd->SetWindowPos(NULL,DD_RENDERER_LIST_X,DD_RENDERER_LIST_Y,DD_RENDERER_LIST_WIDTH,DD_RENDERER_LIST_HEIGHT,SWP_NOZORDER);
	}
	pWnd = GetDlgItem(IDC_DISPLAY_LIST);
	if(pWnd)
	{
		//pWnd->SetFont(&theApp.m_Font);
		pWnd->SetWindowPos(NULL,DD_DISPLAY_LIST_X,DD_DISPLAY_LIST_Y,DD_DISPLAY_LIST_WIDTH,DD_DISPLAY_LIST_HEIGHT,SWP_NOZORDER);
	}
	pWnd = GetDlgItem(IDC_RESOLUTION_LIST);
	if(pWnd)
	{
		//pWnd->SetFont(&theApp.m_Font);
		pWnd->SetWindowPos(NULL,DD_RESOLUTION_LIST_X,DD_RESOLUTION_LIST_Y,DD_RESOLUTION_LIST_WIDTH,DD_RESOLUTION_LIST_HEIGHT,SWP_NOZORDER);
	}

	if (g_pDisplayMgr->GetNumRenderers() <= 0)
	{
		theApp.MessageBox( IDS_NORENS, IDS_GAME_NAME, MB_OK | MB_ICONSTOP );
		return(0);
	}

	g_pDisplayMgr->FillListBoxes(GetDlgItem(IDC_RENDERER_LIST)->GetSafeHwnd(), GetDlgItem(IDC_DISPLAY_LIST)->GetSafeHwnd(), GetDlgItem(IDC_RESOLUTION_LIST)->GetSafeHwnd());
	g_pDisplayMgr->UpdateListSelections(GetDlgItem(IDC_RENDERER_LIST)->GetSafeHwnd(), GetDlgItem(IDC_DISPLAY_LIST)->GetSafeHwnd(), GetDlgItem(IDC_RESOLUTION_LIST)->GetSafeHwnd());

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 6
0
void CEx14View::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);

	// resize components to take up all real estate
	CWnd* pWnd = GetDlgItem(IDC_GRID);
	if(pWnd)
		pWnd->SetWindowPos(NULL, 0, 0, cx, cy/2, SWP_NOZORDER);

	pWnd = GetDlgItem(IDC_NOTIFICATION_OUT);
	if(pWnd)
		pWnd->SetWindowPos(NULL, 0, cy/2+3, cx,cy/2-4, SWP_NOZORDER);
}
bool cdxCDynamicControlsManager::StretchWindow(CWnd & rWnd, const CSize & szDelta)
{
	ASSERT(::IsWindow(rWnd.m_hWnd));

	WINDOWPLACEMENT	wpl;
	rWnd.GetWindowPlacement(&wpl);

	wpl.rcNormalPosition.left		-=	szDelta.cx / 2;
	wpl.rcNormalPosition.right		+=	(szDelta.cx + 1) / 2;
	wpl.rcNormalPosition.top		-=	szDelta.cy / 2;
	wpl.rcNormalPosition.bottom	+=	(szDelta.cy + 1) / 2;
//	wpl.flags	=	SW_SHOWNA|SW_SHOWNOACTIVATE;

	if((wpl.rcNormalPosition.left >= wpl.rcNormalPosition.right) ||
		(wpl.rcNormalPosition.top >= wpl.rcNormalPosition.bottom))
		return false;

	VERIFY( rWnd.SetWindowPos(	NULL,
										wpl.rcNormalPosition.left,
										wpl.rcNormalPosition.top,
										wpl.rcNormalPosition.right - wpl.rcNormalPosition.left,
										wpl.rcNormalPosition.bottom - wpl.rcNormalPosition.top,
										SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER) );

	return true;
}
//*****************************************************************************
void CBCGPFrameWnd::AdjustClientArea ()
{
    CWnd* pChildWnd = GetDlgItem (AFX_IDW_PANE_FIRST);
    if (pChildWnd != NULL)
    {
        CRect rectClientAreaBounds = m_dockManager.GetClientAreaBounds ();

        rectClientAreaBounds.left += m_rectBorder.left;
        rectClientAreaBounds.top  += m_rectBorder.top;
        rectClientAreaBounds.right -= m_rectBorder.right;
        rectClientAreaBounds.bottom -= m_rectBorder.bottom;

        pChildWnd->CalcWindowRect (rectClientAreaBounds);

        if (!pChildWnd->IsKindOf (RUNTIME_CLASS (CSplitterWnd)) &&
                !pChildWnd->IsKindOf (RUNTIME_CLASS (CFormView)))
        {
            pChildWnd->ModifyStyle (0, WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
        }
        else
        {
            pChildWnd->ModifyStyle (0, WS_CLIPSIBLINGS);
        }


        pChildWnd->SetWindowPos (&wndBottom, rectClientAreaBounds.left,
                                 rectClientAreaBounds.top,
                                 rectClientAreaBounds.Width (),
                                 rectClientAreaBounds.Height (),
                                 SWP_NOACTIVATE);
    }
}
Esempio n. 9
0
void CNavPaneWnd::UpdateTabContents()
{
	CRect rcContents = ::GetClientRect(this);
	rcContents.DeflateRect(s_nTabsWidth + s_nLeftMargin + 1, s_nTopMargin, 0, 0);

	CRect rcBordered(rcContents);
	rcBordered.DeflateRect(1, 1, 0, 0);

	for (size_t i = 0; i < m_tabs.size(); ++i)
	{
		CWnd* pWnd = m_tabs[i].pWnd;
		const CRect& rc = (m_tabs[i].bHasBorder ? rcBordered : rcContents);
		m_tabs[i].rcContent = rc;

		if (i == m_nActiveTab)
		{
			if (rc.Height() <= 0 || rc.Width() <= 0)
			{
				pWnd->ShowWindow(SW_HIDE);
			}
			else
			{
				pWnd->SetWindowPos(NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_NOACTIVATE);
				pWnd->ShowWindow(SW_SHOW);
			}
		}
	}
}
Esempio n. 10
0
bool cdxCDynamicWndEx::StretchWindow(const CSize & szDelta)
{
	if(!IsWindow())
	{
		ASSERT(false);
		return false;
	}

	CWnd	*pWnd	=	Window();

	WINDOWPLACEMENT	wpl;
	pWnd->GetWindowPlacement(&wpl);

	wpl.rcNormalPosition.left		-=	szDelta.cx / 2;
	wpl.rcNormalPosition.right		+=	(szDelta.cx + 1) / 2;
	wpl.rcNormalPosition.top		-=	szDelta.cy / 2;
	wpl.rcNormalPosition.bottom	+=	(szDelta.cy + 1) / 2;
//	wpl.flags	=	SW_SHOWNA|SW_SHOWNOACTIVATE;

	if((wpl.rcNormalPosition.left >= wpl.rcNormalPosition.right) ||
		(wpl.rcNormalPosition.top >= wpl.rcNormalPosition.bottom))
		return false;

	VERIFY( pWnd->SetWindowPos(NULL,
										wpl.rcNormalPosition.left,
										wpl.rcNormalPosition.top,
										wpl.rcNormalPosition.right - wpl.rcNormalPosition.left,
										wpl.rcNormalPosition.bottom - wpl.rcNormalPosition.top,
										SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER) );

	return true;
}
Esempio n. 11
0
xpr_sint_t FolderPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (super::OnCreate(lpCreateStruct) == -1)
        return -1;

    mFolderCtrl = new FolderCtrl;
    if (XPR_IS_NULL(mFolderCtrl))
        return -1;

    mFolderCtrl->setObserver(dynamic_cast<FolderCtrlObserver *>(this));
    mFolderCtrl->setViewIndex(mViewIndex);

    if (mFolderCtrl->Create(this, CTRL_ID_FOLDER_CTRL, CRect(0, 0, 0, 0)) == XPR_FALSE)
    {
        XPR_SAFE_DELETE(mFolderCtrl);
        return -1;
    }

    mFolderCtrl->setImageList(&SingletonManager::get<ImgListManager>().mSysImgList16);

    CWnd *sToolTipWnd = FromHandle((HWND)mFolderCtrl->SendMessage(TVM_GETTOOLTIPS));
    if (XPR_IS_NOT_NULL(sToolTipWnd))
        sToolTipWnd->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

    mFolderCtrl->init(XPR_NULL, XPR_FALSE);

    setFolderOption(mFolderCtrl, *gOpt);

    return 0;
}
// Message Handler
void CChildView::OnLButtonDown( UINT nFlags, CPoint point)
{
	// 실행 시간에 caption바 제거하기.
	static BOOL b = FALSE;
	b = !b;

	CWnd* pFrame = AfxGetMainWnd();

	if ( b )
		pFrame->ModifyStyle( WS_CAPTION, 0); // 제거할 style, 넣을 style
	else
		pFrame->ModifyStyle( 0, WS_CAPTION); //???  될까 ?

	// style 바꾼경우 반드시 다시 윈도우를 그리게 해야 한다.
	pFrame->SetWindowPos( 0,0,0,0,0, // zorder, x, y, w, h
			SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);

	
	// caption bar에 그리기.
	//CWindowDC dc( this); // view 는 caption 이 없다.

//	CWindowDC dc( AfxGetMainWnd() );
//	dc.TextOut( 0,0, "hello"); // caption bar에 그려질까 ?


/*	// Win32 Code를 사용한 그림그리기.
	HDC hdc = ::GetDC( this->m_hWnd );
	::Rectangle( hdc, point.x, point.y,  point.x + 50, point.y + 50);
	::ReleaseDC( this->m_hWnd, hdc);
	*/
}
/*!
 *  This function modifies a window to enable resizing functionality.
 *  This affects the window style, size, system menu and appearance.
 *  
 *  @param lpCreateStruct Pointer to a @c CREATESTRUCT structure, usually
 *         passed by the system to the window procedure in a @c WM_CREATE
 *         or @c WM_NCCREATE
 *  
 *  @remarks The function is intended to be called only inside a @c WM_CREATE
 *           or @c WM_NCCREATE message handler.
 */
void CResizableLayout::MakeResizable(LPCREATESTRUCT lpCreateStruct)
{
	if (lpCreateStruct->style & WS_CHILD)
		return;

	CWnd* pWnd = GetResizableWnd();

#if (_WIN32_WINNT >= 0x0501 && !defined(RSZLIB_NO_XP_DOUBLE_BUFFER))
	// enable double-buffering on supported platforms
	pWnd->ModifyStyleEx(0, WS_EX_COMPOSITED);
#endif

	if (!(lpCreateStruct->style & WS_THICKFRAME))
	{
		// set resizable style
		pWnd->ModifyStyle(DS_MODALFRAME, WS_THICKFRAME);
		// keep client area
		CRect rect(CPoint(lpCreateStruct->x, lpCreateStruct->y),
			CSize(lpCreateStruct->cx, lpCreateStruct->cy));
		pWnd->SendMessage(WM_NCCALCSIZE, FALSE, (LPARAM)&rect);
		// adjust size to reflect new style
		::AdjustWindowRectEx(&rect, pWnd->GetStyle(),
			::IsMenu(pWnd->GetMenu()->GetSafeHmenu()), pWnd->GetExStyle());
		pWnd->SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(),
			SWP_NOSENDCHANGING|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);
		// update dimensions
		lpCreateStruct->cx = rect.Width();
		lpCreateStruct->cy = rect.Height();
	}
}
Esempio n. 14
0
void CObjectRightView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();

	if	(!initialized) {
		g_pD3D       = NULL;
		g_pd3dDevice = NULL;
		g_pVB        = NULL;

		GetParentFrame()->RecalcLayout();
		ResizeParentToFit();

		m_hwndRenderWindow = GetDlgItem(IDC_RENDERWINDOW)->GetSafeHwnd();

		CRect rc;
		this->GetWindowRect( &rc );

		m_iWidth = rc.Width();
		m_iHeight = rc.Height();

		CWnd* pGroup = GetDlgItem(IDC_RENDERWINDOW);
		pGroup->SetWindowPos(NULL, 0, 0, m_iWidth, m_iHeight, SWP_NOZORDER);

		InitializeDevice();
		
		initialized = true;
		SetFocus();
	}
}
Esempio n. 15
0
void CObjectRightView::OnSize(UINT nType, int cx, int cy) 
{
	SetScrollSizes( MM_TEXT, CSize(cx, cy) );

	CFormView::OnSize(nType, cx, cy);

	if	(initialized) {
		CRect rc;

		m_iWidth = cx;
		m_iHeight = cy;

		// Save static reference to the render window
		CWnd* pGroup = GetDlgItem(IDC_RENDERWINDOW);
		pGroup->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER);
		pGroup->GetClientRect(&rc);
		pGroup->MapWindowPoints(this, &rc);

		m_hwndRenderWindow = GetDlgItem(IDC_RENDERWINDOW)->GetSafeHwnd();
		
		InitializeDevice();
		InitializeDeviceBuffer();

		Render();
	}
}
Esempio n. 16
0
//------------------------------------------------------------------------//
void CBCGPGlobalUtils::ForceAdjustLayout (CBCGPDockManager* pDockManager, BOOL bForce,
										  BOOL bForceInvisible, BOOL bForceNcArea)
{
	if (pDockManager != NULL && 
		(CBCGPControlBar::m_bHandleMinSize || bForce))
	{
		CWnd* pDockSite = pDockManager->GetDockSite ();

		if (pDockSite == NULL)
		{
			return;
		}
			
		if (!pDockSite->IsWindowVisible () && !bForceInvisible)
		{
			return;
		}

		if (pDockSite->IsKindOf(RUNTIME_CLASS(CBCGPFrameWnd)) || pDockSite->IsKindOf(RUNTIME_CLASS(CBCGPMDIFrameWnd)))
		{
			m_bIsAdjustLayout = (pDockSite->GetStyle() & WS_MAXIMIZE) == WS_MAXIMIZE;
		}

		CRect rectWnd;
		pDockSite->SetRedraw (FALSE);
		pDockSite->GetWindowRect (rectWnd);
		pDockSite->SetWindowPos (NULL, -1, -1, 
			rectWnd.Width () + 1, rectWnd.Height () + 1, 
			SWP_NOZORDER |  SWP_NOMOVE | SWP_NOACTIVATE);
		pDockSite->SetWindowPos (NULL, -1, -1, 
			rectWnd.Width (), rectWnd.Height (), 
			SWP_NOZORDER |  SWP_NOMOVE  | SWP_NOACTIVATE);
		pDockSite->SetRedraw (TRUE);

		if (bForceNcArea)
		{
			pDockSite->SetWindowPos(NULL, 0, 0, 0, 0, 
				SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
		}

		m_bIsAdjustLayout = FALSE;

		pDockSite->RedrawWindow (NULL, NULL, 
			RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN);
	}
}
Esempio n. 17
0
void
ArxDbgUiDlgSplash::processTextLine(CString& str, UINT dlgItemId, int& numLines, int ht)
{
    CWnd* wnd = GetDlgItem(dlgItemId);
    ASSERT(wnd != NULL);
    if (wnd) {
        if (str.IsEmpty()) {
            wnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER);
        }
        else {
            wnd->SetWindowPos(NULL, kBorderX, m_picHeight+(kBorderY)+(numLines*ht),
                            m_picWidth, ht, SWP_NOZORDER);
            wnd->SetWindowText(str);
            numLines++;
        }
    }
}
Esempio n. 18
0
void CEditViewDlg::OnSize(UINT nType, int cx, int cy) {
	CDialog::OnSize(nType, cx, cy);
	if (GetSafeHwnd() == NULL) {
		return;
	}
	CRect rect, crect;
	GetClientRect(rect);
	CWnd *wnd = GetDlgItem(IDC_BUTTON_OPEN);
	if (wnd == NULL || (wnd && wnd->GetSafeHwnd() == NULL)) {
		return;
	}
	wnd->GetWindowRect(crect);
	wnd->SetWindowPos(NULL, 4, 4, crect.Width(), crect.Height(), SWP_SHOWWINDOW);
	wnd = GetDlgItem(IDC_BUTTON_SAVE);
	int left = 8 + crect.Width();
	wnd->SetWindowPos(NULL, left, 4, crect.Width(), crect.Height(), SWP_SHOWWINDOW);
	wnd = GetDlgItem(IDOK);
	wnd->SetWindowPos(NULL, rect.Width() - crect.Width() - 4, 4, crect.Width(), crect.Height(), SWP_SHOWWINDOW);
	editInfo.SetWindowPos(NULL, 4, 8 + crect.Height(), rect.Width() - 8, rect.Height() - crect.Height() * 2 - 16, SWP_SHOWWINDOW);
	wnd = GetDlgItem(IDC_BUTTON_GOTO);
	wnd->SetWindowPos(NULL, 4, rect.Height() - 4 - crect.Height(), crect.Width(), crect.Height(), SWP_SHOWWINDOW);
	wnd = GetDlgItem(IDC_EDIT_GOTO);
	wnd->SetWindowPos(NULL, 8 + crect.Width(), rect.Height() - 3 - crect.Height(), crect.Width() + 8, crect.Height() - 3, SWP_SHOWWINDOW);
	wnd = GetDlgItem(IDC_STATIC_LINE);
	wnd->SetWindowPos(NULL, 30 + crect.Width() * 2, rect.Height() - crect.Height(), crect.Width() * 2, crect.Height(), SWP_SHOWWINDOW);
	wnd = GetDlgItem(IDC_EDIT_LINE);
	wnd->SetWindowPos(NULL, 40 + crect.Width() * 3, rect.Height() - crect.Height(), crect.Width() + 8, crect.Height(), SWP_SHOWWINDOW);
}
Esempio n. 19
0
void XDlgConsole::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);
	CWnd *pEdit = GetDlgItem( IDC_EDIT1 );
	if( pEdit ) {
		pEdit->SetWindowPos( NULL, 0, 0, cx, cy, SWP_NOZORDER | SWP_NOMOVE );
	}
	// TODO: 여기에 메시지 처리기 코드를 추가합니다.
}
/************************************************************************************
Form视图创建完成后的更新操作
主要包括以下内容:
1. Form视图上控件的创建与初始化;
2. 各个控件大小与分辨率无关化操作;
3. 图像库的扫描与加载(ScanDatabase)
************************************************************************************/
void CCBIRFormView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	// 设置当前视图的大小
	SetScrollSizes(MM_TEXT , CSize(10 , 10));

	// 设置当前视图的MFC风格
	DWORD dwStyle = GetWindowLong(mImageDBTree.m_hWnd , GWL_STYLE);
	dwStyle |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT;

	SetWindowLong(mImageDBTree.m_hWnd , GWL_STYLE , dwStyle);
	m_allRoot = mImageDBTree.InsertItem("database");
	m_curRoot = m_allRoot;

	// 扫描与应用程序相关的图像库,并加载其中的内容
	ScanDatabase();

	// 预览相关的其它初始化操作:树状控制的初始化、预览图像的初始化与加载等
	mImageDBTree.Expand(m_allRoot , TVE_TOGGLE);

	LoadMyJpegFile("data/image.orig/0.jpg" , &mpImagePPI);

	RECT treeRect;
	CWnd* pWnd;
	pWnd = GetDlgItem(IDC_MODELDBTREE);
	pWnd->GetWindowRect(&treeRect);
	pWnd->SetWindowPos(NULL , treeRect.left , treeRect.top , 
		(int)((float)(treeRect.right - treeRect.left) * ((float)mWidth / 250.0f)) , 
		(int)((float)(treeRect.bottom - treeRect.top) * ((float)mHeight / 738.0f)) , SWP_NOMOVE);

	pWnd = GetDlgItem(IDC_RETRIVEIMAGE);
	pWnd->GetWindowRect(&treeRect);
	pWnd->SetWindowPos(NULL , 5 , 700.0f / 738.0f * (float)mHeight , 
		(int)((float)(treeRect.right - treeRect.left) * ((float)mWidth / 250.0f)) , 
		(int)((float)(treeRect.bottom - treeRect.top) * ((float)mHeight / 738.0f)) , SWP_NOZORDER);
	int lastWidth = (int)((float)(treeRect.right - treeRect.left) * ((float)mWidth / 250.0f));

	pWnd = GetDlgItem(IDC_PRRESULT);
	pWnd->GetWindowRect(&treeRect);
	pWnd->SetWindowPos(NULL , 10 + lastWidth , 700.0f / 738.0f * (float)mHeight , 
		(int)((float)(treeRect.right - treeRect.left) * ((float)mWidth / 250.0f)) , 
		(int)((float)(treeRect.bottom - treeRect.top) * ((float)mHeight / 738.0f)) , SWP_NOZORDER);
}
Esempio n. 21
0
CSize CToolBarXP::CalcDynamicLayout (int nLength, DWORD dwMode)
{
    bool bHideControls = (dwMode & LM_VERTDOCK) == LM_VERTDOCK;
    m_bCheckVisibility = (BYTE)(bHideControls ? 1 : 2);
    CSize size = CToolBar::CalcDynamicLayout (nLength, dwMode);
    m_bCheckVisibility = false;

    if ( dwMode & LM_COMMIT )
    {
        TBBUTTON tbbutton;
        int nCount = DefWindowProc (TB_BUTTONCOUNT, 0, 0);

        for ( int i = 0; i < nCount; i++ )
        {
            VERIFY(DefWindowProc (TB_GETBUTTON, i, (LPARAM)&tbbutton));

            if ( !IS_CONTROL(tbbutton) )
            {
                continue;
            }
            CWnd* pWnd = GetDlgItem (tbbutton.idCommand);

            if ( pWnd == NULL )
            {
                continue;
            }
            if ( bHideControls )
            {
                GetToolBarCtrl().HideButton (tbbutton.idCommand, true);
                pWnd->ShowWindow (SW_HIDE);
            }
            else
            {
                GetToolBarCtrl().HideButton (tbbutton.idCommand, false);

                // Update control position
                CRect rcControl;

                VERIFY (DefWindowProc (TB_GETITEMRECT, i, (LPARAM)&rcControl));
                rcControl.DeflateRect (1, 1);
                
                CWindowRect rcCtrl (pWnd);
                int         nNoSize = 0;

                if ( rcControl.Width() == rcCtrl.Width() )
                {
                    nNoSize = SWP_NOSIZE;
                }
                pWnd->SetWindowPos (NULL, rcControl.left, rcControl.top, rcControl.Width(), rcControl.Height(),
                                    nNoSize|SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW);
            }
        }
    }
    return size;
}
Esempio n. 22
0
void CRevertListDlg::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);

	if (!m_InitDialogDone)
		return;

	// Compute the change in width (dx)
	CRect rect;
	GetWindowRect(&rect);
	int dx = rect.Width() - m_LastRect.Width();
	int dy = rect.Height() - m_LastRect.Height();
	// Save the new size
	m_LastRect = rect;

	// Widen the list box by the change in width (dx) and
	// heighten the list box by the change in height (dy)
	m_List.GetWindowRect(&rect);
	m_List.SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, 
								    rect.bottom - rect.top + dy, SWP_NOMOVE | SWP_NOZORDER);

	// Slide the buttons to the right by the change in width
	// and down by the change in height
	CWnd *pWnd = GetDlgItem(IDOK);
	pWnd->GetWindowRect(&rect);
	ScreenToClient(rect);
	pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	pWnd->InvalidateRect(NULL, TRUE);

	pWnd = GetDlgItem(IDCANCEL);
	pWnd->GetWindowRect(&rect);
	ScreenToClient(rect);
	pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	pWnd->InvalidateRect(NULL, TRUE);

	pWnd = GetDlgItem(ID_DELETESELECTED);
	pWnd->GetWindowRect(&rect);
	ScreenToClient(rect);
	pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	pWnd->InvalidateRect(NULL, TRUE);
}
Esempio n. 23
0
//-----------------------------------------------------------------------------
// Purpose: moves controls based on their placement information
//
// Input  : void			
//			
// Output : void
//-----------------------------------------------------------------------------
void CHammerBar::AdjustControls( void )
{
	CRect HammerBarPos;
	GetWindowRect( &HammerBarPos );
	int nHammerBarHeight = HammerBarPos.Height();
	int nHammerBarWidth  = HammerBarPos.Width();
	
	for( int iControl = 0; iControl < m_ControlList.Size(); iControl++ )
	{
		ControlInfo_t currentControl = m_ControlList[ iControl ];
		int nDialogID = currentControl.m_nIDDialogItem;		
		int nControlWidthDifference  = currentControl.m_nWidthBuffer;
		int nControlHeightDifference = currentControl.m_nHeightBuffer;
		DWORD dwPlacement = currentControl.m_dwPlacementFlag;

		CWnd* pControl = GetDlgItem( nDialogID );
		if ( pControl != NULL )
		{
			if ( dwPlacement & GROUP_BOX  )
			{
				pControl->SetWindowPos( NULL, 0, 0, nHammerBarWidth - nControlWidthDifference , 
					nHammerBarHeight - nControlHeightDifference, SWP_NOMOVE|SWP_NOZORDER );			
			}
			if ( dwPlacement & BOTTOM_JUSTIFY )
			{
				CRect controlPos;
				pControl->GetWindowRect( &controlPos );
				pControl->SetWindowPos( NULL, controlPos.left - HammerBarPos.left,
					HammerBarPos.Height() - currentControl.m_nPosY, 0, 0, SWP_NOSIZE|SWP_NOZORDER );
			}
			if ( dwPlacement & RIGHT_JUSTIFY )
			{
				CRect controlPos;
				pControl->GetWindowRect( &controlPos );
				pControl->SetWindowPos( NULL, HammerBarPos.Width() - currentControl.m_nPosX,
					controlPos.top - HammerBarPos.top, 0, 0, SWP_NOSIZE|SWP_NOZORDER );
			}
		}

	}
}
Esempio n. 24
0
LRESULT CDlgLineParam::OnChangePosition(WPARAM wParam, LPARAM lParam)
{
	CWnd *pWnd = (CWnd*)wParam;
	SIZE sz = *((SIZE*)lParam);

	CRect rec;
	GetClientRect(&rec);
	pWnd->SetWindowPos(&wndTop, sz.cx, 0, sz.cy, rec.Height(), 
		SWP_SHOWWINDOW);

	return true;
}
Esempio n. 25
0
void CvQueryExecutionPlanView::DrawQepBoxes (CaSqlQueryExecutionPlanBinaryTree* pQepBinaryTree, CDC* pDC, BOOL bPreview)
{
	if (pQepBinaryTree)
	{
		BOOL bCreateOK = FALSE;
		CaQepNodeInformation* pNodeInfo = pQepBinaryTree->m_pQepNodeInfo;
		pNodeInfo->SetDisplayMode (bPreview);
		CWnd* pQepBox = pNodeInfo->GetQepBox(bPreview);
		BOOL b2Flash = FALSE;
		if (!pQepBox)
		{
			pNodeInfo->AllocateQepBox(bPreview);
			bCreateOK = pNodeInfo->CreateQepBox(this, bPreview);
			if (!bCreateOK)
			{
				CString strMsg = _T("Cannot create the QEP boxes.");
				throw CeSqlQueryException (strMsg);
			}
			// Emb for custom bitmap draw: replace Load/SetIcon stuff, and modify window text
			pQepBox = pNodeInfo->GetQepBox(bPreview);
			SetIconAndText(pQepBox, pNodeInfo->m_nIcon, pNodeInfo->m_strNodeType);

			b2Flash = TRUE;
		}
		if (pQepBox && !pQepBox->IsWindowVisible())
		{
			pQepBox->SendMessage (WM_SQL_QUERY_UPADATE_DATA, (WPARAM)0, (LPARAM)pNodeInfo);
			CRect rcQep = pNodeInfo->GetQepBoxRect (bPreview);
			pQepBox->SetWindowPos (NULL, rcQep.left, rcQep.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOZORDER);
			if (b2Flash)
				pQepBox->FlashWindow (TRUE);

			// Emb: Added frame change to force redraw of caption so that image will gracefully appear
			pQepBox->SetWindowPos (NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
		}
		DrawChildStart (pQepBinaryTree, pDC, bPreview);
		DrawQepBoxes (pQepBinaryTree->m_pQepNodeLeft,  pDC, bPreview);
		DrawQepBoxes (pQepBinaryTree->m_pQepNodeRight, pDC, bPreview);
	}
}
Esempio n. 26
0
BOOL CXTPHeaderCtrl::RecalcLayout()
{
	if (!::IsWindow(m_hWnd))
		return FALSE;

	HD_LAYOUT hdl;

	CXTPClientRect rcClient(this);
	hdl.prc = &rcClient;

	WINDOWPOS wp;
	ZeroMemory(&wp, sizeof(WINDOWPOS));
	hdl.pwpos = &wp;

	if (!Header_Layout(m_hWnd, &hdl))
		return FALSE;

	// Set the size, position, and visibility of the header window.
	::SetWindowPos(m_hWnd, wp.hwndInsertAfter, wp.x, wp.y,
		wp.cx, wp.cy, wp.flags | SWP_FRAMECHANGED);

	CWnd* pWndParent = GetParent();
	if (!::IsWindow(pWndParent->GetSafeHwnd()))
		return FALSE;

	// Force list control to recalculate it's layout.
	CXTPWindowRect rcWindow(pWndParent);

	const int cx = rcWindow.Width();
	const int cy = rcWindow.Height();

	pWndParent->SetWindowPos(NULL, 0, 0, cx, cy+1,
		SWP_NOMOVE | SWP_FRAMECHANGED);

	pWndParent->SetWindowPos(NULL, 0, 0, cx, cy,
		SWP_NOMOVE | SWP_FRAMECHANGED);

	return TRUE;
}
Esempio n. 27
0
void CSpinCtrlPage::CreateSpinCtrl()
{
DWORD dwStyles=0;

	// Build styles mask
	if ( 1 == m_iAlignment )
		dwStyles |= UDS_ALIGNLEFT;		// Control is placed to the left of buddy, if set
										// (default = unattached)
	else if ( 2 == m_iAlignment )
		dwStyles |= UDS_ALIGNRIGHT;		// Control is placed to the right of buddy, if set
										// (default = unattached)
	if ( m_bArrowkeys )
		dwStyles |= UDS_ARROWKEYS;		// Up/Down arrow keys inc/decrement, if set

	if ( m_bAutobuddy )
		dwStyles |= UDS_AUTOBUDDY;		// Previous (in Z-order) edit used as buddy, if set

	if ( m_bNothousands )
		dwStyles |= UDS_NOTHOUSANDS;	// No thousands seperator used, if set

	if ( 1 == m_iOrientation )
		dwStyles |= UDS_HORZ;			// Control is horizontal, if set (default = vert)

	if ( m_bSetbuddyint )
		dwStyles |= UDS_SETBUDDYINT;	// Control updates buddy edit with position, if set

	if ( m_bWrap )
		dwStyles |= UDS_WRAP;			// Position wraps when range exceeded, if set

	// Get edit control and change Z-order (created controls go at bottom of Z-order)
	CWnd* pEdit = GetDlgItem( IDC_SPIN_EDIT );
	pEdit->SetWindowPos( &wndBottom, m_EditRect.left, m_EditRect.top,
						 m_EditRect.Width(), m_EditRect.Height(), SWP_SHOWWINDOW );

	// Create spin (up-down) control
	CWnd* pWnd = GetDlgItem( IDC_SPIN_POS );
	CRect rect;
	pWnd->GetWindowRect( &rect );
	ScreenToClient( &rect );

	m_Spin.Create( WS_VISIBLE|WS_CHILD|dwStyles, rect, this, IDC_SPIN );
	m_Spin.SetRange( m_uiRangeFrom, m_uiRangeTo );	// Sends UDM_SETRANGE

	// Prime edit control with initial value
	TCHAR buf[32];
	int pos = m_Spin.GetPos();						// Sends UDM_GETPOS
	wsprintf( buf, _T("%d"), pos );
	pWnd = m_Spin.GetBuddy();						// Sends UDM_GETBUDDY
	if ( pWnd != NULL )
		pWnd->SetWindowText( buf );
}
Esempio n. 28
0
void CPWResizeDialog::SetControls(int cx, int cy)
{
  if (!m_bInitDone || !m_bStatusBarOK)
    return;

  if (m_pMainCtrl == NULL || !IsWindow(m_pMainCtrl->GetSafeHwnd()))
    return;

  CRect sbRect, mainCtrlRect, btnRect, dlgRect;
  CPoint pt_top;

  GetWindowRect(&dlgRect);

  // Allow ListCtrl to grow/shrink but leave room for the buttons underneath!
  m_pMainCtrl->GetWindowRect(&mainCtrlRect);

  pt_top.x = mainCtrlRect.left;
  pt_top.y = mainCtrlRect.top;
  ScreenToClient(&pt_top);

  m_pMainCtrl->MoveWindow(pt_top.x, pt_top.y,
                          cx - (2 * pt_top.x), cy - m_cyBSpace, TRUE);

  // Keep buttons in the bottom area
  int xleft, ytop;

  m_pMainCtrl->GetWindowRect(&mainCtrlRect);
  ScreenToClient(&mainCtrlRect);

  ytop = mainCtrlRect.bottom + m_ybuttondiff;

  CWnd *pwnd;
  for (int i = 1; i <= m_numbtns; i++) {
    pwnd = GetDlgItem(m_viBottomButtons[i - 1]);
    pwnd->GetWindowRect(&btnRect);
    xleft = (i * cx / (m_numbtns + 1)) - (btnRect.Width() / 2);
    pwnd->SetWindowPos(NULL, xleft, ytop, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER);
  }

  // Now move the status bar
  m_statusBar.GetWindowRect(&sbRect);
  pt_top.x = sbRect.left;
  pt_top.y = sbRect.top;
  ScreenToClient(&pt_top);

  m_statusBar.MoveWindow(pt_top.x, cy - sbRect.Height(),
                         cx - (2 * pt_top.x),
                         sbRect.Height(), TRUE);

  GetDlgItem(m_viBottomButtons[m_iFocus])->SetFocus();
}
Esempio n. 29
0
void CGetPwdDlg::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);

	if (!m_InitDialogDone)
		return;

	// Compute the change in width (dx)
	CRect rect;
	GetWindowRect(&rect);
	int dx = rect.Width() - m_LastRect.Width();
	// Save the new size
	m_LastRect = rect;

	// Widen the text fields by the change in width (dx) and
	GetDlgItem( IDC_STATICMSG )->GetWindowRect(&rect);
	GetDlgItem( IDC_STATICMSG )->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, 
								    rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER);
	GetDlgItem( IDC_STATICMSG )->InvalidateRect(NULL);

	GetDlgItem( IDC_PASSWORD )->GetWindowRect(&rect);
	GetDlgItem( IDC_PASSWORD )->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, 
								    rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER);
	GetDlgItem( IDC_PASSWORD )->InvalidateRect(NULL);

	// Slide the buttons to the right by the change in width
	CWnd *pWnd = GetDlgItem(IDOK);
	pWnd->GetWindowRect(&rect);
	ScreenToClient(rect);
	pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	pWnd->InvalidateRect(NULL, TRUE);

	pWnd = GetDlgItem(IDCANCEL);
	pWnd->GetWindowRect(&rect);
	ScreenToClient(rect);
	pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	pWnd->InvalidateRect(NULL, TRUE);
}
Esempio n. 30
0
BOOL CEnrollDlg::OnInitDialog() // 每次DoModal之前都会执行
{
	CDialog::OnInitDialog();

	faceSz = g_faceMngr->m_faceSz;
	showSz = faceSz;

	if (showSz.height != 160) // (160*130)是预定显示大小,如果归一化大小不是则进行调整
		showSz *= (160.0/showSz.height);
	if (showSz.width > 130)
		showSz *= (130.0/showSz.width);

	EmbedCvWindow(GetDlgItem(IDC_FACE)->m_hWnd, "face", showSz.width, showSz.height);
	if (noface) cvShowImage("face", noface);
	RECT rc;
	GetWindowRect(&rc);
	SetWindowPos(NULL, rc.left + 15, rc.top + 300, 0,0, SWP_NOSIZE | SWP_NOZORDER);

	m_nShootNum = 0;

	m_strName = "";
	UpdateData(FALSE);
	CWnd *pBtn = GetDlgItem(IDC_SHOOT);
	RECT rc1;
	pBtn->GetClientRect(&rc1);
	pBtn->SetWindowText("拍摄");
	pBtn->SetWindowPos(NULL, 0,0, 35, rc1.bottom-rc1.top, SWP_NOMOVE | SWP_NOZORDER);
	GetDlgItem(IDC_DEL_SHOOT)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_ENROLL_PIC)->ShowWindow(SW_SHOW);
	GetDlgItem(IDC_IMPORT_MODELS)->ShowWindow(SW_SHOW);
	if (g_bHasWebcam)
	{
		m_frame = cvCreateImage(g_webcam.GetFrameSize(), IPL_DEPTH_8U, 3);
		SetDlgItemText(IDC_SHOOT_GUIDE, 
			"若要从摄像头注册,请等画面较正时点“拍摄”。\n"
			"如果画面定住,说明人脸检测及对准未成功,请改善姿势、光照。\n"
			"为保证识别率,建议以正常表情拍摄3~4张。");
		m_bFaceStarted = true;
		m_thrdFace = ::AfxBeginThread(ShowFaceProc, this);
	}
	else
	{
		m_frame = NULL;
		SetDlgItemText(IDC_SHOOT_GUIDE, "");
		CWnd *pWnd = GetDlgItem(IDC_SHOOT);
		pWnd->EnableWindow(FALSE);
	}
	
	return TRUE;
}