I'm using PolylineTo inside a for loop to draw a border. However, at the midpoint, the lines seem to jump up one line, but it stays the same height across, so it's more like it jumps up one and increases in height by one. The first line seems unchanged though. Below is the full WM_PAINT code.
1. You don't use GetDC() to get the DC during WM_PAINT. You get it as the result of calling BeginPaint(). See http://msdn.microsoft.com/en-us/library/dd183362(VS.85).aspx.
2. You don't set your initial position with MoveToEx(). See http://msdn.microsoft.com/en-us/library/dd145069(VS.85).aspx. You should always explicitly set it before using functions that use this, like PolylineTo().
3. If you are trying to draw a box, use Rectangle(). See http://msdn.microsoft.com/en-us/library/dd162898(VS.85).aspx.
4. If you insist on using PolylineTo() to draw a rectangle, you must set the starting point using MoveToEx(), and then you should specify 4 points in total to calls to PolylineTo(). Since your FOR loop goes from 1 to 4, you are providing twice as much points as needed. Finally, x.txt should contain:
1: 694 1 694 YYY
2: 0 YYY 0 1
where YYY would be the desired height of the rectangle.
1. That doesn't really matter, does it? Nonetheless, I'd made that change already.
2. That's the solution, MoveToEx is what I was missing.
3. Nope, not drawing a rectangle, just happens to be in that shape. I'm actually making a gradient, I know there's an official way, but I havn't gotten that far yet. :)
Thanks for the help, MoveToEx() is exactly what I needed.