Exemple #1
1
void CMainTabDlg::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);
	CTabCtrl * pTab = (CTabCtrl *) GetDlgItem(IDC_TAB1);
	CRect rDlg;

	GetClientRect (rDlg);
	if (pTab && IsWindow(pTab->m_hWnd)) 
	{
		//
		// Move the buttons to the right place.
		CButton* pB1 = (CButton*) GetDlgItem(IDC_BUTTON2); // Close;
		CButton* pB2 = (CButton*) GetDlgItem(IDC_BUTTON1); // Help
		CButton* pB3 = (CButton*) GetDlgItem(IDC_BUTTON3);
		
		int   ibY = 0;
		CRect r, newRect;
		pB1->GetClientRect (r);
		newRect.top    = rDlg.bottom - 10 - r.Height();
		newRect.right  = rDlg.right  - m_dlgPadding.cx;
		newRect.left   = newRect.right - r.Width();
		newRect.bottom = newRect.top + r.Height();
		pB1->MoveWindow (newRect);

		newRect.right  = newRect.left - 10;
		newRect.left   = newRect.right - r.Width();
		pB2->MoveWindow (newRect);

		newRect.right  = newRect.left - 10;
		newRect.left   = newRect.right - r.Width();
		pB3->MoveWindow (newRect);
		ibY = newRect.top;

		//
		// Move the static Text Header II_SYSTEM 
		// to the right place.
		CStatic* pStatic = (CStatic*)GetDlgItem(IDC_STATIC_II_SYSTEM);
		pStatic->GetWindowRect (r);
		ScreenToClient (r);
		r.right   = rDlg.right  - m_dlgPadding.cx;
		pStatic->MoveWindow (r);


		//
		// Move the Tab Control to the right place.
		pStatic->GetWindowRect (r);
		ScreenToClient (r);

		r.top     = r.bottom + 10;
		r.bottom  = ibY - 10;
		r.left    = m_dlgPadding.cx;
		r.right   = rDlg.right -  m_dlgPadding.cx;
		pTab->MoveWindow(r);
		if (m_pCurDlg) 
		{
			CRect r;
			pTab->GetClientRect (r);
			pTab->AdjustRect (FALSE, r);
			m_pCurDlg->MoveWindow(r);
		}
	}
}
Exemple #2
0
void CDlg3RGSegment::OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )
{
	CString str;
	CRect thumb;
	CStatic* pStatic;
	//UpdatePreproc();
	if ((m_chkDefaultThres.GetCheck() == BST_UNCHECKED) && (m_sldThreshold.GetPos() != m_nThresholdVal))
	{
		m_nThresholdVal = m_sldThreshold.GetPos();
		m_sldThreshold.GetThumbRect(&thumb);
		thumb += m_rThres.TopLeft();
		thumb += CPoint(0, SV_3DRG_TEXTHEIGHT);
		thumb.right += SV_3DRG_CHARWIDTH*3;
		pStatic = (CStatic*) GetDlgItem(IDC_TH_CUR);
		pStatic->MoveWindow(&thumb);
		str.Format(_T("%d"), m_nThresholdVal);
		pStatic->SetWindowText(str);		
	}

	m_sldBoundThres.GetThumbRect(&thumb);
	thumb += m_rBthres.TopLeft();
	thumb += CPoint(0, SV_3DRG_TEXTHEIGHT);
	thumb.right += SV_3DRG_CHARWIDTH*3;
	pStatic = (CStatic*) GetDlgItem(IDC_LBL_CURBTHRE);
	pStatic->MoveWindow(&thumb);
	str.Format(_T("%d"), m_sldBoundThres.GetPos());
	pStatic->SetWindowText(str);	

	UpdateLUT();
	UpdateSlices();
	DisplayImage();	
}
/******************************************************************************
 Function Name  :   vResizeControls

 Description    :
 Input(s)       :   -
 Output         :   -
 Functionality  :   Resize the control when dialog is resized.
 Member of      :   CMessageInterpretation

 Author(s)      :   Ratnadip Choudhury
 Date Created   :   16.02.2004
 Modifications  :   Raja N on 05/04/2004
                :   Modified width calculation as one more column is included
                    in the list.
******************************************************************************/
void CMessageInterpretation::vResizeControls(void)
{
    RECT WndClientRect, CtrlRect;
    CStatic* pomStatic = nullptr;

    GetClientRect(&WndClientRect);

    /* Resize "Message" static control */
    if ((pomStatic = (CStatic*) GetDlgItem(IDC_CAPTION)) != nullptr)
    {
        pomStatic->GetWindowRect(&CtrlRect);
        ScreenToClient(&CtrlRect);
        pomStatic->MoveWindow(CtrlRect.left, CtrlRect.top,
                              WndClientRect.right - WndClientRect.left,
                              CtrlRect.bottom - CtrlRect.top);
    }

    /* Resize "Signal" static control */
    if ((pomStatic = (CStatic*) GetDlgItem(IDC_CAPTION2)) != nullptr)
    {
        pomStatic->GetWindowRect(&CtrlRect);
        ScreenToClient(&CtrlRect);
        pomStatic->MoveWindow(CtrlRect.left, CtrlRect.top,
                              WndClientRect.right - WndClientRect.left,
                              CtrlRect.bottom - CtrlRect.top);
    }

    /* Resize list control describing signal values */
    if (IsWindow(m_ctrlSignal.m_hWnd))
    {
        m_ctrlSignal.GetWindowRect(&CtrlRect);
        ScreenToClient(&CtrlRect);
        m_ctrlSignal.MoveWindow(5, CtrlRect.top,
                                WndClientRect.right - WndClientRect.left - 10,
                                WndClientRect.bottom - CtrlRect.top - 5);

        m_ctrlSignal.GetWindowRect(&CtrlRect);
        // Get the column width
        int nWidth = (CtrlRect.right - CtrlRect.left - 20) / 4;
        m_ctrlSignal.SetColumnWidth(0, nWidth);
        m_ctrlSignal.SetColumnWidth(1, nWidth);
		m_ctrlSignal.SetColumnWidth(2, nWidth);
		m_ctrlSignal.SetColumnWidth(3, nWidth);
    }
}
Exemple #4
0
void CZhfPalette::ResizeCtrl(int iX, int iY)
{
	//int iCtrlNum = m_pArrayPreviewCtrl.GetCount() ;
	int iCol = iX/(m_iCtrlWidth+m_iMarginX) ;
	//int iRow = iCtrlNum/iCol + (iCtrlNum%iCol==0?0:1);
	for (int i=0; i<m_pArrayPreviewCtrl.GetCount(); i++)
	{
		int iColCur = i%iCol ;
		int iRowCur = (i+1)/iCol+((i+1)%iCol==0?0:1);
		int iXTmp = iColCur*(m_iCtrlWidth+m_iMarginX)+m_iMarginX ;
		int iYTmp = (iRowCur-1)*(m_iCtrlHeight+m_iMarginY) ;
		CGsPreviewCtrl* pCtrl = m_pArrayPreviewCtrl.GetAt(i) ;
		pCtrl->MoveWindow(iXTmp, iYTmp, m_iCtrlWidth, m_iCtrlHeight) ;
		pCtrl->Invalidate(TRUE) ;

		CStatic* pCtrlStatic = m_pArrayStatic.GetAt(i) ;
		pCtrlStatic->MoveWindow(iXTmp, iYTmp+m_iCtrlHeight, m_iCtrlWidth, m_iMarginY) ;
		pCtrlStatic->Invalidate(TRUE) ;
	}
}
void CGetAssgnUpdatesDlg::OnSize(UINT nType, int cx, int cy)
{
    CDialogEx::OnSize(nType, cx, cy);

    CRect rcDlg;
    GetWindowRect(&rcDlg);
    ScreenToClient(&rcDlg);

    const int commGrBottom = 95;
    const int commGrRight = 30;

    const int macGrBottom = 199;
    const int macGrRight = 30;

    CRect rc;
    if(m_whiteBkg)
    {
        m_whiteBkg.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.right = rcDlg.right - 18;
        rc.bottom = rcDlg.bottom - 43;
        rc.top = rcDlg.bottom - 303;
        m_whiteBkg.MoveWindow(rc);
    }
    if(m_whiteBkg2)
    {
        m_whiteBkg2.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.right = rcDlg.right - 18;
        m_whiteBkg2.MoveWindow(rc);
    }
    if(m_whiteBkg3)
    {
        m_whiteBkg3.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.bottom = rcDlg.bottom - 57;
        m_whiteBkg3.MoveWindow(rc);
    }
    if(m_whiteBkg4)
    {
        m_whiteBkg4.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.bottom = rcDlg.bottom - 57;
        rc.right = rcDlg.right - 18;
        rc.left = rcDlg.right - 30;
        m_whiteBkg4.MoveWindow(rc);
    }
    if(m_frame)
    {
        m_frame.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.right = rcDlg.right - 18;
        rc.bottom = rcDlg.bottom - 42;
        m_frame.MoveWindow(rc);
    }
    if(m_listCtrl)
    {
        m_listCtrl.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.right = rcDlg.right - 30;
        rc.bottom = rcDlg.bottom - 303;
        m_listCtrl.MoveWindow(rc);
    }
    if(m_AcceptButton)
    {
        m_AcceptButton.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.bottom = rcDlg.bottom - 59;
        rc.top = rc.bottom	- 23;
        m_AcceptButton.MoveWindow(rc);
    }
    if(m_RejectButton)
    {
        m_RejectButton.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.bottom = rcDlg.bottom - 59;
        rc.top = rc.bottom	- 23;
        m_RejectButton.MoveWindow(rc);
    }
    if(m_ResetButton)
    {
        m_ResetButton.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.bottom = rcDlg.bottom - 59;
        rc.top = rc.bottom	- 23;
        m_ResetButton.MoveWindow(rc);
    }
    if(m_buttonOK)
    {
        m_buttonOK.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.bottom = rcDlg.bottom - 12;
        rc.top = rc.bottom	- 23;
        rc.right = rcDlg.right - 100;
        rc.left = rc.right - 75;
        m_buttonOK.MoveWindow(rc);
    }
    if(m_buttonCancel)
    {
        m_buttonCancel.GetWindowRect(&rc);
        ScreenToClient(&rc);
        rc.bottom = rcDlg.bottom - 12;
        rc.top = rc.bottom	- 23;
        rc.right = rcDlg.right - 17;
        rc.left = rc.right - 75;
        m_buttonCancel.MoveWindow(rc);
    }

    if (m_GrBoxMarkAsComplete)
    {
        CRect rcGrBoxMarkAsComplete;
        m_GrBoxMarkAsComplete.GetWindowRect(&rcGrBoxMarkAsComplete);
        ScreenToClient(&rcGrBoxMarkAsComplete);
        rcGrBoxMarkAsComplete.bottom = rcDlg.bottom - macGrBottom;
        rcGrBoxMarkAsComplete.top = rcGrBoxMarkAsComplete.bottom - 93;
        rcGrBoxMarkAsComplete.right = rcDlg.right - macGrRight;
        m_GrBoxMarkAsComplete.MoveWindow(rcGrBoxMarkAsComplete);

        if(m_radioNone)
        {
            CRect rcRadioNone;
            m_radioNone.GetWindowRect(&rcRadioNone);
            int w = rcRadioNone.Width();

            rcRadioNone.SetRect(
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2+14,
                rcGrBoxMarkAsComplete.top + 34,
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2+14 + w,
                rcGrBoxMarkAsComplete.top + 50);
            m_radioNone.MoveWindow(rcRadioNone);
        }
        if(m_radioPercent)
        {
            CRect rcRadioPercent;
            m_radioPercent.GetWindowRect(&rcRadioPercent);
            int w = rcRadioPercent.Width();

            rcRadioPercent.SetRect(
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2+14,
                rcGrBoxMarkAsComplete.top + 52,
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2+14 + w,
                rcGrBoxMarkAsComplete.top + 68);
            m_radioPercent.MoveWindow(rcRadioPercent);
        }
        if(m_radioFinish)
        {
            CRect rcRadioFinish;
            m_radioFinish.GetWindowRect(&rcRadioFinish);
            int w = rcRadioFinish.Width();

            rcRadioFinish.SetRect(
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2+14,
                rcGrBoxMarkAsComplete.top + 70,
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2+14 + w,
                rcGrBoxMarkAsComplete.top + 86);
            m_radioFinish.MoveWindow(rcRadioFinish);
        }

        if(m_staticMACSelectMethod)
        {
            CRect rcGrMACSelect;
            m_staticMACSelectMethod.GetWindowRect(&rcGrMACSelect);
            int w = rcGrMACSelect.Width();
            rcGrMACSelect.SetRect(
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2+14,
                rcGrBoxMarkAsComplete.top + 15,
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2+14 + w,
                rcGrBoxMarkAsComplete.top + 28);
            m_staticMACSelectMethod.MoveWindow(rcGrMACSelect);
        }

        if(m_staticMACNotificication)
        {
            CRect rcGrMACNote;
            m_staticMACNotificication.GetWindowRect(&rcGrMACNote);
            int w = rcGrMACNote.Width();
            rcGrMACNote.SetRect(
                rcGrBoxMarkAsComplete.left + 9,
                rcGrBoxMarkAsComplete.top + 29,
                (rcGrBoxMarkAsComplete.left+rcGrBoxMarkAsComplete.right)/2-14,
                rcGrBoxMarkAsComplete.top + 73);
            m_staticMACNotificication.MoveWindow(rcGrMACNote);
        }

    }

    if(m_GrBoxComment)//comment group
    {
        CRect rcGrBoxComment;
        m_GrBoxComment.GetWindowRect(&rcGrBoxComment);
        ScreenToClient(&rcGrBoxComment);
        rcGrBoxComment.bottom = rcDlg.bottom - commGrBottom;
        rcGrBoxComment.top = rcGrBoxComment.bottom	- 93;
        rcGrBoxComment.right = rcDlg.right - commGrRight;
        m_GrBoxComment.MoveWindow(rcGrBoxComment);

        if(m_editTMComment)
        {
            CRect rcEditTMComment(
                rcGrBoxComment.left + 9,
                rcGrBoxComment.top + 36,
                (rcGrBoxComment.left+rcGrBoxComment.right)/2-14,
                rcGrBoxComment.bottom - 8);
            m_editTMComment.MoveWindow(rcEditTMComment);
        }
        if(m_editPMComment)
        {
            CRect rcEditPMComment(
                (rcGrBoxComment.left+rcGrBoxComment.right)/2+14,
                rcGrBoxComment.top + 36,
                rcGrBoxComment.right-9,
                rcGrBoxComment.bottom - 8);
            m_editPMComment.MoveWindow(rcEditPMComment);
        }
        CStatic* pTMCommStatic = (CStatic*)GetDlgItem(IDC_STATIC_TM);
        if(pTMCommStatic)
        {
            CRect rcTMCommStatic(
                rcGrBoxComment.left+9,
                rcGrBoxComment.top+20,
                (rcGrBoxComment.left+rcGrBoxComment.right)/2-14,
                rcGrBoxComment.top+33);
            pTMCommStatic->MoveWindow(rcTMCommStatic);
        }
        CStatic* pPMCommStatic = (CStatic*)GetDlgItem(IDC_STATIC_PM);
        if(pPMCommStatic)
        {
            CRect rcPMCommStatic(
                (rcGrBoxComment.left+rcGrBoxComment.right)/2+14,
                rcGrBoxComment.top+20,
                rcGrBoxComment.right-9,
                rcGrBoxComment.top+33);
            pPMCommStatic->MoveWindow(rcPMCommStatic);
        }
    }





    Invalidate();
}
Exemple #6
0
/*
	This function update the window layout, the order of statement is significant.
//*/
void CDlg3RGSegment::UpdateLayout( int cx, int cy )
{
	// Compute layout for the window and the image displaying region
	CStatic*	ctrlStatic = NULL;
	CButton*	ctrlButton = NULL;
	CComboBox*	ctrlCombobox = NULL;
	CRect clientRect;
	CRect contrlRect;
	CRect infoRect;
	GetClientRect(&clientRect);

	//////////////////////////////////////////////////////////////////////////
	// Compute the preprocessing group
	contrlRect.left = clientRect.left + SV_3DRG_SPACING;
	contrlRect.bottom = clientRect.bottom - SV_3DRG_SPACING;
	contrlRect.top = clientRect.bottom - SV_3DRG_GRP_HEIGHT;
	contrlRect.right = contrlRect.left + SV_3DRG_GRP_WIDTH;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_3DRG_GRAYGRP);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	// Preprocessing check box
	contrlRect.left += SV_3DRG_SPACING;
	contrlRect.top += SV_3DRG_SPACING * 2;
	contrlRect.right -= SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	m_chkPreproc.MoveWindow(&contrlRect, FALSE);

	// Brightness label
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_LBL_BRIGHT);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);


	//Brightness slider
	contrlRect.top = contrlRect.bottom + SV_3DRG_SMALL_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_SMALLSLIDERHEIGHT;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH;
	ctrlStatic =(CStatic*)GetDlgItem(IDC_BR_100);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_SMALLSLIDERWIDTH;
	m_sldBright.MoveWindow(&contrlRect, FALSE);

	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH;
	ctrlStatic =(CStatic*)GetDlgItem(IDC_BR_M100);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	// Contrast label
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING;	
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	contrlRect.left = clientRect.left + SV_3DRG_SPACING *2;
	contrlRect.right = clientRect.left + SV_3DRG_SMALLSLIDERWIDTH;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_LBL_CONTRAST);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	// Contrast slider
	contrlRect.top = contrlRect.bottom + SV_3DRG_SMALL_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_SMALLSLIDERHEIGHT;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_CS_100);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_SMALLSLIDERWIDTH;
	m_sldContrast.MoveWindow(&contrlRect, FALSE);

	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH;
	ctrlStatic =(CStatic*)GetDlgItem(IDC_CS_M100);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	//////////////////////////////////////////////////////////////////////////
	// Compute the region growing setting
	contrlRect.left = clientRect.left + SV_3DRG_SPACING*1.5 + SV_3DRG_GRP_WIDTH;
	contrlRect.bottom = clientRect.bottom - SV_3DRG_SPACING;
	contrlRect.top = clientRect.bottom - SV_3DRG_GRP_HEIGHT;
	contrlRect.right = contrlRect.left + SV_3DRG_GRP_WIDTH;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_3DRG_SETTINGGRP);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	// Use default check box
	contrlRect.left += SV_3DRG_SPACING;
	contrlRect.top += SV_3DRG_SPACING * 2;
	contrlRect.right -= SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	m_chkDefaultThres.MoveWindow(&contrlRect, FALSE);

	// Threshold slider label
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_LBL_THRES);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	// Threshold  slider
	contrlRect.top = contrlRect.bottom + SV_3DRG_SMALL_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_SMALLSLIDERHEIGHT;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH*2;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_TH_MIN);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	// Slider threshold
	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_SMALLSLIDERWIDTH - 2*SV_3DRG_CHARWIDTH;
	m_sldThreshold.MoveWindow(&contrlRect, FALSE);
	m_rThres = contrlRect;

	// Label current threshold value
	m_sldThreshold.GetThumbRect(&infoRect);
	infoRect += contrlRect.TopLeft();
	infoRect.top += SV_3DRG_SMALLSLIDERHEIGHT; 
	infoRect.bottom += SV_3DRG_SMALLSLIDERHEIGHT; 
	infoRect.right += SV_3DRG_CHARWIDTH *3;
	ctrlStatic =(CStatic*)GetDlgItem(IDC_TH_CUR);
	ctrlStatic->MoveWindow(&infoRect, FALSE);	
	CString str;
	str.Format(_T("%d"), m_sldThreshold.GetPos());
	ctrlStatic->SetWindowText(str);

	// Label max threshold
	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH *2;
	ctrlStatic =(CStatic*)GetDlgItem(IDC_TH_MAX);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);	

	// Label start slice
	contrlRect = m_rThres;
	contrlRect.left -= (SV_3DRG_CHARWIDTH*2 + SV_3DRG_SMALL_SPACING);
	contrlRect.top += (1.5*SV_3DRG_SMALLSLIDERHEIGHT + SV_3DRG_SPACING);
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH*3;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	ctrlStatic = (CStatic*) GetDlgItem(IDC_3DRG_LBLSTART);
	ctrlStatic->MoveWindow(contrlRect);

	// Textbox start slice
	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_TEXTBOXWIDTH;
	CEdit* ctrlEdit = (CEdit*) GetDlgItem(IDC_3DRG_STARSLICE);
	ctrlEdit->MoveWindow(contrlRect);

	// Label end slice
	contrlRect.left = contrlRect.right + SV_3DRG_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH * 3;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_3DRG_LBLEND);
	ctrlStatic->MoveWindow(contrlRect);

	// textbox end slice
	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_TEXTBOXWIDTH;
	ctrlEdit = (CEdit*) GetDlgItem(IDC_3DRG_ENDSLICE);
	ctrlEdit->MoveWindow(contrlRect);
	

	// Boundary threshold label
	contrlRect.left = m_rThres.left - (SV_3DRG_CHARWIDTH*2 + SV_3DRG_SMALL_SPACING);
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH*9;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_3DRG_BTHRES);
	ctrlStatic->MoveWindow(contrlRect);

	//
	// Threshold  slider
	contrlRect.top = contrlRect.bottom + SV_3DRG_SMALL_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_SMALLSLIDERHEIGHT;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH*2;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_TH_MINBTHRES);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);
	
	// Slider boundary threshold
	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_SMALLSLIDERWIDTH - 2*SV_3DRG_CHARWIDTH;
 	m_sldBoundThres.MoveWindow(&contrlRect, FALSE);
 	m_rBthres = contrlRect;


	// Label current boundary threshold value
	m_sldBoundThres.GetThumbRect(&infoRect);
	infoRect += contrlRect.TopLeft();
	infoRect.top += SV_3DRG_SMALLSLIDERHEIGHT; 
	infoRect.bottom += SV_3DRG_SMALLSLIDERHEIGHT; 
	infoRect.right += SV_3DRG_CHARWIDTH *3;
	ctrlStatic =(CStatic*)GetDlgItem(IDC_LBL_CURBTHRE);
	ctrlStatic->MoveWindow(&infoRect, FALSE);	
	str.Format(_T("%d"), m_sldBoundThres.GetPos());
	ctrlStatic->SetWindowText(str);
	
	
	// Label max threshold
	contrlRect.left = contrlRect.right + SV_3DRG_SMALL_SPACING;
	contrlRect.right = contrlRect.left + SV_3DRG_CHARWIDTH *2;
	ctrlStatic =(CStatic*)GetDlgItem(IDC_TH_MAXBTHRES);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);	


	//////////////////////////////////////////////////////////////////////////
	// Compute the Operation mode
	contrlRect.left = clientRect.left + SV_3DRG_SPACING*2 + SV_3DRG_GRP_WIDTH *2;
	contrlRect.bottom = clientRect.bottom - SV_3DRG_SPACING;
	contrlRect.top = clientRect.bottom - SV_3DRG_GRP_HEIGHT;
	contrlRect.right = contrlRect.left + SV_3DRG_GRP_WIDTH;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_3DRG_OPPGRP);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	// Cutting mode radio
	contrlRect.left += SV_3DRG_SPACING;
	contrlRect.top += SV_3DRG_SPACING * 2;
	contrlRect.right -= SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	ctrlButton = (CButton*)GetDlgItem(IDC_3DRG_RAD_CUT);
	ctrlButton->MoveWindow(&contrlRect, FALSE);

	// Segmentation mode radio
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	ctrlButton = (CButton*)GetDlgItem(IDC_3DRG_RAD_SEG);
	ctrlButton->MoveWindow(&contrlRect, FALSE);

	// Cutting method combobox label
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	ctrlStatic = (CStatic*)GetDlgItem(IDC_3DRG_LBL_CUTMED);
	ctrlStatic->MoveWindow(&contrlRect, FALSE);

	// Cutting method combobox
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING/2;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	ctrlCombobox = (CComboBox*)GetDlgItem(IDC_3DRG_CB_CUTMODE);
	ctrlCombobox->MoveWindow(&contrlRect, FALSE);

	// Boundary detection check box
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_TEXTHEIGHT;
	ctrlButton = (CButton*) GetDlgItem(IDC_3DRG_CHK_BOUND);
	ctrlButton->MoveWindow(&contrlRect, FALSE);

	// Segment start button
	contrlRect.top = contrlRect.bottom + SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_BUTTON_HEIGHT;
	ctrlButton = (CButton*)GetDlgItem(IDC_3DRG_START);
	ctrlButton->MoveWindow(&contrlRect, FALSE);

	//////////////////////////////////////////////////////////////////////////
	// Compute the button set
	// Close button
	contrlRect.right = clientRect.right - SV_3DRG_SPACING;
	contrlRect.left = contrlRect.right - SV_3DRG_BUTTON_WIDTH;
	contrlRect.bottom = clientRect.bottom - SV_3DRG_SPACING;
	contrlRect.top = contrlRect.bottom - SV_3DRG_BUTTON_HEIGHT;
	ctrlButton = (CButton*)GetDlgItem(IDCANCEL);
	ctrlButton->MoveWindow(&contrlRect, FALSE);

	// Save volume button
	contrlRect.bottom = contrlRect.top - SV_3DRG_SPACING*2;
	contrlRect.top = contrlRect.bottom - SV_3DRG_BUTTON_HEIGHT;
	ctrlButton = (CButton*)GetDlgItem(IDC_3DRG_CMD_SAVEVOL);
	ctrlButton->MoveWindow(&contrlRect, FALSE);

	// Save all slice button
	contrlRect.bottom = contrlRect.top - SV_3DRG_SPACING/2;
	contrlRect.top = contrlRect.bottom - SV_3DRG_BUTTON_HEIGHT;
	ctrlButton = (CButton*)GetDlgItem(IDC_3DRG_CMD_SAVEALL);
	ctrlButton->MoveWindow(&contrlRect, FALSE);

	// Save a slice button
	contrlRect.bottom = contrlRect.top - SV_3DRG_SPACING/2;
	contrlRect.top = contrlRect.bottom - SV_3DRG_BUTTON_HEIGHT;
	ctrlButton = (CButton*)GetDlgItem(IDC_3DRG_CMD_SAVESINGLE);
	ctrlButton->MoveWindow(&contrlRect, FALSE);

	//Compute the image output size
	int nHeight = clientRect.Height() - (5*SV_3DRG_SPACING + SV_3DRG_GRP_HEIGHT + SV_3DRG_LARGESLIDERHEIGHT);
	int nWidth = (clientRect.Width() - 3*SV_3DRG_SPACING) /2;
	int nSize = min(nHeight, nWidth);

	m_OrgRegion.left = clientRect.left + SV_3DRG_SPACING;
	m_OrgRegion.top = clientRect.top + SV_3DRG_SPACING;
	m_OrgRegion.right = m_OrgRegion.left + nSize;
	m_OrgRegion.bottom = m_OrgRegion.top + nSize;
	m_ResRegion = m_OrgRegion;
	m_ResRegion.OffsetRect(nSize + SV_3DRG_SPACING, 0);

	ctrlStatic = (CStatic*)GetDlgItem(IDC_3DRG_ORGFRAME);
	ctrlStatic->MoveWindow(&m_OrgRegion, FALSE);
	ctrlStatic = (CStatic*)GetDlgItem(IDC_3DRG_RESFRAME);
	ctrlStatic->MoveWindow(&m_ResRegion, FALSE);

	contrlRect.left = m_OrgRegion.left;
	contrlRect.right = m_ResRegion.right;
	contrlRect.top = m_OrgRegion.bottom + SV_3DRG_SPACING;
	contrlRect.bottom = contrlRect.top + SV_3DRG_LARGESLIDERHEIGHT;
	m_sldSliceNo.MoveWindow(&contrlRect, FALSE);
	m_OrgRegion.InflateRect(-3,-3);
	m_ResRegion.InflateRect(-3,-3);

	// Update frame for the cutting object
	m_oCutter.SetFrame(m_OrgRegion);
}