2017-04-23 21 views
-5

ウィンドウを非表示にすると、Figureの一部が消去されます。私はすべての機能が実行されているが、画像が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

関連する問題