如何在基于对话框的ActiveX中使用GDI + [英] How to using GDI+ in Dialog-Based ActiveX

查看:107
本文介绍了如何在基于对话框的ActiveX中使用GDI +的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

void CMFC_ActiveXCtrl::OnDraw(
            CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
    // TODO: Replace the following code with your own drawing code.
//  m_MfcDlg.MoveWindow(rcBounds,TRUE);
//  InvalidateControl(rcBounds,TRUE);
    m_MfcDlg.m_Static.MoveWindow(CRect(rcBounds.left,rcBounds.top,rcBounds.Width()-18,rcBounds.Height()-18),TRUE);
    m_MfcDlg.SetWindowPos(NULL,rcBounds.left,rcBounds.top,rcBounds.Width(),rcBounds.Height(),SWP_NOMOVE);
}





void CMFC_Dialog::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	GetDlgItem(IDC_DISPLAY_IMAGE)->GetClientRect(&m_rectClientRect);

//	CDC *lPdc = GetDlgItem(IDC_DISPLAY_IMAGE)->GetDC();

//	lPdc->Rectangle(m_rectClientRect.left+20,m_rectClientRect.top+20,m_rectClientRect.right-20,m_rectClientRect.bottom-20);

	Graphics lGraphics(GetDlgItem(IDC_DISPLAY_IMAGE)->GetDC()->m_hDC);

	Pen pen(Color(255,255,0));

	lGraphics.DrawRectangle(&pen,Rect(10,10,200,200));


	// Do not call CDialog::OnPaint() for painting messages
}


当我在ActiveX容器中使用它时,我的应用程序崩溃了.谁能告诉我如何在基于对话框的ActiveX中使用GDI +.谢谢!


When I use this in ActiveX Container,My Application Collapsed.Who can tell me how to use GDI+ in Dialog-Based ActiveX.THANKS!

推荐答案

您确定已初始化在ActiveX解决方案中正确使用GDI +?
Are you sure you initialized GDI+ correctly in the ActiveX solution?


这篇关于如何在基于对话框的ActiveX中使用GDI +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆