Hi all,

I would like to create a floating label which displays my current
mouse coordinator with BitBlt API. The problem is that my background picture
can't be redrawn to its orignal background properly. Its get some ripple.
This is my code:

Form Load
dim OldX as long, OldY as long, mSize as Size
dim newMemDC as long, orgSaveDC as long
dim mBitMap as long, mBitMap2 as long

newMemDC = CreateCompatibleDC(0)
orgSaveDC = CreateCompatibleDC(0)
mBitmap = CreateCompatibleBitmap(Picture1.hDC, 100, 30)
mBitmap2 = CreateCompatibleBitmap(Picture1.hDC, 100, 100)
SelectObject newMemDC , mBitmap
SelectObject orgSaveDC , mBitmap2

'// newMemDC is used to restore new drawing picture
'// orgSaveDC is used to restore the original background

Private Picture1_MouseMove(........

'// if it's not the first time, OldX and OldY are not zero.
'// So I need to redraw to its original background before drawing
If OldX <> 0 And OldY <> 0 Then
BitBlt Picture1.hDC, OldX, OldY - 30, mSize.cx, mSize.cy, orgSaveDC,
End If
'// Draw new coordinator
GetTextExtentPoint32 Picture1.hDC, CStr(y), Len(CStr(y)), mSize
TextOut newMemDC, 0, 0, CStr(y), Len(CStr(y))
BitBlt orgSaveDC, 0, 0, mSize.cx, mSize.cy, Picture1.hDC, x, y, SRCCOPY
BitBlt Picture1.hDC, x, y - mSize.cy, mSize.cx, mSize.cy, newMemDC,
mX = x
mY = y

End Sub

Thank you very much
Rattagarn V.