请大家帮忙看一看!

sunlightgz 2002-12-26 08:17:33
为什么在窗体加栽时,标尺不出现,而在按下command1时,去能出现标尺?

程序代码如下:
Option Explicit
Public s As Integer

Private Function drawVruler(Hpicture As PictureBox)
'画垂直标尺
Dim Hstep As Double
Dim Hstep1 As Double
Dim i As Integer
Dim j As Integer
'Dim s As Integer
Hstep = Hpicture.ScaleHeight / s
For i% = 1 To s
Hpicture.Line (0.5 * Hpicture.ScaleWidth, Hstep * i%)-(Hpicture.ScaleWidth, Hstep * i%)
Next
Hstep1 = Hpicture.ScaleHeight / (s * 10)
For j% = 1 To (s * 10)
Hpicture.Line (0.8 * Hpicture.ScaleWidth, Hstep1 * j%)-(Hpicture.ScaleWidth, Hstep1 * j%)
Next
End Function

Private Function drawHruler(Vpicture As PictureBox)
'画水平标尺
Dim Vstep As Double
Dim Vstep1 As Double
Dim m As Integer
Dim n As Integer
Vstep = Vpicture.ScaleWidth / s
For m% = 1 To s
Vpicture.Line (Vstep * m%, 0.5 * Vpicture.ScaleHeight)-(Vstep * m%, -Vpicture.ScaleHeight)
Next
Vstep1 = Vpicture.ScaleWidth / (s * 10)
For n% = 1 To (s * 10)
Vpicture.Line (Vstep1 * n%, 0.2 * Vpicture.ScaleHeight)-(Vstep1 * n%, -Vpicture.ScaleHeight)
Next
End Function

Private Sub Command1_Click()
Picture1.Cls
Picture2.Cls
s = 4
Call drawVruler(Picture2)
Call drawHruler(Picture1)
End Sub

Private Sub Form_Load()
s = 6
Call drawVruler(Picture2)
Call drawHruler(Picture1)
End Sub
序代码如下:
...全文
47 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
since1990 2002-12-26
  • 打赏
  • 举报
回复
up

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧