Anybody knows how can I make a cursor in the client area like a CAD cursor (like rulers) I thought that I could draw and erase lines...
Posted on 2001-03-23 10:25:00 by wolfao
Wolfao, You need to intercept WM_MOUSEMOVE, the loword of lParam is the x position, the hiword is the y position, now all you have to do is draw 2 lines (remembering to rub the old ones out each time it moves..... Umbongo
Posted on 2001-03-23 11:57:00 by umbongo
You may wish to place one or more transparent windows on top of your drawing surface for the cursor and any "rubber" lines. Another option is to create a transparent window that is far larger than the display with a fixed cursor, then simply pan the window. Scott
Posted on 2001-03-23 13:07:00 by SFinegan
Thanks, but I had already tried both codes a little. It didn't work very well. I would like to learn more about transparency, hidden-frame. I created two compatible DCs: one for the draws (hdcHF), one for a cursor mask (hdcMaskCur) and one for a cursor (hdcCur). In the WM_MOUSEMOVE message I drew the two lines in hdcMaskCur and hdcCur. The problem is that I don't know how to code the WM_PAINT message :(. How can I manage/where to put the BitBlts? piece of code: (If someone wants the complete code, just ask me...) .ELSEIF uMsg==WM_MOUSEMOVE mov eax,lParam and eax,0FFFFh mov poCur.x,eax mov eax,lParam shr eax,16 mov poCur.y,eax ;------~~~~~~====== MaskCursor-Frame ======~~~~~~------ invoke PatBlt,hdcMaskCur,0,0,vMaxX,vMaxY,WHITENESS invoke SelectObject,hdcMaskCur,hPenBlack invoke MoveToEx,hdcMaskCur,poCur.x,0,0 invoke LineTo,hdcMaskCur,poCur.x,vMaxY invoke MoveToEx,hdcMaskCur,0,poCur.y,0 invoke LineTo,hdcMaskCur,vMaxX,poCur.y ;------~~~~~~====== Cursor-Frame ======~~~~~~------ invoke PatBlt,hdcCur,0,0,vMaxX,vMaxY,BLACKNESS invoke SelectObject,hdcCur,hPenWhite invoke MoveToEx,hdcCur,poCur.x,0,0 invoke LineTo,hdcCur,poCur.x,vMaxY invoke MoveToEx,hdcCur,0,poCur.y,0 invoke LineTo,hdcCur,vMaxX,poCur.y ;------~~~~~~====== Crucial Part ???? ======~~~~~~------ ; invoke InvalidateRect,hWnd,0,1 <<=== Can I use this? :o(don't woked) ; invoke UpdateWindow,hWnd <<== or this? (what is better?) .ELSEIF uMsg==WM_PAINT invoke BeginPaint,hWnd,ADDR ps mov hdcMain,eax invoke BitBlt,hdcMain,0,0,vMaxX,vMaxY,hdcHF,0,0,SRCCOPY invoke BitBlt,hdcMain,0,0,vMaxX,vMaxY,hdcMaskCur,0,0,SRCAND invoke BitBlt,hdcMain,0,0,vMaxX,vMaxY,hdcCur,0,0,SRCCOPY invoke EndPaint,hWnd,ADDR ps Thanks all...
Posted on 2001-03-23 17:56:00 by wolfao
I GOT IT!!! ;) I code the CAD cursor using BitBlt. Thank all for help me. See the code (.exe,.inc,.rc and .asm): you will need use right button, save target as...) If someone didn't like or knows how to improve, please, tell me. Thanks. :)
Posted on 2001-03-24 17:04:00 by wolfao