本文介绍了使用GDI API在WinCE中加载的位图上绘制线条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

海,
我的要求是在加载到内存中的位图上画一条线.我在WinCE中工作.我写的代码是这样的,
HGDIOBJ hPrevObj = 0;
HGDIOBJ hPrevObj1 = 0;
BOOL bStat = 0;
dwError = :: GetLastError();
hDCMem = :: CreateCompatibleDC(g_dc);
dwError = :: GetLastError();
SelectObject(hDCMem,g_hBitmap);

dwError = 0;
dwError = :: GetLastError();
SelectObject(hDCMem,g_hPen);
dwError = 0;
dwError = :: GetLastError();
bStat = MoveToEx(hDCMem,g_X,g_Y,0);
dwError = :: GetLastError();
bStat = 0;
g_X + = 10;
g_Y + = 10;
bStat = LineTo(hDCMem,g_X,g_Y);
dwError = 0;
dwError = :: GetLastError();
bStat = 0;
//bStat = BitBlt(hDC,0,0,240,82,hDCMem,0,0,SRCCOPY);
bStat = StretchBlt(g_dc,0,0,240,82,hDCMem,0,0,240,82,SRCCOPY);
dwError = :: GetLastError();

我面临的问题是,线条绘制函数和BitBlt()函数返回成功,但未在窗口或加载的位图上反映出来.

Hai,
my requirement is to draw a line over a bitmap loaded into memory. i am working in WinCE. The code i wrote is like this,
HGDIOBJ hPrevObj = 0;
HGDIOBJ hPrevObj1 = 0;
BOOL bStat = 0;
dwError = ::GetLastError();
hDCMem = ::CreateCompatibleDC( g_dc );
dwError = ::GetLastError();
SelectObject( hDCMem, g_hBitmap );

dwError = 0;
dwError = ::GetLastError();
SelectObject( hDCMem, g_hPen );
dwError = 0;
dwError = ::GetLastError();
bStat = MoveToEx( hDCMem, g_X, g_Y, 0 );
dwError = ::GetLastError();
bStat = 0;
g_X+= 10;
g_Y += 10;
bStat = LineTo( hDCMem, g_X, g_Y );
dwError = 0;
dwError = ::GetLastError();
bStat = 0;
//bStat = BitBlt( hDC, 0, 0, 240, 82, hDCMem, 0, 0, SRCCOPY );
bStat = StretchBlt( g_dc, 0, 0, 240, 82, hDCMem, 0, 0, 240, 82, SRCCOPY );
dwError = ::GetLastError();

The problem i am facing is that the line drawing function and BitBlt() function returns success but it is not getting reflected on the window or the loaded bit map.

推荐答案


这篇关于使用GDI API在WinCE中加载的位图上绘制线条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 14:31