Is it possible to draw on a bitmap using a pen tool.. I would presume both BMP object and pen object would need to be on the same DC if that make sense...
Is it possible to draw on a bitmap using a pen tool.. I would presume both BMP object and pen object would need to be on the same DC if that make sense...
The bitmap needs to be on the same DC as the pen, yes.
The DC has multiple types of objects that it uses for different purposes, such as Pen is used fro LineTo, DrawText for example, whilst a Brush is used for Fill functions, and the Bitmap is the "destination surface" that you draw onto.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Yes, the SelectObject would "know" what type of object you are selecting and "do the right thing".
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
here's my code... nothing works!
anything wrong?Code:HPEN pen, oldPen; pen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0)); hMemDC = CreateCompatibleDC(0); hOldBmp = SelectObject(hMemDC, hBmp); oldPen = (HPEN)SelectObject(hMemDC, pen); MoveToEx(hMemDC, centre.x,centre.y, NULL); LineTo(hMemDC, coord.x, coord.y.y); SelectObject(hMemDC, oldPen); SelectObject (hMemDC, hOldBmp); //DeleteObject(pen); DeleteDC(hMemDC); RadarBgrnd.Repaint ();
"nothing works" is a pretty poor description of a problem.
Check that CreatePen and SelectObject are not returning NULL.
Edit: Also check that LineTo() and MoveToEx returns non-zero.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Looks OK to me, aside from what I perceive as a typo:
--Code:LineTo(hMemDC, coord.x, coord.y.y);
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.