当前位置:编程学习 > VB >>

如何用vb画坐标系?

如何用vb画坐标系?如图所示

追问:能不能具体点

答案:
坐标原点默认是左上角,可以改变的,FORM1.SCALE (X1,Y1)-(X2,Y2)横坐标范围是从X1到X2,纵坐标是从Y1到Y2,若坐标设在窗体中间,则FORM1.SCALE (-ME.WIDTH/2,-ME.HEIGTH/2)-(ME.WIDTH/2,ME.HEIGTH/2),画横坐标ME.LINE (-ME.WIDTH/2,0)-(ME.WIDTH/2,0)
画纵坐标FORM1.LINE (0,-ME.HEIGTH/2,0,ME.HEIGTH/2)

Private Sub Form_Load()
Me.FontSize = 8
Me.AutoRedraw = True
Me.Width = 8500
Me.Height = 6000
Me.Scale (-1, 12)-(12, -1)
Line (0, 0)-(0, 10)
Line (0.1, 9.7)-(0, 10)
Line (-0.1, 9.7)-(0, 10)
For i = 1 To 9
   Line (-0.2, i)-(0, i)
   CurrentY = CurrentY + 0.6
   Print i * 10
Next i
Me.ForeColor = vbBlue
Line (8, 0)-(8, 10)
Line (8.1, 9.7)-(8, 10)
Line (7.9, 9.7)-(8, 10)
For i = 1 To 9
  
   Line (8.2, i)-(8, i)
   CurrentY = CurrentY + 0.6
   CurrentX = CurrentX - 0.8
   Print i * 10
Next i
Me.ForeColor = vbRed
Line (9, 0)-(9, 10)
Line (9.1, 9.7)-(9, 10)
Line (8.9, 9.7)-(9, 10)
For i = 1 To 9
   Line (9.2, i)-(9, i)
   CurrentY = CurrentY + 0.6
   CurrentX = CurrentX - 0.5
   Print i
Next i
Me.ForeColor = vbGreen
Line (10, 0)-(10, 10)
Line (10.1, 9.7)-(10, 10)
Line (9.9, 9.7)-(10, 10)
For i = 2 To 10 Step 2
   Line (10.2, i * 0.85)-(10, i * 0.85)
   CurrentY = CurrentY + 0.6
   CurrentX = CurrentX - 0.6
   Print i
Next i
Me.ForeColor = vbBlack

Line (0, 0)-(8, 0)
Line (7.7, -0.1)-(8, 0)
Line (7.7, 0.1)-(8, 0)
For i = 1 To 7
   Line (i, -0.2)-(i, 0)
   CurrentY = CurrentY + 0.5
   Print i
Next i


Me.DrawStyle = 2
For i = 1 To 10
   Line (0, i)-(8, i)
Next i

For i = 1 To 7
   Line (i, 0)-(i, 10)
Next i
CurrentY = CurrentY - 10.2
Print "压差(Mpa)"
End Sub

    Form1 窗体  左上角 O1(0,0)

                        右下角 O2(8400,7005)

    坐标:          左下角 OA(1000,4400)

                        右上角 OB(6600,400)

上一个:VB与ACCESS连接问题
下一个:问一个vb的问题

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,