Exemplo n.º 1
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
}
Exemplo n.º 2
0
void CuDlgMain::ShowShemaFile(int nSchema, BOOL bShow, LPCTSTR lpszFile)
{
	CRect r1, r2, re;

	CComboBoxEx* pComboNode = (nSchema == 1)? &m_cComboNode1: &m_cComboNode2;
	CComboBoxEx* pComboDatabase = (nSchema == 1)? &m_cComboDatabase1: &m_cComboDatabase2;
	CComboBoxEx* pComboUser = (nSchema == 1)? &m_cComboUser1: &m_cComboUser2;
	CEdit*       pEditFile  = (nSchema == 1)? &m_cEditFile1: &m_cEditFile2;
	CButton*     pSaveButton= (nSchema == 1)? &m_cButtonSc1Save: &m_cButtonSc2Save;

	pComboNode->GetWindowRect (r1);
	ScreenToClient (r1);
	pComboUser->GetWindowRect (r2);
	ScreenToClient (r2);
	pEditFile->GetWindowRect (re);
	ScreenToClient (re);
	int nHeight = re.Height();
	re.left =  r1.left;
	re.top  =  r1.top;
	re.right = r2.right;
	re.bottom =  re.top + nHeight;
	pEditFile->MoveWindow(re);

	int nDbms  = bShow? SW_HIDE: SW_SHOW;
	int nDFile = bShow? SW_SHOW: SW_HIDE;
	HICON hIcon= bShow? m_hIconNode: m_hIconSave;

	pComboNode->ShowWindow (nDbms);
	pComboDatabase->ShowWindow (nDbms);
	pComboUser->ShowWindow (nDbms);
	pEditFile->ShowWindow (nDFile);

	if (lpszFile)
		pEditFile->SetWindowText (lpszFile);
	pSaveButton->SetIcon(hIcon);
}