标题:VB新人,请求帮忙如何带进参数
只看楼主
肖霞斌
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-5-17
结帖率:0
已结贴  问题点数:20 回复次数:2 
VB新人,请求帮忙如何带进参数
Private Sub Form_Load()
Dim m%
For m = 0 To k4 / 2 - k2 Step 2 * r1 * (3 ^ 0.5)
    Y = m
Dim n%
For n = 0 To k3 Step 2 * r1
   X = n
Circle (X + 50 + r1, -Y + 100 - k2 - r1), r1
Circle (X + 50 + 2 * r1, -Y + 100 - k2 - r1 - r1 * (3 ^ 0.5)), r1
Circle (X + 50 + r1, -Y + 100 + k2 + r1), r1
Circle (X + 50 + 2 * r1, -Y + 100 + k2 + r1 + r1 * (3 ^ 0.5)), r1
Next n
Next m

Line (50, 100)-Step(50, 100 - k1 / 2)
Line -Step(45, 100 - k1 / 2)
Line -Step(45, 100 + k1 / 2)
Line -Step(50, 100 + k1 / 2)
Line -Step(50, 100)
Line (50, 100 - k2)-Step(50 + k3, 100 - k2)
Line (50, 100 + k2)-Step(50 + k3, 100 + k2)
Line (50 + k3, 100)-Step(50 + k3, 100 - k1 / 2)
Line -Step(55 + k3, 100 - k1 / 2)
Line -Step(55 + k3, 100 + k1 / 2)
Line -Step(50 + k3, 100 + k1 / 2)
Line -Step(50 + k3, 100)

End Sub



程序中k1,为骨架外经   k2为骨架半径    k3为骨架绕宽   k4为骨架绕径     r1为圆半径
搜索更多相关主题的帖子: VB 请求 参数 Next Line 
2018-05-17 19:38
wds1
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:49
帖 子:393
专家分:2025
注 册:2016-3-10
得分:10 
Private Sub Command1_Click()
  Call sum(100, 20, 30, 40, 5)
End Sub

Public Sub sum(k1, k2, k3, k4, r1)
  Dim m%
  For m = 0 To k4 / 2 - k2 Step 2 * r1 * (3 ^ 0.5)
    Y = m
  Dim n%
  For n = 0 To k3 Step 2 * r1
   X = n
  Circle (X + 50 + r1, -Y + 100 - k2 - r1), r1
  Circle (X + 50 + 2 * r1, -Y + 100 - k2 - r1 - r1 * (3 ^ 0.5)), r1
  Circle (X + 50 + r1, -Y + 100 + k2 + r1), r1
  Circle (X + 50 + 2 * r1, -Y + 100 + k2 + r1 + r1 * (3 ^ 0.5)), r1
  Next n
  Next m

  Line (50, 100)-Step(50, 100 - k1 / 2)
  Line -Step(45, 100 - k1 / 2)
  Line -Step(45, 100 + k1 / 2)
  Line -Step(50, 100 + k1 / 2)
  Line -Step(50, 100)
  Line (50, 100 - k2)-Step(50 + k3, 100 - k2)
  Line (50, 100 + k2)-Step(50 + k3, 100 + k2)
  Line (50 + k3, 100)-Step(50 + k3, 100 - k1 / 2)
  Line -Step(55 + k3, 100 - k1 / 2)
  Line -Step(55 + k3, 100 + k1 / 2)
  Line -Step(50 + k3, 100 + k1 / 2)
  Line -Step(50 + k3, 100)

End Sub
2018-05-18 13:09
ZHRXJR
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:125
帖 子:1034
专家分:5519
注 册:2016-5-10
得分:10 
程序代码:
'程序中k1,为骨架外经   k2为骨架半径    k3为骨架绕宽   k4为骨架绕径     r1为圆半径
Dim k1 As Single, k2 As Single, k3 As Single, k4 As Single, r1 As Single

Private Sub Command1_Click()
k2 = Val(Text4.Text): k3 = Val(Text3.Text): k4 = Val(Text2.Text): r1 = Val(Text1.Text): k1 = 2 * k2   '在这里引入数据
'根据你的图片文本框,设置的4个文本框,估计你需要的是这个吧
'下面就是绘制图形的代码了,不知对不对,没有测试
Dim m%
For m = 0 To k4 / 2 - k2 Step 2 * r1 * (3 ^ 0.5)
    Y = m
Dim n%
For n = 0 To k3 Step 2 * r1
   X = n
Circle (X + 50 + r1, -Y + 100 - k2 - r1), r1
Circle (X + 50 + 2 * r1, -Y + 100 - k2 - r1 - r1 * (3 ^ 0.5)), r1
Circle (X + 50 + r1, -Y + 100 + k2 + r1), r1
Circle (X + 50 + 2 * r1, -Y + 100 + k2 + r1 + r1 * (3 ^ 0.5)), r1
Next n
Next m

Line (50, 100)-Step(50, 100 - k1 / 2)
Line -Step(45, 100 - k1 / 2)
Line -Step(45, 100 + k1 / 2)
Line -Step(50, 100 + k1 / 2)
Line -Step(50, 100)
Line (50, 100 - k2)-Step(50 + k3, 100 - k2)
Line (50, 100 + k2)-Step(50 + k3, 100 + k2)
Line (50 + k3, 100)-Step(50 + k3, 100 - k1 / 2)
Line -Step(55 + k3, 100 - k1 / 2)
Line -Step(55 + k3, 100 + k1 / 2)
Line -Step(50 + k3, 100 + k1 / 2)
Line -Step(50 + k3, 100)
End Sub

Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub

请不要选我!!!
2018-05-20 09:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-487026-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.088617 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved