static U32 BitBltTestProc(HWND hwnd,U32 msg,WPARAM wParam,LPARAM lParam)
{
static int i,x0,y0,inc,xx,yy;
HDC mem_hdc,hdc;
RTC_TIME time;
char buf[128];
RECT rc;
COORD x,y;
////
switch(msg)
{
case MSG_CREATE:
i=0;
x0=0;
y0=0;
inc=1;
TimerCreate(hwnd,0x3000,50);
break;
////
case MSG_CHAR:
switch(wParam)
{
case VK_LEFT:
GetWindowRect(hwnd,&rc);
MoveWindow(hwnd,rc.x-8,rc.y);
break;
////
case VK_RIGHT:
GetWindowRect(hwnd,&rc);
MoveWindow(hwnd,rc.x+8,rc.y);
break;
////
case VK_UP:
GetWindowRect(hwnd,&rc);
MoveWindow(hwnd,rc.x,rc.y-8);
break;
////
case VK_DOWN:
GetWindowRect(hwnd,&rc);
MoveWindow(hwnd,rc.x,rc.y+8);
break;
////
}
break;
////
case MSG_TIMER:
x0+=inc;
if(x0>640) inc=-1;
if(x0<=0) inc=1;
InvalidateRect(hwnd,0,0);
break;
////
case MSG_PAINT:
hdc=BeginPaint(hwnd);
mem_hdc =CreateMemDC(1024,32);
FontSetSize(mem_hdc,24);
ClrScreen(mem_hdc,GetWindowBkColor(hwnd));
RTC_GetTime(&time);
StrPrintf(buf,"今天是:%04d年%d月%d日 * 现在时间:%02d:%02d:%02d * Task7 -> %d ",time.Year,time.Month,time.Day,time.Hour,time.Min,time.Sec,i++);
TextOut(mem_hdc,150+2,8+2,RGB(20,20,20),RGB(64,00,128),buf);
TextOut(mem_hdc,150,8,RGB(255,200,0),RGB_TRANS,buf);
GetWindowRect(hwnd,&rc);
BitBlt(hdc,6,4,mem_hdc,x0,y0,rc.dx-(6<<1),32,0);
ReleaseDC(mem_hdc);
EndPaint(hwnd,hdc);
break;
////
default: DefaultWindowProc(hwnd,msg,wParam,lParam);
}
return MSG_NULL;
}
/*============================================================================*/
循环左右滚屏示例 |