2017-04-23 2 views
-5

내 창을 숨기면 그림의 일부가 지워집니다. 나는 모든 기능이 실행되지만 이미지가WM_PAINT가 그림을 다시 그려 내지 않습니다

case WM_PAINT:{ 
     hDC = BeginPaint(ventana,&ps); 
     FillRect(hDC,&ps.rcPaint,CreateSolidBrush(RGB(100,100,100))); 
     if(hDC){ 
      CreateFrame(300,200,100,50,&hDC,&ps); 
      EndPaint(ventana,&ps); 
     } 
     break; 
    } 

기능 "CreateFrame"

int CreateFrame(long x,long y,long ancho,long alto,HDC* dc,PAINTSTRUCT* ps){ 
RECT rc; 
HBRUSH pincel = CreateSolidBrush(RGB(255,0,0)); 
rc.left = ps->rcPaint.left + x; 
rc.top = ps->rcPaint.top + y; 
rc.right = rc.left + ancho; 
rc.bottom = rc.top + alto; 

cout<<rc.left<<" - " << rc.top <<" - "<<rc.right<<" - "<<rc.bottom<<"\n"; 
if(FrameRect(*dc,&rc,pincel)){ 
    if(Ellipse(*dc,rc.left+10,rc.top+10,rc.left+20,rc.top+20)){ 
     cout<<"se dibujo elipse\n"; 
    } 
    cout<<"exito\n"; 
} 
DeleteObject(pincel); 
return 1; 

}

을 다시 그리기되지 않는 것, 내 코드가 실행되는 위치를 보여 cout을 사용하고 있습니다 해결

enter image description here

+3

이미지를 그리는 코드를 표시해야합니다. –

답변

0

문제

int CreateFrame(long x,long y,long ancho,long alto,HDC* dc,PAINTSTRUCT* ps){ 
RECT rc; 
HBRUSH pincel = CreateSolidBrush(RGB(255,0,0)); 
rc.left = x; 
rc.top = y; 
rc.right = x + ancho; 
rc.bottom = y + alto; 

cout<<rc.left<<" - " << rc.top <<" - "<<rc.right<<" - "<<rc.bottom<<"\n"; 
if(FrameRect(*dc,&rc,pincel)){ 
    if(Ellipse(*dc,rc.left+10,rc.top+10,rc.left+20,rc.top+20)){ 
     cout<<"se dibujo elipse\n"; 
    } 
    cout<<"exito\n"; 
} 
DeleteObject(pincel); 
return 1; 
을 xdxd

관련 문제