这个程序怎么修改成在图片框中画坐标轴啊?

来源:百度知道 编辑:UC知道 时间:2024/05/02 09:49:01
Private Sub Form_paint()
Dim i, j As Integer
Me.CurrentX = 10
Me.CurrentY = 10
Print 0
Me.ScaleMode = 3
Me.Line (10, 10)-(10, 600)
Me.Line (10, 10)-(600, 10)
For i = 100 To 500 Step 100
Me.Line (i, 10)-(i, 20)
temp = i
CurrentX = i - TextWidth(temp) / 2
Print i
Next

For i = 100 To 500 Step 100
Me.Line (10, i)-(20, i)
temp = i
CurrentY = i - TextHeight(temp) / 2
Print i
Next
Me.Line (590, 20)-(600, 10) 'x箭头
Me.Line (590, 0)-(600, 10) 'x箭头
Me.Line (0, 590)-(10, 600) 'y箭头
Me.Line (20, 590)-(10, 600) 'y箭头
End Sub

这个是在form里画的,不会移植,谢谢啊

Private Sub Picture1_Click()
Dim i, j As Integer
Picture1.CurrentX = 10
Picture1.CurrentY = 10
Picture1.Print 0
Picture1.ScaleMode = 3
Picture1.Line (10, 10)-(10, 600)
Picture1.Line (10, 10)-(600, 10)
For i = 100 To 500 Step 100
Picture1.Line (i, 10)-(i, 20)
temp = i
Picture1.CurrentX = i - TextWidth(temp) / 2
Picture1.Print i
Next

For i = 100 To 500 Step 100
Picture1.Line (10, i)-(20, i)
temp = i
Picture1.CurrentY = i - TextHeight(temp) / 2
Picture1.Print i
Next
Picture1.Line (590, 20)-(600, 10) 'x箭头
Picture1.Line (590, 0)-(600, 10) 'x箭头
Picture1.Line (0, 590)-(10, 600) 'y箭头
Picture1.Line (20, 590)-(10, 600) 'y箭头

End Sub

'将过程改为 KjPaint(Kj),将过程中所有 Me 替换为 Kj。
'在适当的地方用带参数 Kj 的方式调用,能在窗体、图片框和打印机上绘图

Private Sub Command1_Click()
KjPaint Me '在窗体上绘图
KjPaint Picture1 '在图片框上绘图