You guys don't understand... I don't understand hardly anything about C++! The only book I've got is An Idiot's Guide to C++ and I havent even finished that! I just want to learn how to draw a line!!!
Thanks!
Printable View
You guys don't understand... I don't understand hardly anything about C++! The only book I've got is An Idiot's Guide to C++ and I havent even finished that! I just want to learn how to draw a line!!!
Thanks!
If you want to draw a line with no programming skills, use windows paint. ;)
No but seriously now... Drawing graphics with C/C++ just is not that simple. Because under Windows you can't directly access hardware and so on... So under Windows you should use DirectX or OpenGL or any other graphics library. You can look for tutorials but I'd recommend to learn more than basics of C++.
And besides... If there would be a simple way like DrawLine(x, y, x1, y1); it would've been told on this board a millions of times by now.
What are you trying to draw in? A SDI windows program maybe. The simplest way is to get a client DC to draw on(example in MFC) and use the line to function.
void CMainWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
CClientDC dc(this);
CRect rc;
GetClientRect(&rt);
dc.MoveTo(0, (rc.bottom + re.top) / 2);
dc.LineTo((rc.right + rc.left) / 2, 0);
dc.LineTo(rc.right, (rc.bottom + rc.top) / 2);
dc.LineTo((rc.bottom + rc.top) / 2);
}
This segment of code will draw a diamond on the client space of a window. Using a device context you can use the LineTo function to draw from two CPoint objects or from raw coordinates.
*cough* use DOS *cough*...