VB画线
请问一下,如何利用VB根据记事本中的两列数据来画出线条来。就像根据直角坐标系来画样条曲线一样!
[解决办法]
思路:
1、使用Open语句读取记事本数据
2、将读来的数据存入一个二维数组
3、将这个数组赋值给一个MSChart,实现曲线绘制。
[解决办法]
文件操作+样条曲线函数+画线函数
[解决办法]
Option Explicit
Dim Graphics As Long
Dim pen As Long
Private Sub Form_Load()
Me.AutoRedraw = True
Me.ScaleMode = 3
InitGDIPlus '初始化GDI+
GdipCreateFromHDC Me.hDC, Graphics
GdipCreatePen1 &HFFFF0000, 1, UnitPixel, pen
GdipDrawLineI Graphics, pen, 1, 5, 2, 12
GdipDrawLineI Graphics, pen, 3, 20, 4, 16
GdipDrawLineI Graphics, pen, 5, 4, 6, 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
GdipDeletePen pen '删除这个笔(pen)
GdipDeleteGraphics Graphics '释放graphics占用的内存
TerminateGDIPlus '卸载GDI+
End Sub