Paint problem

M

Manjesh Gowda

I am using StretchDiBits to convert the DIB bitmap to Device context
of my window. It has some problem , sometimes it fails to paint the
form DC whenever i move the mouse over it get repainted. I even tried
using SetDIBitsToDevice , but it didn't help Is there i need to do ,
make this work , here is the code
ret=SetDIBitsToDevice(dc,mRect.left,mRect.Top,mWidth,mHeight,0,0,0,mHeight,pBits,bInfo,DIB_RGB_COLORS);
 
E

Ekkehard Morgenstern

Hi Manjesh Gowda,

Manjesh Gowda said:
I am using StretchDiBits to convert the DIB bitmap to Device context
of my window. It has some problem , sometimes it fails to paint the
form DC whenever i move the mouse over it get repainted. I even tried
using SetDIBitsToDevice , but it didn't help Is there i need to do ,
make this work , here is the code
ret=SetDIBitsToDevice(dc,mRect.left,mRect.Top,mWidth,mHeight,0,0,0,mHeight,p
Bits,bInfo,DIB_RGB_COLORS);

You should probably post this in one of the Windows programming newsgroups.

But anyway, from what you're saying it seems you don't do the painting in
the WM_PAINT handling, as it should be. You should never draw to a window
outside WM_PAINT handling (between a BeginPaint() and EndPaint() bracket).
To trigger a window repaint, use InvalidateRect() with a RECT pointer of
NULL. The window receives a WM_PAINT message then when the system is ready
for it.

I hope this helps.

Regards,
Ekkehard Morgenstern.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
EmeliaBryc

Latest Threads

Top