请VB高手帮我看段程序

来源:百度知道 编辑:UC知道 时间:2024/06/27 07:32:28
我编了个小函数,就是给picture的加上坐标值,如下:

Public Function biaoqian(picture As PictureBox, a As Label, ashu As Single, b As Label, bshu As Single, lorR As Single, xx As Single, xy As Single, yx As Single, yy As Single)
For i = 0 To ashu - 1
a(i).Visible = True
a(i).Caption = Int(xx + i * (xy - xx) / (ashu))
a(i).AutoSize = True
a(i).BackStyle = 0
a(i).Left = picture.Left - 100 + i * picture.Width / (ashu)
a(i).Top = picture.Top + picture.Height + 100
Next i

If lorR = 1 Then
For i = 0 To bshu - 1
b(i).Visible = True
Dim k As Single
k = yx + i * (yy - yx) / bshu
b(i).Caption = Format(k, "0.0")
b(i).AutoSize = True
b(i).BackStyle = 0
b(i).Left = picture.Left - 100
b(i).Top = picture.Top + picture.Height - 100 - picture.Hei

将类型改为变体(Variant)或对象(Object)类型:

将源文件的:
Public Function biaoqian(picture As PictureBox, a As Label, ashu As Single, b As Label, bshu As Single, lorR As Single, xx As Single, xy As Single, yx As Single, yy As Single)

改为:
Public Function biaoqian(picture As Object, a As Object, ashu As Single, b As Object, bshu As Single, lorR As Single, xx As Single, xy As Single, yx As Single, yy As Single)