我现在想用gdi+类库,将指定位置的jpg文件的图像绘制到对话框的静态文本框中,但是绘制不出来,哪位仁兄能帮我看看哪里出了问题,不胜感激,谢谢(在initiance()和exitinitiance()中已初始化和关闭)
源代码如下:oid CShowScreenDlg::OnBnClickedButton1()
{
CWnd * pWnd = GetDlgItem(IDC_STATIC2);
CDC *dc=pWnd->GetDC();//pStat->GetDC();
//dc->TextOut(0,0,_T("fffffffffff")); 能显示出字符串,证明获得句柄 using namespace Gdiplus; Graphics graphics(dc->m_hDC);
Image *image = Image::FromFile(_T("C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio Projects\\ShowScreen\\ShowScreen\\1.jpg"));
CRect rect;
CPoint point;
pWnd->GetWindowRect(&rect);
point=rect.TopLeft();
//graphics.SetInterpolationMode(InterpolationModeHighQualityBilinear);
graphics.DrawImage(image,point.x,point.y,rect.Width(),rect.Height());}
源代码如下:oid CShowScreenDlg::OnBnClickedButton1()
{
CWnd * pWnd = GetDlgItem(IDC_STATIC2);
CDC *dc=pWnd->GetDC();//pStat->GetDC();
//dc->TextOut(0,0,_T("fffffffffff")); 能显示出字符串,证明获得句柄 using namespace Gdiplus; Graphics graphics(dc->m_hDC);
Image *image = Image::FromFile(_T("C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio Projects\\ShowScreen\\ShowScreen\\1.jpg"));
CRect rect;
CPoint point;
pWnd->GetWindowRect(&rect);
point=rect.TopLeft();
//graphics.SetInterpolationMode(InterpolationModeHighQualityBilinear);
graphics.DrawImage(image,point.x,point.y,rect.Width(),rect.Height());}
解决方案 »
- 在VC中如何调出windows的运行窗口
- Parsing Error: Expectde ")";
- 有什么好办法知道socket的连接情况?如何减少CSocket的connect()的时间?
- 刚学C++, 提一个简单的类继承的问题
- WM_CHAR消息lParam字段的低字节是什么东西。
- 位图的问题,江湖救急!!!!
- 问题: 如何用简单的C函数把ASC码值直接转化为字母并printf出来? 如65->A.
- 用classwizard给单选按钮添加了一个变量,虽然默认值是0,但仍有一个被选中
- 在Visual C++中设置路径时“./”和“../”区别是什么?
- 发送消息
- 请问如何将资源文件中的一个bitmap显示在文档区?
- 怎么让控件不消失
不过还是会有刷新问题,最好不用Static,直接在对话框上画