schumi1980
June 5th, 2004, 06:29 PM
hi people,
i am working on a project that requires me to draw a line on a bitmap as the user clicks on the bitmap.
I was able to load the bitmap onto the window using this:
hbitmap = (HBITMAP)LoadImage(NULL,szFileName,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
hdcMem = CreateCompatibleDC(hdc);
GetObject(hbitmap ,sizeof(bmp), &bmp);
SelectObject(hdcMem, hbitmap);
BitBlt(hdc, 0, 0, 512, 512, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);
and then was able to get the points clicked by the user using the following
xpos = LOWORD(lParam);
ypos = HIWORD(lParam);
inside WM_LBUTTONDOWN and stored them in an array.
Now I thought of drawing the lines using MoveToEx and LineTo() inside WM_PAINT but then i don't understand how could i get the line to be displayed as soon as the user clicks on the point on the bmp. :confused:
Thanks in advance !!!
i am working on a project that requires me to draw a line on a bitmap as the user clicks on the bitmap.
I was able to load the bitmap onto the window using this:
hbitmap = (HBITMAP)LoadImage(NULL,szFileName,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
hdcMem = CreateCompatibleDC(hdc);
GetObject(hbitmap ,sizeof(bmp), &bmp);
SelectObject(hdcMem, hbitmap);
BitBlt(hdc, 0, 0, 512, 512, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);
and then was able to get the points clicked by the user using the following
xpos = LOWORD(lParam);
ypos = HIWORD(lParam);
inside WM_LBUTTONDOWN and stored them in an array.
Now I thought of drawing the lines using MoveToEx and LineTo() inside WM_PAINT but then i don't understand how could i get the line to be displayed as soon as the user clicks on the point on the bmp. :confused:
Thanks in advance !!!