如何更方便画折线?
现有100,99,102,105,110,99,91,97,100,101,109,100,110,104,98,99,106,...... 等数值,想用这些数值画一条折线,考虑用“line”控件,但该控件涉及“/”和“\”两种线型,定位很麻烦,有什么更好的办法能够方便的画出折线?请各位指教。
也可用WinAPI:
DECLARE LONG GetDC IN User32 LONG
DECLARE LONG ReleaseDC IN User32 LONG, LONG
DECLARE LONG CreatePen IN Gdi32 LONG, LONG, LONG
DECLARE LONG SelectObject IN Gdi32 LONG, LONG
DECLARE LONG MoveToEx IN Gdi32 LONG, LONG, LONG, LONG
DECLARE LONG LineTo IN Gdi32 LONG, LONG, LONG
DECLARE LONG DeleteObject IN Gdi32 LONG
#DEFINE PS_SOLID 0 && 实线
CLEAR
hDC = GetDC(_SCREEN.hWnd)
hPen = CreatePen(PS_SOLID, 1, 0x0000FF) && 创建新画笔。样式, 线宽,颜色
hPenOld = SelectObject(hdc, hPen) && 设置新画笔
_DrawLine(hDC, 10, 5, 100, 50)
SelectObject(hdc, hPenOld) && 恢复旧画笔
DeleteObject(hPen) && 清除画笔
ReleaseDC(_SCREEN.hWnd, hDC)
CLEAR DLLS
FUNCTION _DrawLine(hDC, x1, y1, x2, y2)
MoveToEx(hDC, x1, y1, 0) && 线起点(x, y)
LineTo(hDC, x2, y2) && 线终点(x, y)
ENDFUNC