HRESULT CDTDisplay::OnDrawAdvanced(ATL_DRAWINFO& di)
{
	// TODO: Add your specialized code here and/or call the base class
	BOOL bRunTime;
	GetAmbientUserMode(bRunTime);
	if(bRunTime)
	{//Draw Picture here Display the image data in the
		if(!m_DisplayImage.IsNull())
		{
			m_DisplayImage.Draw(di.hdcDraw,m_DrawRect,m_SrcRect);
		}
	}
	else
	{
		OLE_COLOR colorOle; 
		GetAmbientBackColor(colorOle); 
		COLORREF colorRgb; 
		::OleTranslateColor(colorOle,0,&colorRgb); 
		HBRUSH hBrush; 
		hBrush=CreateSolidBrush(colorRgb); 
		RECT& rc = *(RECT*)di.prcBounds; 
		FillRect(di.hdcDraw,&rc,hBrush); 
		DeleteObject(hBrush); 
		SetBkMode(di.hdcDraw,TRANSPARENT); 
		HICON hIcon=LoadIcon(_AtlBaseModule.GetResourceInstance(),MAKEINTRESOURCE(IDI_DISPLAY)); 
		DrawIcon(di.hdcDraw,rc.left,rc.top,hIcon); 
		DeleteObject(hIcon);
	}
	return 0;
	//return __super::OnDrawAdvanced(di);
}
STDMETHODIMP
Cieambulant::SetClientSite(LPOLECLIENTSITE pSite) {
	HRESULT hr = CComControlBase::IOleObject_SetClientSite(pSite);
	if (hr != S_OK)
		return hr;
	if (pSite) {
		s_ref_count++;
		if (s_ref_count == 1)
			s_site = pSite;
	} else {
		if (s_ref_count > 0)
			s_ref_count--;
		if (s_ref_count == 0) {
			// clear all statics
			s_site = NULL;
		}
	}
	m_site = pSite;
//	if(pSite && !m_pFont)
//		hr = GetAmbientFontDisp(&m_pFont);
	GetAmbientBackColor(m_clrBackColor);
	GetAmbientForeColor(m_clrForeColor);
	//XXX std::ostream sos = new std::ostream(std::cout);
	//XXX ambulant::lib::logger::get_logger()->set_std_ostream(sos);
//	static std::ofstream log_os("C:\\Documents and Settings\\kees.AMBULANT-DEV\\My Documents\\Ambulant\\ambulant\\src\\ieambulant\\amlog.txt");
//	ambulant::lib::logger::get_logger()->set_std_ostream(log_os);
//	s_hook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, NULL, GetCurrentThreadId());
	return hr;
}
Example #3
0
STDMETHODIMP CMainWindow::SetClientSite(LPOLECLIENTSITE pSite)
{
    HRESULT hr = CComControlBase::IOleObject_SetClientSite(pSite);
    if(!m_pFont && pSite)
    {
        hr = GetAmbientFontDisp(&m_pFont);
    }
    GetAmbientBackColor(m_clrBackColor);
    GetAmbientForeColor(m_clrForeColor);
    return S_OK;
}
Example #4
0
/*! Draw an empty card, only contour
// \param RECT &rc : 
// \param HDC hdcDST : 
// \param HDC hdcSRC : 
*/
BOOL CAxJpgCard::DrawEmpty(RECT &rc, HDC hdcDST, HDC hdcSRC)
{
    if ( m_clrBckColor == 0)
        GetAmbientBackColor( m_clrBckColor ); 
    
    LOGBRUSH logBrush;
    logBrush.lbStyle = BS_HOLLOW;


    HBRUSH hBrushBck = CreateSolidBrush(m_clrBckColor);
    //HBRUSH hBrushBck = CreateBrushIndirect(&logBrush);
    HBRUSH hOldBrush = (HBRUSH)SelectObject(hdcDST, hBrushBck);
    
    // draw a empty rectangle
    FillRect(hdcDST, &rc, hBrushBck);
    
    SelectObject(hdcDST, hOldBrush);
    DeleteObject(hBrushBck);
    
    return TRUE;
}