怎樣用SHARP用出七段顯示器
然後當我輸入一到九
那個SHARP也就是七段顯示器
他就會跟者跳阿??
2006-04-23 14:31:05 · 2 個解答 · 發問者 鍾小淵 1 in 電腦與網際網路 ➔ 硬體 ➔ 其他:硬體
Dim A, SH(6) As Shape, WithEvents Text1 As TextBoxPrivate Sub Text1_Change()Dim I%If Text1 <> "" Then For I = 0 To 6 SH(I).Visible = Not CBool(InStr(A(Text1), CStr(I))) NextEnd IfEnd SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)'限制只能輸入0~9If InStr("0123456789" & Chr(8), Chr(KeyAscii)) = 0 Then KeyAscii = 0End SubPrivate Sub Form_Load()Dim I%'A陣列0~9的值表不顯示Shape的索引值A = Array("1", "01256", "45", "56", "026", "36", "3", "1256", "", "6")'以下是動態載入7個Shape及1個TextBox,你可在設計階段自行補上就可將以下程式碼移除For I = 0 To 6 Set SH(I) = Controls.Add("VB.Shape", "SH" & I) With SH(I) If I < 3 Then .Width = 360: .Height = 60 .Left = 180: .Top = I * 420 Else .Width = 60: .Height = 360 End If .FillStyle = 0: .FillColor = vbGreen End WithNextSH(3).Top = 60: SH(3).Left = 540SH(4).Top = 480: SH(4).Left = 540SH(5).Top = 60: SH(5).Left = 120SH(6).Top = 480: SH(6).Left = 120Set Text1 = Controls.Add("VB.TextBox", "Text1")With Text1 .Top = 1200: .Height = 300: .Text = 0: .MaxLength = 1: .Visible = TrueEnd WithEnd Sub
2006-04-24 13:31:10 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
拍手~~~
高手中的高手阿
2011-11-30 14:32:22 · answer #2 · answered by Gemini 翔 2 · 0⤊ 0⤋