VB性能记录

前端之家收集整理的这篇文章主要介绍了VB性能记录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

此贴专门用来记录,我在VB中写的测试程序,与测试代码

  1. VERSION 5.00
  2. Begin VB.Form Form1
  3. Caption = "Form1"
  4. ClientHeight = 6945
  5. ClientLeft = 60
  6. ClientTop = 345
  7. ClientWidth = 9045
  8. LinkTopic = "Form1"
  9. ScaleHeight = 6945
  10. ScaleWidth = 9045
  11. StartUpPosition = 3 '窗口缺省
  12. Begin VB.Timer Timer1
  13. Interval = 100
  14. Left = 3960
  15. Top = 3240
  16. End
  17. Begin VB.CommandButton Command1
  18. Caption = "Command1"
  19. Height = 495
  20. Left = 1080
  21. TabIndex = 0
  22. Top = 3360
  23. Width = 1215
  24. End
  25. Begin VB.Shape Shape2
  26. Height = 735
  27. Index = 0
  28. Left = 8160
  29. Top = 720
  30. Width = 735
  31. End
  32. Begin VB.Shape Shape1
  33. Height = 735
  34. Left = 480
  35. Top = 720
  36. Width = 735
  37. End
  38. Begin VB.Line Line1
  39. X1 = 240
  40. X2 = 8880
  41. Y1 = 1080
  42. Y2 = 1080
  43. End
  44. End
  45. Attribute VB_Name = "Form1"
  46. Attribute VB_GlobalNameSpace = False
  47. Attribute VB_Creatable = False
  48. Attribute VB_PredeclaredId = True
  49. Attribute VB_Exposed = False
  50. Dim strTmp1 As String
  51. Dim lngTime As Long
  52. Dim strArray1() As String
  53. Dim i1 As Integer,ii2 As Integer
  54. Private Sub Form_Load()
  55. '
  56. strTmp1 = "a,a,b,b"
  57. i1 = 0
  58. strArray1 = Split(strTmp1,",")
  59. Call createShape
  60. Debug.Print UBound(strArray1)
  61. Debug.Print Me.Shape2.UBound
  62. lngTime = 0
  63. End Sub
  64.  
  65. Private Sub Timer1_Timer()
  66. '
  67. Dim l1 As Long
  68. ' Call test1
  69. ' Call shape_move1
  70. ' If i1 >= ii2 Then i1 = 1
  71. ' i1 = i1 + 1
  72. Debug.Print i1
  73. Call shape_move2(Me.Shape2(i1))
  74. End Sub
  75.  
  76. Sub test1()
  77. '
  78. If i1 > 4 Then i1 = 0
  79. i1 = i1 + 1
  80. Me.Shape1.Shape = i1
  81. Print i1
  82. End Sub
  83.  
  84. Private Sub shape_move1()
  85. '
  86. Me.Shape2(0).Left = Me.Shape2(0).Left - 100
  87. End Sub
  88.  
  89. Private Sub shape_move2(shpTmp1 As Shape)
  90. '
  91. shpTmp1.Left = shpTmp1.Left - 100
  92. End Sub
  93.  
  94. Private Sub createShape()
  95. '
  96. Dim i1 As Integer,i2 As Integer
  97. Debug.Print UBound(strArray1)
  98. i2 = 0
  99. For i1 = 0 To UBound(strArray1)
  100. Debug.Print strArray1(i1)
  101. If strArray1(i1) = "a" Then
  102. i2 = Me.Shape2.UBound + 1
  103. Load Shape2(i2)
  104. ' Shape2(i2).Left = 0
  105. ' Shape2(i2).Top = 0
  106. Shape2(i2).Shape = 2
  107. Shape2(i2).Visible = True
  108. End If
  109. If strArray1(i1) = "b" Then
  110. i2 = Me.Shape2.UBound + 1
  111. Load Shape2(i2)
  112. ' Shape2(i2).Left = 0
  113. ' Shape2(i2).Top = 0
  114. Shape2(i2).Shape = 4
  115. Shape2(i2).Visible = True
  116. End If
  117. Next i1
  118. ii2 = Me.Shape2.UBound
  119. Debug.Print ii2
  120. End Sub

猜你在找的VB相关文章