VB怎样在picturebox中画一个坐标系?

 我来答
fandyfandy0
2011-06-14 · TA获得超过1712个赞
知道小有建树答主
回答量:648
采纳率:100%
帮助的人:549万
展开全部
Option Explicit

Private Sub Command1_Click()
Picture1.BackColor = vbGreen
Picture1.Cls

Picture1.ScaleMode = 3 '像素
Picture1.Scale (-20, 120)-(110, -20) '定义左上角座标为(-20,120),右下角座标为110,-20)

'设置绘线宽度
Picture1.DrawWidth = 1

' 绘坐标横线
Picture1.Line (0, 0)-(110, 0), vbBlack
Picture1.Line (0, 10)-(100, 10), vbBlack
Picture1.Line (0, 20)-(100, 20), vbBlack
Picture1.Line (0, 30)-(100, 30), vbBlack
Picture1.Line (0, 40)-(100, 40), vbBlack
Picture1.Line (0, 50)-(100, 50), vbBlack
Picture1.Line (0, 60)-(100, 60), vbBlack
Picture1.Line (0, 70)-(100, 70), vbBlack
Picture1.Line (0, 80)-(100, 80), vbBlack
Picture1.Line (0, 90)-(100, 90), vbBlack
Picture1.Line (0, 100)-(100, 100), vbBlack

' 绘坐标纵线
Picture1.Line (0, 0)-(0, 120), vbBlack
Picture1.Line (10, 0)-(10, 100), vbBlack
Picture1.Line (20, 0)-(20, 100), vbBlack
Picture1.Line (30, 0)-(30, 100), vbBlack
Picture1.Line (40, 0)-(40, 100), vbBlack
Picture1.Line (50, 0)-(50, 100), vbBlack
Picture1.Line (60, 0)-(60, 100), vbBlack
Picture1.Line (70, 0)-(70, 100), vbBlack
Picture1.Line (80, 0)-(80, 100), vbBlack
Picture1.Line (90, 0)-(90, 100), vbBlack
Picture1.Line (100, 0)-(100, 100), vbBlack
Picture1.Line (110, 0)-(110, 100), vbBlack

'指定位置显示原点O
Picture1.CurrentX = -5
Picture1.CurrentY = 0
Picture1.Print "O"

' 指定位置显示1O
Picture1.CurrentX = -10
Picture1.CurrentY = 10
Picture1.Print "1O"

' 指定位置显示2O
Picture1.CurrentX = -10
Picture1.CurrentY = 20
Picture1.Print "2O"

' 指定位置显示3O
Picture1.CurrentX = -10
Picture1.CurrentY = 30
Picture1.Print "3O"

' 指定位置显示4O
Picture1.CurrentX = -10
Picture1.CurrentY = 40
Picture1.Print "4O"

' 指定位置显示5O
Picture1.CurrentX = -10
Picture1.CurrentY = 50
Picture1.Print "5O"

' 指定位置显示6O
Picture1.CurrentX = -10
Picture1.CurrentY = 60
Picture1.Print "6O"

' 指定位置显示7O
Picture1.CurrentX = -10
Picture1.CurrentY = 70
Picture1.Print "7O"

' 指定位置显示8O
Picture1.CurrentX = -10
Picture1.CurrentY = 80
Picture1.Print "8O"

' 指定位置显示9O
Picture1.CurrentX = -10
Picture1.CurrentY = 90
Picture1.Print "9O"

' 指定位置显示10O
Picture1.CurrentX = -10
Picture1.CurrentY = 100
Picture1.Print "10O"

' 指定位置显示1O
Picture1.CurrentX = 0
Picture1.CurrentY = 110
Picture1.Print "效率"

'指定位置显示原点O.2
Picture1.CurrentX = 10
Picture1.CurrentY = 0
Picture1.Print ".2"

' 指定位置显示.4
Picture1.CurrentX = 20
Picture1.CurrentY = 0
Picture1.Print ".4"

' 指定位置显示.6
Picture1.CurrentX = 30
Picture1.CurrentY = 0
Picture1.Print ".6"

' 指定位置显示.8
Picture1.CurrentX = 40
Picture1.CurrentY = 0
Picture1.Print ".8"

' 指定位置显示1
Picture1.CurrentX = 50
Picture1.CurrentY = 0
Picture1.Print "1"

' 指定位置显示1.2
Picture1.CurrentX = 60
Picture1.CurrentY = 0
Picture1.Print "1.2"

' 指定位置显示1.4
Picture1.CurrentX = 70
Picture1.CurrentY = 0
Picture1.Print "1.4"

' 指定位置显示1.6
Picture1.CurrentX = 80
Picture1.CurrentY = 0
Picture1.Print "1.6"

' 指定位置显示1.8
Picture1.CurrentX = 90
Picture1.CurrentY = 0
Picture1.Print "1.8"

' 指定位置显示2
Picture1.CurrentX = 100
Picture1.CurrentY = 0
Picture1.Print "2"

End Sub
追问
做个朋友好么?+623064575 我很佩服你。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式