void DrawBitmap(HDC hdc,int x,int y,HBITMAP hBit) MemDC=CreateCompatibleDC(hdc); GetObject(hBit,sizeof(BITMAP),&bit); //hit 에 저장된 비트맵 정보 bit복사. BitBlt(hdc,x,y,bx,by,MemDC,0,0,SRCCOPY); SelectObject(MemDC,OldBitmap); #define R 20 //////////////////////////////// 그리기 초기 준비 작업 ////////////////////////////////////// if (hBit==NULL) { FillRect(hMemDC,&crt,GetSysColorBrush(COLOR_WINDOW)); // 0,1로 저장되는 메모리에 비트맵을 생성하면, 모두 0으로 채워진다.(검정색 화면 생성)
// 격자 선 긋기 for (i=0;i<crt.bottom;i+=10) { // 브러쉬 & 펜 생성 / 장착 LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam) switch (iMessage) { |
반응형
MemDC 를 이용하면, 빠른 비트맵 출력이 가능하고, 편리하게 출력할 수 있다.
반응형