How do I do this? I can draw a rectangle but not a line x.x Also how would I go about drawing half of a circle.
EDIT:
Also, how would I make my embedded bitmap rotate x.x
Printable View
How do I do this? I can draw a rectangle but not a line x.x Also how would I go about drawing half of a circle.
EDIT:
Also, how would I make my embedded bitmap rotate x.x
Ok, now using the POINT structure, how would I specify current position?
If you know a good set of tutorials on doing this stuff , please direct me=P im programming in pure win32 api. Meaning no MFC etc.
Set your starting point:-
MoveToEx(hdc, x, y, NULL);
GO!
LineTo(hdc, x2, y2);
ok thanks =P, now how do I make my embedded bitmap rotate? would I have to mix opengl and bind textures and crap?
I have want to have it draw when I click a button, I will show what I've done:
This is in a child window >.<Code:switch(GET_WM_COMMAND_ID(wParam,lParam))
{
case BUTTON123:
{
HDC hdc;
PAINTSTRUCT ps;
HPEN hPen;
hdc = BeginPaint(Phys,&ps);
hPen = CreatePen(PS_DASHDOTDOT,1,RGB(0,0,0));
LineTo(hdc,200,200);
EndPaint(Phys,&ps);
}
break;
}
It doesn't do anything when the button is clicked... I tried sending a wm_paint message and having it paint that when the message is handled. and in that having a variable that gets cordinates, but nothing works
Try not to call BeginPaint/EndPaint outside of a WM_PAINT response, you'll achieve nothing.
Replace them with
hdc = GetDC(hwnd);
ReleaseDC(hwnd, hdc);
hwnd being the variable you're using for your window handle.
Also, creating a pen is all well and good, but you'll need to select it into the dc to use it. So, after your CreatePen bit:-
hOld = SelectObject(hdc, hPen);
Make hOld another HPEN.
Then, after your line drawing and before ReleaseDC:-
SelectObject(hdc, hOld);
DeleteObject(hPen);
This stops you from potentially running out of GDI handles (it stops working, as does most of Windows). :o