Ejemplo n.º 1
1
void CCommentsDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	CWnd *pEdit = GetDlgItem(IDC_COMMENTS);
	CWnd *pOk = GetDlgItem(IDC_OK);
	CWnd *pCancel = GetDlgItem(IDC_CANCEL);
	CWnd *pCheckBox = GetDlgItem(IDC_SHOWONOPEN);

	CRect dlgRect;
	GetClientRect(dlgRect);

	if (pEdit != NULL) {
		dlgRect.bottom -= 39;
		pEdit->MoveWindow(dlgRect);
		CRect buttonRect;
		pOk->GetClientRect(buttonRect);
		buttonRect.MoveToY(dlgRect.bottom + 8);
		buttonRect.MoveToX(dlgRect.right - buttonRect.Width() * 2 - 10);
		pOk->MoveWindow(buttonRect);
		pCancel->GetClientRect(buttonRect);
		buttonRect.MoveToY(dlgRect.bottom + 8);
		buttonRect.MoveToX(dlgRect.right - buttonRect.Width() - 7);
		pCancel->MoveWindow(buttonRect);
		pCheckBox->GetClientRect(buttonRect);
		buttonRect.MoveToY(dlgRect.bottom + 14);
		buttonRect.MoveToX(8);
		pCheckBox->MoveWindow(buttonRect);
	}
}
BOOL CMatrix428Dlg::OnInitDialog()
{
	CBCGPDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here
	
	CRect dlgRect;
	dlgRect.left = 0;
	dlgRect.top= 0;
	dlgRect.right = 800;
	dlgRect.bottom = 76;
	CWnd::SetWindowPos(NULL,0,0,dlgRect.Width(),dlgRect.Height(), SWP_NOZORDER);

	// 设置控件的位置和尺寸
	CWnd *pWnd;
	pWnd = GetDlgItem( IDC_BUTTON_MINMIZEBOX );    // 获取控件指针,IDC_BUTTON_MINMIZEBOX为控件ID号
	pWnd->MoveWindow( CRect(2,2,32,32) );	// 在窗口左上角显示一个宽32、高32的按钮控件

	pWnd = GetDlgItem( IDC_BUTTON_CLOSEBOX );
	pWnd->MoveWindow( CRect(36,2,68,32) );	// 两个按钮之间间距为2

	pWnd = GetDlgItem( IDC_STATIC_E428 );
	pWnd->MoveWindow( CRect(2,36,68,68) );	// 设置静态控件位置

	GetCurrentDirectory(500, CurrentPath);	// 获取当前路径

	LoadToolBar();
	return TRUE;  // return TRUE  unless you set the focus to a control
}
Ejemplo n.º 3
0
void CSideBar::OnSize(UINT nType, int cx, int cy) 
{
   bool grow = (cy > m_old_cy);
   m_old_cy = cy;
	CDialogBar::OnSize(nType, cx, cy);
   int middlebar = (cy-12) / 3;

   // move in order according to move:
   if (grow) {
      // grow any other controls first
      // then:
      // size the side bar tree
      CWnd *tree = GetDlgItem(IDC_SIDEBAR_TREE);
      if (tree && ::IsWindow(tree->m_hWnd)) {
         tree->MoveWindow(2,4,cx-4,middlebar-4);
      }
      CListCtrl *list = (CListCtrl *)GetDlgItem(IDC_ATTRIBUTE_LIST);
      if (list && ::IsWindow(list->m_hWnd)) {
         list->MoveWindow(2,middlebar+4,cx-4,cy-middlebar-8);
      }
   }
   else {
      // size the side bar tree
      CWnd *tree = GetDlgItem(IDC_SIDEBAR_TREE);
      if (tree && ::IsWindow(tree->m_hWnd)) {
         tree->MoveWindow(2,4,cx-4,middlebar-4);
      }
      CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_ATTRIBUTE_LIST);
      if (list&& ::IsWindow(list->m_hWnd)) {
         list->MoveWindow(2,middlebar+4,cx-4,cy-middlebar-8);
      }
      // then reduce any other controls
   }
}
Ejemplo n.º 4
0
void CGuiControlBar::OnSize(UINT nType, int cx, int cy)
{
//	CControlBar::OnSize(nType, cx, cy);
	CWnd* pWnd = GetWindow(GW_CHILD);
	if (!m_bSupportMultiView)
	{
        if (pWnd != NULL)
        {
            pWnd->MoveWindow(0, 0, cx, cy);
            ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
		}
	}
	else
	{
		while (pWnd != NULL)
        {
            if (pWnd->IsWindowVisible())
			{
				pWnd->MoveWindow(0, 0, cx, cy);
				break;
			}
            pWnd=pWnd->GetWindow(GW_HWNDNEXT);
		}
	}
	//m_pDockSite->RecalcLayout();
	// TODO: Add your message handler code here
}
Ejemplo n.º 5
0
void CGuiControlBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
{
	CRect rc;
	GetClientRect(rc);
	nDockBarAling = GetParent()->GetDlgCtrlID();
	//envie un recalculo del area cliente solo si el tamaño ha sido 
	//cambiado, de lo contrario permanezca igual
	lpwndpos->flags |= SWP_FRAMECHANGED;
	CControlBar::OnWindowPosChanged(lpwndpos);

	CWnd* pWnd = GetWindow(GW_CHILD);
	if (!m_bSupportMultiView)
	{
        if (pWnd != NULL)
        {
            pWnd->MoveWindow(rc);
            ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
		}
	}
	else
	{
		while (pWnd != NULL)
        {
            if (pWnd->IsWindowVisible())
			{
				pWnd->MoveWindow(rc);
				break;
			}
            pWnd=pWnd->GetWindow(GW_HWNDNEXT);
		}
	}
}
Ejemplo n.º 6
0
void CTuConfigTUDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	long nCentery = (long)(cy / 2);
	long nCenter = (long)(cx / 2);

	int dx = 5;
	if (IsWindow(m_Grid.m_hWnd))
	{
		CRect r;
		GetClientRect(&r);
		m_Grid.MoveWindow(dx, dx, r.right - r.left - 2*dx, r.bottom - r.top - 50, TRUE);
	}

	CWnd* pWnd = this->GetDlgItem(IDOK);
	if(pWnd != NULL)
	{
		pWnd->MoveWindow(nCenter - 100 , cy - 26, 79, 23);
	}
	pWnd = this->GetDlgItem(IDCANCEL);
	if(pWnd != NULL)
	{
		pWnd->MoveWindow(nCenter + 20, cy - 26, 79, 23);
	}
}
Ejemplo n.º 7
0
void CIec104sDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	long nCentery = (long)(cy / 2);
	long nCenter = (long)(cx / 2);

	int dx = 5;
	//m_Grid.GetClientRect
	if (IsWindow(m_Grid.m_hWnd))
	{
		CRect r;
		GetClientRect(&r);
		m_Grid.MoveWindow(2*dx, 30, r.right - r.left - 2*dx, r.bottom - r.top - 70 - dx*2, TRUE);		
	}
	

	CWnd* pWnd = this->GetDlgItem(IDOK);
	if(pWnd != NULL)
	{
		pWnd->MoveWindow(nCenter - 100 , cy - 26, 79, 23);
	}
	pWnd = this->GetDlgItem(IDCANCEL);
	if(pWnd != NULL)
	{
		pWnd->MoveWindow(nCenter + 20, cy - 26, 79, 23);
	}

	
	Invalidate(FALSE);
	// TODO: добавьте свой код обработчика сообщений
}
Ejemplo n.º 8
0
void CXPTabCtrl::ResizeItems()
{
    if(!m_vecTabs.empty() && GetCurSel()<m_vecTabs.size())
    {
        CWnd* pWnd = m_vecTabs[GetCurSel()];
        CRect rectTab;
        CRect rect;
        GetItemRect(GetCurSel(), rectTab);
        GetWindowRect(&rect);

        //ScreenToClient(&rect);
        switch(m_eTabOrientation)
        {
        default :
        case e_tabTop :
            pWnd->MoveWindow(10, rectTab.Height()+10, rect.Width()-20, rect.Height()-rectTab.Height()-20);
            break;
        case e_tabBottom :
            pWnd->MoveWindow(10, 10, rect.Width()-20, rect.Height() - rectTab.Height()-20);
            break;
        case e_tabRight :
            pWnd->MoveWindow(10, 10, rect.Width() - rectTab.Width() - 20, rect.Height() - 20);
            break;
        case e_tabLeft :
            pWnd->MoveWindow(10 + rectTab.Width(), 10, rect.Width() - rectTab.Width() - 20, rect.Height() - 20);
            break;
        }

    }
}
Ejemplo n.º 9
0
void CySplitterWnd::RecalcLayout(void)
{
    CWnd *pane;
    RECT rcBar, rcPane;

    GetWindowRect(&rcBar);
    m_Parent->ScreenToClient(&rcBar);

    int i;
    DWORD id;

    for (i=0; i<m_aboveIds.GetSize(); i++) {
        id = m_aboveIds.GetAt(i);
	    pane = m_Parent->GetDlgItem(id);
        pane->GetWindowRect(&rcPane);
        m_Parent->ScreenToClient(&rcPane);
        rcPane.bottom = rcBar.top - 1;
        pane->MoveWindow(&rcPane, FALSE);
    }

    for (i=0; i<m_belowIds.GetSize(); i++) {
        id = m_belowIds.GetAt(i);
	    pane = m_Parent->GetDlgItem(id);
        pane->GetWindowRect(&rcPane);
        m_Parent->ScreenToClient(&rcPane);
        rcPane.top = rcBar.bottom + 1;
        pane->MoveWindow(&rcPane, FALSE);
    }

    m_Parent->Invalidate();
}
Ejemplo n.º 10
0
void CPPgGeneral::RepositionComponents()
{
	CWnd* pWnd = GetDlgItem(IDC_TXT_MAX_HISTORY_ITEMS);
	ASSERT(pWnd);
	CString szText;
	pWnd->GetWindowText(szText);

	CDC* pDC = GetDC();
	CSize sz = pDC->GetTextExtent(szText);
	ReleaseDC(pDC);
	sz.cx += 2;

	CRect rcLabelMaxHisItems;
	pWnd->GetWindowRect(&rcLabelMaxHisItems);
	ScreenToClient(&rcLabelMaxHisItems);
	rcLabelMaxHisItems.right = rcLabelMaxHisItems.left + sz.cx;
	pWnd->MoveWindow(&rcLabelMaxHisItems);


	pWnd = GetDlgItem(IDC_MAX_HISTORY_ITEMS);
	ASSERT(pWnd);

	CRect rcMaxHisItems;
	pWnd->GetWindowRect(&rcMaxHisItems);
	ScreenToClient(&rcMaxHisItems);
	int nWidth = rcMaxHisItems.Width();
	rcMaxHisItems.left = rcLabelMaxHisItems.right;
	rcMaxHisItems.right = rcMaxHisItems.left + nWidth;
	pWnd->MoveWindow(&rcMaxHisItems);
}
Ejemplo n.º 11
0
void CSplitterWindow::RecalcLayout(void)
{
    CWnd *pane;
    RECT rcBar, rcPane;

    GetWindowRect(&rcBar);
    m_Parent->ScreenToClient(&rcBar);

    int i;
    DWORD id;

    for (i=0; i<m_leftIds.GetSize(); i++) {
        id = m_leftIds.GetAt(i);
	    pane = m_Parent->GetDlgItem(id);
        pane->GetWindowRect(&rcPane);
        m_Parent->ScreenToClient(&rcPane);
        rcPane.right = rcBar.left - 1;
        pane->MoveWindow(&rcPane, FALSE);
    }

    for (i=0; i<m_rightIds.GetSize(); i++) {
        id = m_rightIds.GetAt(i);
	    pane = m_Parent->GetDlgItem(id);
        pane->GetWindowRect(&rcPane);
        m_Parent->ScreenToClient(&rcPane);
        rcPane.left = rcBar.right + 1;
        pane->MoveWindow(&rcPane, FALSE);
    }

    m_Parent->Invalidate();
}
Ejemplo n.º 12
0
void CMonitorWnd::UpdateWnd()
{
	if(!IsWindowVisible() || IsIconic())
	{
		return;
	}

	CRect rectContainer;
	GetClientRect(&rectContainer);
	GetShowRect(&rectContainer);
//	rectContainer.DeflateRect(1,1);

	if(m_bAutoAdjustPos)
	{
		AdjustRect(&rectContainer);
	}

	if(m_bMultiScreen)
	{
		CRect rect;
		int nCount = m_PageList.GetCount();
		int i = 0;
		for(POSITION pos = m_PageList.GetHeadPosition(); pos != NULL; i++)
		{
			CWnd *pWnd = m_PageList.GetNext(pos);

			rect = rectContainer;
			CalcPageRect(&rect, i, nCount);
			rect.DeflateRect(WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE); // 窗口之间的间隔
			pWnd->MoveWindow(&rect);
			pWnd->ShowWindow(SW_SHOW);
		}
	}
	else
	{
		for(POSITION pos = m_PageList.GetHeadPosition(); pos!=NULL;)
		{
			CWnd *pWnd = m_PageList.GetNext(pos);
			if(pWnd == m_pActivePage)
			{
				CRect rect = rectContainer;
				rect.DeflateRect(WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE);
				pWnd->MoveWindow(&rect);
				pWnd->ShowWindow(SW_SHOW);
			}
			else 
			{
				pWnd->MoveWindow(rectContainer.right+1, rectContainer.bottom+1, 1, 1);
//				pWnd->ShowWindow(SW_HIDE);
			}
		}
	}

	if(m_bDrawActive && m_PageList.GetCount() > 1)
	{
		DrawActivePage(TRUE);
	}
}
Ejemplo n.º 13
0
void CDlgDeviceLedger::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	// TODO: 在此处添加消息处理程序代码
	CWnd* pWnd = NULL;
	CRect winrc,tree_rect,button_rect,list_rect;

	int nButtonHeight = 30;
	int nButtonWidth = 100;

	int nButtonListIntval = 10;

	int nListHeight = cy - nButtonHeight - nButtonListIntval;
	int nListWidth = cx;

	GetClientRect(&winrc);

	pWnd = GetDlgItem(IDC_BUTTON_ADD_DEVICE);
	if (pWnd != NULL)
	{
		button_rect.top = winrc.top;
		button_rect.bottom = button_rect.top + nButtonHeight;
		button_rect.left = winrc.left;
		button_rect.right = button_rect.left + nButtonWidth;
		pWnd->MoveWindow(button_rect);
	}

	pWnd = GetDlgItem(IDC_BUTTON_EDIT_DEVICE);
	if (pWnd != NULL)
	{
		button_rect.top = winrc.top;
		button_rect.bottom = button_rect.top + nButtonHeight;
		button_rect.left = button_rect.right;
		button_rect.right = button_rect.left + nButtonWidth;
		pWnd->MoveWindow(button_rect);
	}

	pWnd = GetDlgItem(IDC_BUTTON_DEL_DEVICE);
	if (pWnd != NULL)
	{
		button_rect.top = winrc.top;
		button_rect.bottom = button_rect.top + nButtonHeight;
		button_rect.left = button_rect.right;
		button_rect.right = button_rect.left + nButtonWidth;
		pWnd->MoveWindow(button_rect);
	}

	pWnd = GetDlgItem(IDC_LIST_DEVICE_LEDGER);
	if (pWnd != NULL)
	{
		list_rect.top = button_rect.bottom;//list_rect.top = button_rect.bottom + nButtonListIntval;
		list_rect.bottom = winrc.bottom;
		list_rect.left = winrc.left;
		list_rect.right = list_rect.left + nListWidth;
		pWnd->MoveWindow(list_rect);
	}	
}
void CDlgWingspanAdjacancyConstraints::RefreshLayout( int cx /*= -1*/, int cy /*= -1*/ )
{
	if (cx == -1 && cy == -1)
	{
		CRect rectClient;
		GetClientRect(&rectClient);
		cx = rectClient.Width();
		cy = rectClient.Height();
	}

	CWnd* pWndSave = GetDlgItem(IDC_BUTTON_SAVE);
	CWnd* pWndOK = GetDlgItem(IDOK);
	CWnd* pWndCancel = GetDlgItem(IDCANCEL);
	if (pWndSave == NULL || pWndOK == NULL || pWndCancel == NULL)
		return;

	CRect rcCancel;
	pWndCancel->GetClientRect(&rcCancel);
	pWndCancel->MoveWindow(cx - rcCancel.Width() - 10,
		cy - rcCancel.Height() - 10, 
		rcCancel.Width(), 
		rcCancel.Height());

	CRect rcOK;
	pWndOK->GetClientRect(&rcOK);
	pWndOK->MoveWindow(cx - rcCancel.Width() - rcOK.Width() - 20,
		cy - rcOK.Height() - 10, 
		rcOK.Width(),
		rcOK.Height());

	CRect rcSave;
	pWndSave->GetClientRect(&rcSave);
	pWndSave->MoveWindow(cx - rcCancel.Width() - rcOK.Width() - rcSave.Width() - 30,
		cy - rcSave.Height() - 10, 
		rcSave.Width(),
		rcSave.Height());

	CWnd* pGroupBox = GetDlgItem(IDC_STATIC_FRAME);
	if (pGroupBox == NULL)
		return;

	pGroupBox->MoveWindow(10, 5, cx - 20, cy - rcOK.Height() - 27);

	m_wndListCtrl.MoveWindow(10, 35, cx - 20, cy - rcOK.Height() - 57);

	if (!::IsWindow(m_wndToolBar.m_hWnd))
		return;
	m_wndToolBar.MoveWindow(11, 11, cx - 25, 22);

	Invalidate();
}
Ejemplo n.º 15
0
void CGranitDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	// TODO: добавьте свой код обработчика сообщений	
	
	long nCenter = (long)(cx / 2);

	int dx = 5;
	//m_Grid.GetClientRect
	if (IsWindow(m_Grid.m_hWnd))
	{
		CRect r;
		GetClientRect(&r);
		m_Grid.MoveWindow(dx, dx+20, 390/*nCenter - 2*dx*/, r.bottom - 60/*3*dx*/);		
	}

	if (IsWindow(m_GridData.m_hWnd))
	{
		CRect r;
		GetClientRect(&r);
		m_GridData.MoveWindow(/*3*dx+nCenter*/410, dx+20, cx-420/*nCenter - 5*dx*/, r.bottom - 60/*3*dx*/);		
	}

	CWnd* pWnd = this->GetDlgItem(IDOK);
	if(pWnd != NULL)
	{
		pWnd->MoveWindow(nCenter - 100 , cy - 26, 79, 23);
	}
	pWnd = this->GetDlgItem(IDCANCEL);
	if(pWnd != NULL)
	{
		pWnd->MoveWindow(nCenter + 20, cy - 26, 79, 23);
	}

	/*pWnd = this->GetDlgItem(IDC_STATIC2);
	if(pWnd != NULL)
	{
		CRect r;
		GetClientRect(&r);
		pWnd->MoveWindow(410, dx, 200, 15);
	}*/

	pWnd = this->GetDlgItem(IDC_BUTTON1);
	if(pWnd != NULL)
	{
		//MoveWindow(cx-150, cy - 26, 79, 23, TRUE);		
		pWnd->MoveWindow(cx-110, cy - 26, 99, 23);
	}	
	Invalidate(FALSE);
}
Ejemplo n.º 16
0
void CDlgBlockAnalysis::SetSize()
{
	CRect rcClient, rcTab, rcList, rcCancel;
	CRect rcButton;

	GetClientRect(&rcClient);

	CWnd *pWnd = GetDlgItem(IDC_SAVEAS2);
	if( pWnd != NULL )
	{
		pWnd->GetWindowRect(&rcButton);
	}
	else
	{
		return;
	}

	rcClient.left += HS_TAB_X;
	rcClient.right -= HS_TAB_X;

	rcTab = rcClient;
	rcTab.top += HS_TAB_Y;
	rcTab.bottom = rcTab.top + HS_LIST_Y;
	m_Tab_Ctrl.MoveWindow(rcTab);

	rcList = rcClient;
	rcList.top = rcTab.bottom + HS_BORDER_H;
	rcList.bottom -= (HS_BORDER_H * 2 + rcButton.Height());
	m_List_Ctrl.MoveWindow(&rcList);

	rcClient.top = rcList.bottom + HS_BORDER_H;
	rcClient.bottom = rcClient.top + rcButton.Height();

	rcCancel = rcClient;
	rcCancel.left = rcCancel.right - rcButton.Width();
	pWnd->MoveWindow(&rcCancel);

	rcClient.right = rcCancel.left - 2*HS_BORDER_W;
	rcClient.left = rcClient.right - rcButton.Width();
	pWnd = GetDlgItem(IDC_SAVEAS);
	pWnd->MoveWindow(&rcClient);

	rcCancel.right = rcClient.left - HS_BORDER_W;
	rcCancel.left = rcCancel.right - rcButton.Width();
	m_add.MoveWindow(&rcCancel);

	rcClient.right = rcCancel.left - HS_BORDER_W;
	rcClient.left = rcClient.right - rcButton.Width();
	pWnd = GetDlgItem(IDC_SAVEAS);
	m_begin.MoveWindow(&rcClient);
}
Ejemplo n.º 17
0
void MBMessageBoxImpl::resizeControls() {

	CRect okrect,cancelrect,crect,mrect;
	if (!::IsWindow(m_hWnd)) { return; }
	GetClientRect(crect);
	CWnd * wok = GetDlgItem(IDC_MESSAGEBOX_OK);
	if (!wok) { return; }
	CWnd * wc = GetDlgItem(IDC_MESSAGEBOX_CANCEL);
	if (!wc) { return; }
	if (!::IsWindow(wok->m_hWnd)) { return; }
	if (!::IsWindow(wc->m_hWnd)) { return; }
	wok->GetClientRect(okrect);

	wc->GetClientRect(cancelrect);
	int x,y;
	x = (crect.Width() / 2) - (okrect.Width() + 20);
	y = crect.Height() - (okrect.Height() + 10);

	wok->MoveWindow(x,y,okrect.Width(),okrect.Height());

	x = (crect.Width() / 2) + (20);
	wc->MoveWindow(x,y,okrect.Width(),okrect.Height());
	wok->GetWindowRect(okrect);
	ScreenToClient(okrect);

	mrect.left = 10;
	mrect.right = crect.Width() - 10;
	mrect.top = 20;
	mrect.bottom = crect.bottom - (okrect.Height() + 10);
	mrect.bottom = okrect.top - 20;
	m_MessageBox.MoveWindow(mrect);
	m_MessageBox2.MoveWindow(mrect);

	int numlines = m_MessageBox.GetLineCount();

	CRect calcRect;
	CalcMsgRect(calcRect);

	if (calcRect.Height() > mrect.Height()
			|| calcRect.Width() > mrect.Width()) {
		m_MessageBoxPtr = &m_MessageBox;
		m_MessageBox.ShowWindow(SW_NORMAL);
		m_MessageBox2.ShowWindow(SW_HIDE);
	} else {
		m_MessageBoxPtr = &m_MessageBox2;
		m_MessageBox.ShowWindow(SW_HIDE);
		m_MessageBox2.ShowWindow(SW_NORMAL);
	}

}
Ejemplo n.º 18
0
void CIniFileProcessor::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);
	if(m_bInitialized && cx > 0 && cy > 130)
	{
		KillTimer(INVALIDATETIMER);
		int iY_Offset = cy - m_OldRect.bottom;
		int iX_Offset = cx - m_OldRect.right;

		CRect rect;
		CWnd *item;
		item = GetDlgItem(IDC_LIST1);
		item->GetWindowRect(&rect);
		ScreenToClient(&rect);
		item->MoveWindow(rect.left, rect.top,rect.Width() + iX_Offset, 
			rect.Height() + iY_Offset,TRUE);

		item = GetDlgItem(IDOK);
		item->GetWindowRect(&rect);
		ScreenToClient(&rect);
		item->MoveWindow(rect.left,rect.top + iY_Offset,rect.Width(),
			rect.Height(),TRUE);

		item = GetDlgItem(IDCANCEL);
		item->GetWindowRect(&rect);
		ScreenToClient(&rect);
		item->MoveWindow(rect.left,rect.top + iY_Offset,rect.Width(),
			rect.Height(),TRUE);

		item = GetDlgItem(ID_EDIT_TOGGLE);
		item->GetWindowRect(&rect);
		ScreenToClient(&rect);
		item->MoveWindow(rect.left,rect.top + iY_Offset,rect.Width(),
			rect.Height(),TRUE);

		CWnd *resizeWnd = GetDlgItem(AFX_IDW_SIZE_BOX);
		if(resizeWnd)
		{
			CRect rect,rect2;
			resizeWnd->GetWindowRect(&rect);
			GetClientRect(rect2);
			rect2.left = rect2.right - rect.Width();
			rect2.top = rect2.bottom - rect.Height();
			resizeWnd->MoveWindow(&rect2);
		}
		GetClientRect(&m_OldRect);
		//invalidate
		SetTimer(INVALIDATETIMER,100,NULL);
	}
}
Ejemplo n.º 19
0
void CGameParamsSheet::InitButtons()
{
  // Calculate the height of 7 dialog units
  CRect rectUnits(0, 0, 0, 7);

  //mmf vc8 does not like two arguments, below was commented out, I uncommented it - Imago made them co-exist
#if _MSC_VER >= 1400
  MapDialogRect(rectUnits);
#else
  MapDialogRect(GetSafeHwnd(), rectUnits); 
#endif


  // Get the OK and cancel buttons
  CWnd* pwndOK     = GetDlgItem(IDOK);
  CWnd* pwndCancel = GetDlgItem(IDCANCEL);
  CWnd* pwndHelp   = GetDlgItem(IDHELP);

  // Get the window rectangles of the buttons
  CRect rectOK, rectCancel, rectHelp;
  pwndOK->GetWindowRect(rectOK);
  pwndCancel->GetWindowRect(rectCancel);
  pwndHelp->GetWindowRect(rectHelp);
  ScreenToClient(rectOK);
  ScreenToClient(rectCancel);
  ScreenToClient(rectHelp);

  // Compute the offset to position these buttons flush-right
  int cxOffset = rectHelp.right - rectCancel.right;

  // Move the buttons into place
  rectOK.OffsetRect(cxOffset, 0);
  rectCancel.OffsetRect(cxOffset, 0);
  pwndOK->MoveWindow(rectOK);
  pwndCancel->MoveWindow(rectCancel);

  // Hide the Apply and Help buttons
  GetDlgItem(ID_APPLY_NOW)->ShowWindow(SW_HIDE);
  GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);

  // Show the OK and Cancel buttons
  GetDlgItem(IDOK)->ShowWindow(SW_SHOW);
  GetDlgItem(IDCANCEL)->ShowWindow(SW_SHOW);

  // Enable the OK and Cancel buttons
  GetDlgItem(IDOK)->EnableWindow(true);
  GetDlgItem(IDCANCEL)->EnableWindow(true);
}
Ejemplo n.º 20
0
//新增在切换页面时,若将tab大小改变,内部视图也随之变化,填充满tab控件的视图区
void CTabPage::ShowCurPage(UINT nShowState)
{
	int		nCurItem;
	TCITEM	itemCur;

	nCurItem		= GetCurSel();
	itemCur.mask	= TCIF_PARAM;

	GetItem(nCurItem, &itemCur);
	CWnd*	pWnd = (CWnd*)itemCur.lParam;

	CRect	rect;
	//获取标签页的坐标
	this->GetItemRect(0,&rect);
	int	nLeft  = rect.left;
	int	nTop = rect.bottom;
	//获取整个tab窗口坐标
	this->GetWindowRect(&rect);
	ScreenToClient(&rect);
	//将标签页以下的坐标作为起始位置
	rect.left = nLeft;
	rect.top = nTop;
	pWnd->MoveWindow(&rect);

	pWnd->ShowWindow(nShowState);
}
void COriginalImg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here	
	
	CWnd *pWnd = GetDlgItem(IDC_ORGIMG);
	if (pWnd==NULL)
	{
		MessageBox("error!");
		return;
	}
	CRect rect;
	pWnd->GetWindowRect(&rect);
	ScreenToClient(&rect);
	pWnd->MoveWindow(rect.left, rect.top, m_width, m_height, true);	
	CPaintDC pdc(pWnd);	
	::SetStretchBltMode(pdc, COLORONCOLOR);
	//show  image
	BITMAPINFOHEADER *bmpinfo = (BITMAPINFOHEADER *)(imgBuf + sizeof(BITMAPFILEHEADER));
	LPBITMAPINFO lpbmp = new BITMAPINFO;
	ZeroMemory(lpbmp, sizeof(BITMAPINFO));
	lpbmp->bmiHeader = *bmpinfo;
	StretchDIBits(pdc.GetSafeHdc(),  0,  0, m_width,  m_height,  0,  0,  m_width,  m_height, grayBuf,  lpbmp,  DIB_RGB_COLORS,  SRCCOPY);  
	// Do not call CDialog::OnPaint() for painting messages
}
Ejemplo n.º 22
0
void CExploreMsgSg::vResizeDialog()
{
    CRect omDRect, omLRect;
    // Get Dialog size
    GetWindowRect(&omDRect);
    CWnd* pWnd;
    // Get list control size
    pWnd = GetDlgItem(IDC_LSTC_MSGS);
    if( pWnd != nullptr )
    {
        // Convert it in to client co ordiantes
        pWnd->GetWindowRect(&omLRect);
        ScreenToClient(&omLRect);

        pWnd->MoveWindow(omLRect);

        // Change the postion of select button
        pWnd = GetDlgItem(IDC_CBTN_OK);
        if( pWnd != nullptr )
        {
            // Reduce the size by half and add right margin
            int nDialogWidth = (omDRect.Width() / 2) + omLRect.left - 1;
            MoveWindow( omDRect.left, omDRect.top,
                        nDialogWidth, omDRect.Height());
        }
    }

}
Ejemplo n.º 23
0
BOOL CAboutDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
   // Set up static link
   m_oVapourLink.SubclassDlgItem(IDC_VAPOURTECH_LINK,this);

	// Set up bitmap button
	VERIFY(m_AboutLogo.AutoLoad(IDC_CREDIT_BUTTON, this));
	
	// Get client area size
	CRect oWndRect, oButtonRect;
	this->GetClientRect(oWndRect);
	// Get client relative button coords
	CWnd *pButton = (CWnd*)GetDlgItem(IDC_CREDIT_BUTTON);
	pButton->GetWindowRect(oButtonRect);
	this->ScreenToClient(oButtonRect);
	// Calculate the horizontal shift
	int iBWidth = oButtonRect.Width();
	int iBOffset = (oWndRect.Width() - iBWidth) / 2;
	oButtonRect.left = oWndRect.left + iBOffset;
	oButtonRect.right = oButtonRect.left + iBWidth;
	// Shift the button
	pButton->MoveWindow(oButtonRect, FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 24
0
void CColumnResizer::MoveWnd(int WndIdx, int x, int Width)
{
	static const LMARGIN = -2;
	static const RMARGIN = 4;
	ASSERT(WndIdx >= 0 && WndIdx <= m_Parent.WndIdx);
	if (WndIdx == m_Parent.WndIdx)
		x -= GetHScroll();
	else {
		x += LMARGIN;
		Width = Width - (LMARGIN + RMARGIN);
	}
	int Rows = m_WndList == NULL ? GetRowCount() : 1;
	for (int i = 0; i < Rows; i++) {
		CRect	r;
		CWnd	*wp = m_WndList == NULL ? 
			GetWndList(i)[WndIdx] : m_WndList[WndIdx];
		wp->GetWindowRect(r);
		wp->GetParent()->ScreenToClient(r);
		int	PrevWidth = r.Width();
		r.left = x;
		r.right = x + Width;
		wp->MoveWindow(r);
		// if control width changed, must invalidate, otherwise certain control
		// types paint incorrectly, e.g. static control with horiz. centered text
		if (r.Width() != PrevWidth && WndIdx != m_Parent.WndIdx)
			wp->Invalidate(FALSE);
	}
}
Ejemplo n.º 25
0
void ZSplitter::move(CPoint point,CPoint dif)
{
  if(!(ownStyle&sp_StyleRight) ) dif.x = min(dif.x,0);
  if(!(ownStyle&sp_StyleLeft) )  dif.x = max(dif.x,0);
  if(!(ownStyle&sp_StyleBottom) )dif.y = max(dif.y,0);
  if(!(ownStyle&sp_StyleTop) )   dif.y = min(dif.y,0);

  CRect rc,parent;
  GetWindowRect(&rc);
  GetParent()->GetClientRect(&parent);
  GetParent()->ScreenToClient(&rc);
  int left = rc.left+dif.x;
  int top = rc.top+dif.y;
  bool canAll = true;  CRect rect;
  for(int i=0; i<(int)idxs.size();i++)
    if (!countRect(rect,i,dif))
      canAll = false;
  if(canAll && left>0 && left<parent.right && top>0 && top<parent.bottom )
  {
    for(int i=0; i<(int)idxs.size();i++)
    {
      countRect(rect,i,dif);
      CWnd *wnd = GetParent()->GetDlgItem(idxs[i]);
      wnd->MoveWindow(&rect);
      GetParent()->PostMessage(WM_MOVE_ZSPLITTER,0,(long)wnd->m_hWnd);
      wnd->UpdateWindow();
    }
    SetWindowPos(0,left,top,0,0,SWP_NOSIZE|SWP_NOZORDER);
    m_pointDragStart = point-dif;
  }
}
Ejemplo n.º 26
0
void CSpeakDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	if (::IsWindow(m_wndSpeak.GetSafeHwnd())) {
		CRect rcSpeakWnd;
		m_wndSpeak.GetWindowRect(&rcSpeakWnd);
		ScreenToClient(&rcSpeakWnd);

		rcSpeakWnd.right = cx;
		rcSpeakWnd.bottom = cy;
		m_wndSpeak.MoveWindow(rcSpeakWnd);
	}
	
	CWnd* pBtn = GetDlgItem(ID_BTN_OK);
	if (pBtn && ::IsWindow(pBtn->GetSafeHwnd()))
	{
		CRect rcBtn;
		pBtn->GetWindowRect(&rcBtn);
		ScreenToClient(&rcBtn);
		int nWidth = rcBtn.Width();

		rcBtn.right = cx - m_nBtnHMargin;
		rcBtn.left = rcBtn.right - nWidth;
		
		pBtn->MoveWindow(rcBtn);
	}
}
Ejemplo n.º 27
0
BOOL CAboutDialog::OnInitDialog() {
	CDialog::OnInitDialog();
	
	// Set up bitmap button
	VERIFY(m_AboutLogo.AutoLoad(IDC_CREDIT_BUTTON, this));
	
	// Get client area size
	CRect oWndRect, oButtonRect;
	this->GetClientRect(oWndRect);
	// Get client relative button coords
	CWnd *pButton = (CWnd*)GetDlgItem(IDC_CREDIT_BUTTON);
	pButton->GetWindowRect(oButtonRect);
	this->ScreenToClient(oButtonRect);
	// Calculate the horizontal shift
	int iBWidth = oButtonRect.Width();
	int iBOffset = (oWndRect.Width() - iBWidth) / 2;
	oButtonRect.left = oWndRect.left + iBOffset;
	oButtonRect.right = oButtonRect.left + iBWidth;
	// Shift the button
	pButton->MoveWindow(oButtonRect, FALSE);
	
	// Set the website URL
	m_oWebsiteURL.SubclassDlgItem(IDC_VAPOUR_URL, this);

	// Set the correct game text
	CString strTemp;
	strTemp.Format("'%s' Avatar Converter and Installer", GAME_NAME);
	SetDlgItemText(IDC_ABOUT_TITLE, strTemp);
	
	return TRUE;
} // OnInitDialog
Ejemplo n.º 28
0
BOOL CRegenerationDlg::OnInitDialog() 
{
	int nTargetFontSize,nScreenWidth,nScreenHeight;
	CString strTargetFontName;
	CHARFORMAT2 cf;
	CWnd* pWnd;
	CReferenceUtils ref;

	CDialog::OnInitDialog();

	pWnd=this;
	m_pDoc->GetScreenResolution(&nScreenWidth,&nScreenHeight);
	pWnd->MoveWindow((nScreenWidth-750)/2,100,750,350);
//	pWnd->MoveWindow(150,100,740,220);
	m_bSavedVerse=FALSE;   //if user saves verse, set this flag so TranslationView can update its screen
	pWnd=GetDlgItem(IDC_BUTTONSAVEVERSE);
	pWnd->EnableWindow(FALSE);
	nTargetFontSize=m_pDoc->GetTargetLanguageFontSize();
	strTargetFontName=m_pDoc->GetTargetLanguageFontName();
	cf.dwMask=CFM_FACE | CFM_BOLD | CFM_SIZE; 
	cf.dwEffects=!CFE_BOLD;
	cf.yHeight=nTargetFontSize*20;
	wcscpy_s(cf.szFaceName,strTargetFontName);
	//create the edit control for the gloss
	m_recTargetVerse.SetDefaultCharFormat(cf);  
	m_strReference=ref.FormatReference(m_nBook,m_nChapter,m_nVerse, m_nSourceText, m_pDoc);
	UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 29
0
void CChildView::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
	if(mouseIn == FALSE) {
		//마우스 커서 추적을 요청한다. 
		TRACKMOUSEEVENT tme;
		tme.cbSize = sizeof(tme);
		tme.dwFlags = TME_LEAVE;
		tme.hwndTrack = this->m_hWnd;
		tme.dwHoverTime = HOVER_DEFAULT;
		::_TrackMouseEvent(&tme);

		//메인 윈도우 크기를 300 300 으로 변경한다. 
		CWnd *pMainWnd = AfxGetMainWnd();
		CRect rect;
		pMainWnd->GetWindowRect(&rect);
		rect.right = rect.left + 300;
		rect.bottom = rect.top + 300;
		pMainWnd->MoveWindow(&rect);

		//마우스 커서가 클라이언트 영역에 있음을 표시한다. 
		mouseIn = TRUE;
	}
	//CWnd::OnMouseMove(nFlags, point);
}
Ejemplo n.º 30
0
void CCtrlResize::OnSize()
{
	if (!m_pWnd || !m_pWnd->IsWindowVisible())
		return;

	CRect rr, rectWnd;
	m_pWnd->GetClientRect(&rectWnd);
	
	for (INT_PTR i = 0; i < m_aCtrls.GetSize(); i++) {
		CControlInfo* pInfo = m_aCtrls.GetAt(i);
		if (pInfo) {
			CWnd* pControlWnd = pInfo->m_pControlWnd ? pInfo->m_pControlWnd :
				m_pWnd->GetDlgItem (pInfo->controlID);
			if (pControlWnd) {

				rr = pInfo->rectInitial;
				if (pInfo->bindtype & BIND_RIGHT) 
					rr.right = rectWnd.right -
						(m_rectInitialParent.Width() - pInfo->rectInitial.right);
				if (pInfo->bindtype & BIND_BOTTOM) 
					rr.bottom = rectWnd.bottom -
						(m_rectInitialParent.Height() - pInfo->rectInitial.bottom);
				if (pInfo->bindtype & BIND_TOP);
				else
					rr.top = rr.bottom - pInfo->rectInitial.Height();
				if (pInfo->bindtype & BIND_LEFT);
				else
					rr.left = rr.right - pInfo->rectInitial.Width();
				
				pControlWnd->MoveWindow(&rr);
				pControlWnd->Invalidate(FALSE);
			}
		}
	}
}