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
BOOL CAboutDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	if ( nHitTest == HTCLIENT ) {
        // Web の URLかメールアドレスにマウスポインタが来たら、
        // 指カーソルを表示する
		DWORD   dwPos = GetMessagePos();
		WORD    wX    = LOWORD( dwPos );
		WORD    wY    = HIWORD( dwPos );
		CPoint  poCursor( wX, wY );
		CRect   rcClient;

        CStatic *s = (CStatic *)GetDlgItem( IDC_JBOOKLET_MAIL_ADDR );
        s->GetWindowRect( &rcClient );
        if ( (wX >= rcClient.left) && (wX <= rcClient.right)  &&
             (wY >= rcClient.top)  && (wY <= rcClient.bottom)    ) {
			SetCursor( m_hCursor );
            return TRUE;
        }

        s = (CStatic *)GetDlgItem( IDC_JBOOKLET_WEB_URL );
        s->GetWindowRect( &rcClient );
        if ( (wX >= rcClient.left) && (wX <= rcClient.right)  &&
             (wY >= rcClient.top)  && (wY <= rcClient.bottom)    ) {
			SetCursor( m_hCursor );
            return TRUE;
        }
	}

	return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
Exemple #3
0
bool CLogGraph::attach(UINT id, CWnd* pParent)
{
	CStatic  wndStatic;		
	CRect    r;

	if (pParent == NULL || !wndStatic.SubclassDlgItem(id, pParent))
		return false;

	wndStatic.GetWindowRect(&r);
	pParent->ScreenToClient(&r);
		
	if ( !CreateEx( wndStatic.GetExStyle(), 
		            NULL, NULL, WS_CHILD | WS_VISIBLE | wndStatic.GetStyle(),
		            r, pParent, id, NULL))
	{		
		wndStatic.DestroyWindow();
		return false;
	}
	
	wndStatic.DestroyWindow();

	EnableScrollBarCtrl(SB_HORZ, TRUE);
	GetClientRect(&m_rectWnd);
	calcRect();
	SetTimer(11839, 1000, NULL);

	m_bCreated = true;
	return true;
}
/******************************************************************************
 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);
    }
}
//////////////////
// Create folder tab control from static control.
// Destroys the static control. This is convenient for dialogs
//
BOOL CFolderTabCtrl::CreateFromStatic(UINT nID, CWnd* pParent)
{
	CStatic wndStatic;
	if (!wndStatic.SubclassDlgItem(nID, pParent))
		return FALSE;
	CRect rc;
	wndStatic.GetWindowRect(&rc);
	pParent->ScreenToClient(&rc);
	wndStatic.DestroyWindow();
	rc.bottom = rc.top + GetDesiredHeight();
	return Create(WS_CHILD|WS_VISIBLE, rc, pParent, nID);
}
BOOL CBMPImportSetupDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	CStatic *hmap = (CStatic *)GetDlgItem(IDC_IMAGE);

	hmap->ShowWindow(SW_HIDE);
	hmap->GetWindowRect(&m_rectImage);
	ScreenToClient(&m_rectImage);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #7
0
// 초기값
BOOL CLevelDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	CStatic *pStatic = (CStatic *)GetDlgItem(IDC_STATIC_COLOR);
	pStatic->GetWindowRect(&ld_rect);
	ScreenToClient(&ld_rect);
	
	// 리스트박스의 초기값 설정
	ld_cFont.SetCurSel(0);
	
	return TRUE;  // return TRUE unless you set the focus to a control
}
Exemple #8
0
LRESULT CErrorReportDlg::OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// Here we want to draw a white header of the dialog

	CErrorReportSender* pSender = CErrorReportSender::GetInstance();

    CDCHandle dc((HDC)wParam);

    RECT rcClient;
    GetClientRect(&rcClient);

    RECT rc;
    CStatic statUpperHorzLine = GetDlgItem(IDC_UPPERHORZ);
    statUpperHorzLine.GetWindowRect(&rc);
    ScreenToClient(&rc);

    COLORREF cr = GetSysColor(COLOR_3DFACE);
    CBrush brush;
    brush.CreateSolidBrush(cr);  

    RECT rcHeading = {0, 0, rcClient.right, rc.bottom};
    dc.FillRect(&rcHeading, (HBRUSH)GetStockObject(WHITE_BRUSH));

    RECT rcBody = {0, rc.bottom, rcClient.right, rcClient.bottom};
    dc.FillRect(&rcBody, brush);

    rcHeading.left = 60;
    rcHeading.right -= 10;

	// Draw header text over background
    CString sHeading;
    sHeading.Format(pSender->GetLangStr(_T("MainDlg"), _T("HeaderText")), pSender->GetCrashInfo()->m_sAppName);
    dc.SelectFont(m_HeadingFont);
    dc.DrawTextEx(sHeading.GetBuffer(0), sHeading.GetLength(), &rcHeading, 
        DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);  

	// Check if we should draw the icon on the header area
    if(m_HeadingIcon)
    {
		// Draw the icon left to the text
        ICONINFO ii;
        m_HeadingIcon.GetIconInfo(&ii);
        dc.DrawIcon(16, rcHeading.bottom/2 - ii.yHotspot, m_HeadingIcon);
    }

    return TRUE;
}
void CMovieView::OnMouseMove(UINT nFlags, CPoint point) 
{
	CRect rc;
	CStatic* pFrame = (CStatic*)GetDlgItem(IDC_FORM_IMAGE);
	pFrame->GetWindowRect(rc);
	ScreenToClient(rc);

	if(rc.PtInRect(point))
	{
		// 리소스를 이용하는 경우 
		PlaySound(MAKEINTRESOURCE(IDR_WAVE1), AfxGetInstanceHandle(), 
			SND_ASYNC | SND_RESOURCE); 
        
		// 파일을 이용하는 경우 
		//PlaySound("c:\\Ricochet.wav", NULL, SND_ASYNC | SND_FILENAME); 
	}	
	CFormView::OnMouseMove(nFlags, point);
}
Exemple #10
0
// CefJamCEFHtmlView message handlers
BOOL CefJamCEFHtmlView::CreateFromResource(UINT nID, CWnd* pParent,LPCTSTR csControlClass)
{
    CRect rc;

    CString csCompareClass=csControlClass;
    if (csCompareClass.CompareNoCase(HTMLVIEW_CONTROL_CLASS_CSTATIC)==0)
    {
        CStatic wndStatic;
        if (!wndStatic.SubclassDlgItem(nID, pParent))
            return FALSE;

        // Get static control rect, convert to parent's client coords.

        wndStatic.GetWindowRect(&rc);
        pParent->ScreenToClient(&rc);
        wndStatic.DestroyWindow();
    }
    else if (csCompareClass.CompareNoCase(HTMLVIEW_CONTROL_CLASS_CEDIT)==0)
    {
        CEdit wndEdit;
        if (!wndEdit.SubclassDlgItem(nID, pParent))
            return FALSE;

        // Get static control rect, convert to parent's client coords.

        wndEdit.GetWindowRect(&rc);
        pParent->ScreenToClient(&rc);
        wndEdit.DestroyWindow();
    }
    else
    {
        return FALSE;
    }

    // create HTML control (CHtmlView)
    return Create(NULL,						 // class name
                  NULL,										 // title
                  (WS_CHILD | WS_VISIBLE|WS_CLIPCHILDREN ),			 // style
                  rc,										 // rectangle
                  pParent,									 // parent
                  nID,										 // control ID
                  NULL);									 // frame/doc context not used
}
Exemple #11
0
BOOL FW_HtmlCtrl::CreateFromStatic(UINT nID, CWnd* pParent)
{
	CStatic wndStatic;
	if (!wndStatic.SubclassDlgItem(nID, pParent))
		return FALSE;
	
	CRect rc;
	wndStatic.GetWindowRect(&rc);
	pParent->ScreenToClient(&rc);
	wndStatic.ShowWindow(SW_HIDE);
	
	return Create(NULL,
		NULL,
		(WS_CHILD | WS_VISIBLE ),
		rc,
		pParent,
		nID,
		NULL);
}
void CDialog_subSTL::OnBnClickedButton3()// move STL
{
	init_loc(); // set initial value for MFC slicer and edit

	vtkSmartPointer<vtkSTLReader> pickedDoneSTL=vtkSmartPointer<vtkSTLReader>::New();	
	pickedDoneSTL->SetFileName("test_picked.stl");
    pickedDoneSTL->Update();
	
    //vtkSmartPointer<vtkTransformPolyDataFilter> Femur_transformFilter = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
    Femur_transformFilter->SetInputConnection(pickedDoneSTL->GetOutputPort());
    //vtkSmartPointer<vtkTransform> Femur_translation =  vtkSmartPointer<vtkTransform>::New();
	Femur_translation->Translate(0,0,0);
    Femur_transformFilter->SetTransform(Femur_translation);
    Femur_transformFilter->Update();
    vtkSmartPointer<vtkPolyDataMapper> mapper =vtkSmartPointer<vtkPolyDataMapper>::New();
    mapper->SetInputConnection(Femur_transformFilter->GetOutputPort());
    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(mapper);
	vtkSmartPointer<vtkAxesActor> axes = vtkSmartPointer<vtkAxesActor>::New();
    axes->SetTotalLength(100,100,100);
    vtkSmartPointer<vtkTransform> transform_axes = vtkSmartPointer<vtkTransform>::New();
    axes->SetUserTransform(transform_axes);
    vtkSmartPointer<vtkRenderer> renderer =vtkSmartPointer<vtkRenderer>::New();
    //vtkSmartPointer<vtkRenderWindow> Femur_renderWindow =vtkSmartPointer<vtkRenderWindow>::New();
    Femur_renderWindow->AddRenderer(renderer);

	CStatic *pclStatic = new CStatic(); 
    LPRECT rect = new CRect; 
    pclStatic = (CStatic*)GetDlgItem(IDC_STATIC_V); 
	Femur_renderWindow->SetParentId(pclStatic->m_hWnd);// 
	pclStatic->GetWindowRect(rect); 
    Femur_renderWindow->SetSize(rect->right-rect->left, rect->bottom-rect->top); 
    Femur_renderWindow->SetPosition(0,0); 
    //vtkSmartPointer<vtkRenderWindowInteractor> Femur_renderWindowInteractor =vtkSmartPointer<vtkRenderWindowInteractor>::New();
    Femur_renderWindowInteractor->SetRenderWindow(Femur_renderWindow);
    renderer->AddActor(actor);
	renderer->AddActor(axes);
    Femur_renderWindow->Render();
    Femur_renderWindowInteractor->Start();
	
}
//////////////////
// Create control in same position as an existing static control with
// the same ID (could be any kind of control, really)
//
BOOL CHtmlCtrl::CreateFromStatic(UINT nID, CWnd* pParent)
{
	CStatic wndStatic;
	if (!wndStatic.SubclassDlgItem(nID, pParent))
		return FALSE;

	// Get static control rect, convert to parent's client coords.
	CRect rc;
	wndStatic.GetWindowRect(&rc);
	pParent->ScreenToClient(&rc);
	wndStatic.DestroyWindow();

	// create HTML control (CHtmlView)
	return Create(NULL,						 // class name
		NULL,										 // title
		(WS_CHILD | WS_VISIBLE ),			 // style
		rc,										 // rectangle
		pParent,									 // parent
		nID,										 // control ID
		NULL);									 // frame/doc context not used
}
Exemple #14
0
BOOL CuDlgIpmDetailLocation::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CStatic* s = (CStatic*)GetDlgItem (IDC_MFC_STATIC1);
	CRect r;
	VERIFY (m_cListLegend.SubclassDlgItem (IDC_MFC_LIST1, this));
	s->GetWindowRect (r);
	ScreenToClient (r);
	m_pDlgFrame = new CuStatisticBarFrame(CuStatisticBarFrame::nTypePie);
	m_pDlgFrame->Create (
		NULL,
		NULL,
		WS_CHILD,
		r,
		this);
	m_pDlgFrame->ShowWindow (SW_SHOW);
	m_pDlgFrame->InitialUpdateFrame (NULL, TRUE);
	m_pDlgFrame->DrawLegend (&m_cListLegend, TRUE);
	return TRUE;  // return TRUE unless you set the focus to a control
				  // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #15
0
LRESULT CErrorReportDlg::OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    CDCHandle dc((HDC)wParam);

    RECT rcClient;
    GetClientRect(&rcClient);

    RECT rc;
    CStatic statUpperHorzLine = GetDlgItem(IDC_UPPERHORZ);
    statUpperHorzLine.GetWindowRect(&rc);
    ScreenToClient(&rc);

    COLORREF cr = GetSysColor(COLOR_3DFACE);
    CBrush brush;
    brush.CreateSolidBrush(cr);  

    RECT rcHeading = {0, 0, rcClient.right, rc.bottom};
    dc.FillRect(&rcHeading, (HBRUSH)GetStockObject(WHITE_BRUSH));

    RECT rcBody = {0, rc.bottom, rcClient.right, rcClient.bottom};
    dc.FillRect(&rcBody, brush);

    rcHeading.left = 60;
    rcHeading.right -= 10;

    CString sHeading;
    sHeading.Format(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("HeaderText")), g_CrashInfo.m_sAppName);
    dc.SelectFont(m_HeadingFont);
    dc.DrawTextEx(sHeading.GetBuffer(0), sHeading.GetLength(), &rcHeading, 
        DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);  

    if(m_HeadingIcon)
    {
        ICONINFO ii;
        m_HeadingIcon.GetIconInfo(&ii);
        dc.DrawIcon(16, rcHeading.bottom/2 - ii.yHotspot, m_HeadingIcon);
    }

    return TRUE;
}
BOOL CSettingHatenaHaiku::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	if ( nHitTest == HTCLIENT ) {
        // Web の URLかメールアドレスにマウスポインタが来たら、
        // 指カーソルを表示する
		DWORD   dwPos = GetMessagePos();
		WORD    wX    = LOWORD( dwPos );
		WORD    wY    = HIWORD( dwPos );
		CPoint  poCursor( wX, wY );
		CRect   rcClient;

        CStatic *s = (CStatic *)GetDlgItem( IDC_URL_HATENAHAIKU_SETTING );
        s->GetWindowRect( &rcClient );
        if ( (wX >= rcClient.left) && (wX <= rcClient.right)  &&
             (wY >= rcClient.top)  && (wY <= rcClient.bottom)    ) {
			SetCursor( m_hCursor );
            return TRUE;
        }
	}

	return CTabDialog::OnSetCursor(pWnd, nHitTest, message);
}
Exemple #17
0
BOOL CHotelDialog::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	if ( nHitTest == HTCLIENT ) {
        // アフィリエイトリンク(MyLink) の URL部分にマウスポインタが
        // 来たら、指カーソルを表示する
		DWORD   dwPos = GetMessagePos();
		WORD    wX    = LOWORD( dwPos );
		WORD    wY    = HIWORD( dwPos );
		CPoint  poCursor( wX, wY );
		CRect   rcClient;

        CStatic *s = (CStatic *)GetDlgItem( IDC_AFFILIATE_URL );
        s->GetWindowRect( &rcClient );
        if ( (wX >= rcClient.left) && (wX <= rcClient.right)  &&
             (wY >= rcClient.top)  && (wY <= rcClient.bottom)    ) {
			SetCursor( m_hCursor );
            return TRUE;
        }
	}
	
	return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
void CDialog_subSTL::OnBnClickedButton1() //load STL
{
	CString strFile = _T("");
    CFileDialog    dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("Describe Files (*.stl)|*.stl|All Files (*.*)|*.*||"), NULL);
    //dlgFile.m_ofn.lpstrInitialDir=_T("D:W\code_LPX");
    if (dlgFile.DoModal())
    {
        strFile = dlgFile.GetPathName();
    } 
    //std::string stdstrFile(CT2CA(strFile));//std::string s((LPCTSTR)strFile);
	//std::string ss((CStringA(strFile)));
    //const char* cstr = (LPCTSTR)strFile;
	CStringA strFileA(strFile);
	
	//vtkSmartPointer<vtkSTLReader> STLReader= vtkSmartPointer<vtkSTLReader>::New();
	p = strFileA.GetString();
	STLReader->SetFileName(p);
	vtkSmartPointer<vtkPolyDataMapper> map=vtkSmartPointer<vtkPolyDataMapper>::New();
	map->SetInput(STLReader->GetOutput());//decimated);
    vtkSmartPointer<vtkActor> act=vtkSmartPointer<vtkActor>::New();
    act->SetMapper(map);
    vtkSmartPointer<vtkRenderer> ren_STL=vtkSmartPointer<vtkRenderer>::New();
    vtkSmartPointer<vtkRenderWindow> renwin_STL=vtkSmartPointer<vtkRenderWindow>::New();
    ren_STL->AddActor(act);
    renwin_STL->AddRenderer(ren_STL);
    
    CStatic *pclStatic = new CStatic(); //show VTK window on MFC
    LPRECT rect = new CRect; 
    pclStatic = (CStatic*)GetDlgItem(IDC_STATIC_V); 
	renwin_STL->SetParentId(pclStatic->m_hWnd);// 
	pclStatic->GetWindowRect(rect); 
    renwin_STL->SetSize(rect->right-rect->left, rect->bottom-rect->top); 
    renwin_STL->SetPosition(0,0); 
	//vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor_STL =vtkSmartPointer<vtkRenderWindowInteractor>::New();
    renderWindowInteractor_STL->SetRenderWindow(renwin_STL);
	renwin_STL->Render();
    renderWindowInteractor_STL->Start();
}
void CDialog_init::OnBnClickedButton1() // load STL file and X-ray contour image
{
    
	vtkSmartPointer<vtkSTLReader> pickedDoneSTL=vtkSmartPointer<vtkSTLReader>::New();	//load STL
	if(!g_prox_or_dist)
		pickedDoneSTL->SetFileName(g_STL_PNG_DIST[0].c_str());
	else
		pickedDoneSTL->SetFileName(g_STL_PNG_PROX[0].c_str());
	pickedDoneSTL->Update();

	transformFilter->SetInputConnection(pickedDoneSTL->GetOutputPort());//move and rotate STL
	translation->Translate(0,0,0);
    transformFilter->SetTransform(translation);
    transformFilter->Update();

    vtkSmartPointer<vtkPolyDataMapper> mapper =vtkSmartPointer<vtkPolyDataMapper>::New();
    mapper->SetInputConnection(transformFilter->GetOutputPort());
	//mapper->SetInputConnection(pickedDoneSTL->GetOutputPort());
	
	vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(mapper);
	vtkSmartPointer<vtkRenderer> FemurRenderer =vtkSmartPointer<vtkRenderer>::New();
    FemurRenderer->AddActor(actor);
   
	vtkSmartPointer<vtkCamera> Femurcam=vtkSmartPointer<vtkCamera>::New();
    Femurcam->SetPosition(0,-DETECTOR_SID/2,0); //555 is a half of SID (=1110)
    Femurcam->SetFocalPoint(0,DETECTOR_SID/2,0);
	Femurcam->SetViewUp(0,-DETECTOR_SID/2,1);
    //Femurcam->SetViewAngle(14.9); 
	Femurcam->SetViewAngle(17); 
	Femurcam->SetClippingRange(-500,700);
	     //fx is roughly 6035 for 1560x1440 images
	     //fx is modified into 6035/2 since our x-ray images has 720x780 sizes.
	     //from this value, we estimated the real size of the detector : Height 132.5 = 360(=720/2)*1110(SID)/3017.5(=6035/2)
	     //Then, one side angle was calucated as 6.807 = atan(DETECTOR_WIDTH/2/1110)
	     //view angle was calculated as 7.45 * 2 = 14.9
    FemurRenderer->SetActiveCamera(Femurcam);
	vtkSmartPointer<vtkJPEGReader> JPEGReader =vtkSmartPointer<vtkJPEGReader>::New(); //load contour image
    if(!g_prox_or_dist)
		JPEGReader->SetFileName(g_STL_PNG_DIST[1].c_str());
	else
		JPEGReader->SetFileName(g_STL_PNG_PROX[1].c_str());
    
	JPEGReader->Update();
    vtkSmartPointer<vtkTexture> texture = vtkSmartPointer<vtkTexture>::New();
    texture->SetInputConnection(JPEGReader->GetOutputPort());
    vtkSmartPointer<vtkPlaneSource> plane = vtkSmartPointer<vtkPlaneSource>::New();
	//y direction is normal of the plane
	//-z direction is up direction of camera
	//x direction is lateral direction of camera
	
	plane->SetOrigin(0,DETECTOR_SID/2,0);
	plane->SetPoint1(-DETECTOR_WIDTH/2, DETECTOR_SID/2,0);
	plane->SetPoint2(0,DETECTOR_SID/2,-DETECTOR_HEIGHT/2);
	plane->SetNormal(0,DETECTOR_SID/2,0);
	plane->SetResolution(XRAY_WIDTH,XRAY_HEIGHT);
    plane->SetCenter(0,0,0);

    //plane->Push(45);
    vtkSmartPointer<vtkTextureMapToPlane> texturePlane = vtkSmartPointer<vtkTextureMapToPlane>::New();
    texturePlane->SetInputConnection(plane->GetOutputPort());
    vtkSmartPointer<vtkPolyDataMapper> planeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    planeMapper->SetInputConnection(texturePlane->GetOutputPort());
    vtkSmartPointer<vtkActor> texturedPlane = vtkSmartPointer<vtkActor>::New();
    texturedPlane->SetMapper(planeMapper);
    texturedPlane->SetTexture(texture);
    vtkSmartPointer<vtkTextActor> textActor=vtkSmartPointer<vtkTextActor>::New();
    textActor->GetTextProperty()->SetFontSize(12);
    textActor->GetTextProperty()->SetColor(1.0,1.0,0.0);
    textActor->SetPosition2(10,20);
    textActor->SetInput("Cam Pos : 0, 555,0");

	vtkSmartPointer<vtkRenderer> ren =vtkSmartPointer<vtkRenderer>::New();
    renderWindow->AddRenderer(ren);
	renderWindow->AddRenderer(FemurRenderer);
    
	vtkSmartPointer<vtkCamera> cam=vtkSmartPointer<vtkCamera>::New();
    cam->SetPosition(0,-DETECTOR_SID/2,0);
    cam->SetFocalPoint(0,DETECTOR_SID/2,0);
    //cam->SetViewAngle(14.9);
	cam->SetViewAngle(17);
	cam->SetViewUp(0,-DETECTOR_SID/2,-1);
	cam->SetClippingRange(-500,700);

    ren->SetActiveCamera(cam);
    ren->AddActor(texturedPlane);
    ren->AddActor(textActor);
    ren->SetBackground(0.2,0.3,0.4);
    ren->SetLayer(0); 
	ren->InteractiveOff();
    FemurRenderer->SetLayer(1); // choose window render for interactor
    renderWindow->SetNumberOfLayers(2);
	CStatic *pclStatic = new CStatic(); 
    LPRECT rect = new CRect; 
	pclStatic = (CStatic*)GetDlgItem(IDC_STATIC_VIEW); 
	renderWindow->SetParentId(pclStatic->m_hWnd);// 
	pclStatic->GetWindowRect(rect); 
    renderWindow->SetSize(rect->right-rect->left, rect->bottom-rect->top); 
    renderWindow->SetPosition(0,0); 
	
    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =vtkSmartPointer<vtkRenderWindowInteractor>::New();
    renderWindowInteractor->SetRenderWindow(renderWindow);
    renderWindow->Render();
    //renderWindowInteractor->Start();	

	vtkSmartPointer<vtkJPEGReader>Load_Drr=vtkSmartPointer<vtkJPEGReader>::New();

	if(!g_prox_or_dist)
		Load_Drr->SetFileName(g_STL_PNG_DIST[0].c_str());
	else
		Load_Drr->SetFileName(g_STL_PNG_PROX[0].c_str());

	Load_Drr->Update();
	m_Px.SetRange(-480,480,TRUE);
	m_Px.SetTicFreq(5);
	m_Px.SetPos(0);
	m_Py.SetRange(-600,600,TRUE);
	m_Py.SetTicFreq(5);
	m_Py.SetPos(0);
	m_Pz.SetRange(-480,480,TRUE);
	m_Pz.SetTicFreq(5);
	m_Pz.SetPos(0);
	m_Rx.SetRange(-480,480,TRUE);
	m_Rx.SetTicFreq(5);
	m_Rx.SetPos(0);
	m_Ry.SetRange(-480,480,TRUE);
	m_Ry.SetTicFreq(5);
	m_Ry.SetPos(0);
	m_Rz.SetRange(-480,480,TRUE);
	m_Rz.SetTicFreq(5);
	m_Rz.SetPos(0);

	CStdioFile file;
	if(!file.Open(_T("Saved_parameter.txt"),CFile::modeRead))
	{
				GetDlgItem(IDC_EDIT1)->SetWindowText(_T("0"));
				GetDlgItem(IDC_EDIT2)->SetWindowText(_T("0"));
				GetDlgItem(IDC_EDIT3)->SetWindowText(_T("0"));
				GetDlgItem(IDC_EDIT4)->SetWindowText(_T("0"));
				GetDlgItem(IDC_EDIT5)->SetWindowText(_T("0"));
				GetDlgItem(IDC_EDIT6)->SetWindowText(_T("0"));
	}
	else
	{
		CString All;
		CString sx[6];
		CString token=_T("");
		int i=0;
		file.ReadString(All);
		while (AfxExtractSubString(token, All, i,' '))
			{   
				sx[i]=token;
			   i++;
			   if(i>=6)break;
			}
					GetDlgItem(IDC_EDIT1)->SetWindowText(sx[0]);
					GetDlgItem(IDC_EDIT2)->SetWindowText(sx[1]);
					GetDlgItem(IDC_EDIT3)->SetWindowText(sx[2]);
					GetDlgItem(IDC_EDIT4)->SetWindowText(sx[3]);
					GetDlgItem(IDC_EDIT5)->SetWindowText(sx[4]);
					GetDlgItem(IDC_EDIT6)->SetWindowText(sx[5]);
		file.Close();
	}
	

	//view2 start
    vtkSmartPointer<vtkRenderer> FemurRenderer2 =vtkSmartPointer<vtkRenderer>::New();
    FemurRenderer2->AddActor(actor);
	vtkSmartPointer<vtkCamera> Femurcam2=vtkSmartPointer<vtkCamera>::New();
    Femurcam2->SetPosition(DETECTOR_SID/2,-DETECTOR_SID/2,0);
    Femurcam2->SetFocalPoint(0,0,0);
    Femurcam2->SetViewAngle(52);
    FemurRenderer2->SetActiveCamera(Femurcam2);
    renderWindow2->AddRenderer(FemurRenderer2);
	
	CStatic *pclStatic2 = new CStatic(); 
    LPRECT rect2 = new CRect; 
	pclStatic2 = (CStatic*)GetDlgItem(IDC_STATIC_VIEW2); 
	renderWindow2->SetParentId(pclStatic2->m_hWnd);// 
	pclStatic2->GetWindowRect(rect2); 
    //renderWindow2->SetSize(rect2->right-rect2->left, rect2->bottom-rect2->top); 
	renderWindow2->SetSize(780, 720); 
    renderWindow2->SetPosition(0,0); 
    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor2 =vtkSmartPointer<vtkRenderWindowInteractor>::New();
    renderWindowInteractor2->SetRenderWindow(renderWindow2);
    renderWindow2->Render();
    //renderWindowInteractor2->Start();	
    /////////////////////view2 end
    //view3 start
    vtkSmartPointer<vtkRenderer> FemurRenderer3 =vtkSmartPointer<vtkRenderer>::New();
    FemurRenderer3->AddActor(actor);
	vtkSmartPointer<vtkCamera> Femurcam3=vtkSmartPointer<vtkCamera>::New();

	if(!g_prox_or_dist)
	Femurcam3->SetPosition(0,0, -DETECTOR_SID/2);
	else
    Femurcam3->SetPosition(0,0, -DETECTOR_SID/2);
    Femurcam3->SetFocalPoint(0,0,0);
    Femurcam3->SetViewAngle(52);
    FemurRenderer3->SetActiveCamera(Femurcam3);
    renderWindow3->AddRenderer(FemurRenderer3);
	
	CStatic *pclStatic3 = new CStatic(); 
    LPRECT rect3 = new CRect; 
	pclStatic3 = (CStatic*)GetDlgItem(IDC_STATIC_VIEW3); 
	renderWindow3->SetParentId(pclStatic3->m_hWnd);// 
	pclStatic3->GetWindowRect(rect3); 
    renderWindow3->SetSize(rect3->right-rect3->left, rect3->bottom-rect3->top); 
    renderWindow3->SetPosition(0,0); 
	
    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor3 =vtkSmartPointer<vtkRenderWindowInteractor>::New();
    renderWindowInteractor3->SetRenderWindow(renderWindow3);
    renderWindow3->Render();
    renderWindowInteractor3->Start();	
	//view3 end
}