-
Create Tooltip with BitBlt functions
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
further
If OldX <> 0 And OldY <> 0 Then
BitBlt Picture1.hDC, OldX, OldY - 30, mSize.cx, mSize.cy, orgSaveDC,
0, 0, SRCCOPY
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,
0, 0, SRCCOPY
mX = x
mY = y
End Sub
Thank you very much
Rattagarn V.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks