Button werden nicht Angezeigt?

  • VB.NET

Es gibt 4 Antworten in diesem Thema. Der letzte Beitrag () ist von RedfieId.

    Button werden nicht Angezeigt?

    Hallo ich bin ziemlich neu im forum könnte also sein das dass Thema hier falsch ist

    ich habe ein kleines problemchen und finde die Ursache nicht

    und zwar habe ich Button deklariert jedoch werden die mir nicht angezeigt obwohl die (show) Funktion aktiviert ist kann mir wer helfen?
    es handelt sich um die Button

    j1960
    j1970
    j1980
    j1990
    j2000




    Hier mein code

    VB.NET-Quellcode

    1. Imports System.IO
    2. Public Class CFA
    3. Dim x, y As Integer
    4. <System.Runtime.InteropServices.DllImport("user32.dll")> _
    5. Private Shared Function GetAsyncKeyState(ByVal vkey As System.Windows.Forms.Keys) As Short
    6. End Function
    7. Private Sub hkt_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hkt.Tick
    8. Dim HotKey As Boolean
    9. HotKey = GetAsyncKeyState(Keys.S)
    10. If HotKey = True Then
    11. tbs.PerformClick()
    12. End If
    13. End Sub
    14. Private Sub Ton(ByVal MeinText As String)
    15. Dim objvoice As System.Object
    16. objvoice = CreateObject("SAPI.spvoice")
    17. objvoice.speak(MeinText)
    18. End Sub
    19. 'Load
    20. Private Sub CFA_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    21. ' Ton("C F A ... v1 Punkt 0")
    22. My.Computer.Audio.Play("F:\cfa\sounds\cfa.wav", AudioPlayMode.BackgroundLoop)
    23. j1960.Hide()
    24. j1970.Hide()
    25. j1980.Hide()
    26. j1990.Hide()
    27. j2000.Hide()
    28. j2010.Hide()
    29. x = Me.Width
    30. y = Me.Height
    31. Button_resize(sender, e)
    32. Dim desktopSize As Size
    33. desktopSize = System.Windows.Forms.SystemInformation.PrimaryMonitorSize
    34. Dim height As Integer = desktopSize.Height
    35. Dim width As Integer = desktopSize.Width
    36. test.Hide()
    37. End Sub
    38. ' Zusammenstellung
    39. Private Sub Button_resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
    40. Dim x1, y1 As Integer
    41. x1 = Me.Width
    42. y1 = Me.Height
    43. If x > 0 Then
    44. '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    45. Dim LBX, TBX, TBSX, TBSW, TBSH, LBY, TBY, TBSY, KBX25, KBX26, KBX27, KBX28, KBX29, KBX30, KBY1, KBY2, KBY3, CTW, MTX, PNGBW, CTH, CTY, PNGBX, PNGBY, AW As Integer
    46. Dim KBH, KBW, KBX1, KBX2, KBX3, KBX4, KBX5, KBX6, KBX7, KBX8, KBX9, KBX10, KBX11, KBX12, FSKY0, FSKY1, FSKX1, FSKX0, FSKH, FSKW, SBY1, PYX, PYY, PYH, PYW As Integer
    47. Dim KBX13, KBX14, KBX15, KBX16, KBX17, KBX18, KBX19, KBX20, KBX21, KBX22, KBX23, KBX24, WBX, WBX2, WB3X, WBY, InfoY, WBY2, WBW2, WBH2, FSKX4, CTX, PNGBH As Integer
    48. Dim HXBB, HX0, HX1, HX2, HX3, HX4, HYBB, HY0, HY1, PNG4X, PNG4Y, PNG4W, PNG4H, KX, KY, KW, KH, MX, MY, MW, MH, MTY, MTH, MTW, MINY, MINX, AX, AY, AH As Integer
    49. Dim GRX0, GRX1, GRX2, GRXBB, GRKBX1, SBW, TBW, GRY0, GRY1, GRY2, GRY3, GRYBB, GRKBY1, SBH, TBH, J1960Y, J1970Y, J1980Y, J1990Y, J2000Y, J2010Y, J1960X As Integer
    50. Dim J1960H, J1970H, J1980H, J1990H, J2000H, J2010H, J1960W, J1970W, J1980W, J1990W, J2000W, J2010W, J1970X, J1980X, J1990X, J2000X, J2010X, MINH, MINW As Integer
    51. Dim SBX1, SBX2, SBX3, SBX4, SBX5, SBX6, SBX7, SBX8, SBX9, SBX10, SBX11, SBX12, WBH, WBW, BF2H, BF2W, BF2X, BF2Y, B7H, B7W, B8X, B8Y, B8H, B8W, B9X As Integer
    52. Dim B1X, B1Y, B1H, B1W, B2X, B2Y, B2H, B2W, B3X, B3Y, B3H, B3W, B4X, B4Y, B4H, B4W, B5X, B5Y, B5H, B5W, B7X, B7Y, B9Y, B9H, B9W, InfoX, InfoW, InfoH As Integer
    53. '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    54. j1960.Width = J1960W
    55. j1960.Height = J1960H
    56. j1960.Top = J1960Y
    57. j1960.Left = J1960X
    58. J1960W = 230 * x1 / x
    59. J1960H = 67 * y1 / y
    60. J1960X = 134 * x1 / x
    61. J1960Y = 236 * y1 / y
    62. j1970.Width = J1970W
    63. j1970.Height = J1970H
    64. j1970.Top = J1970Y
    65. j1970.Left = J1970X
    66. J1970W = 230 * x1 / x
    67. J1970H = 67 * y1 / y
    68. J1970X = 134 * x1 / x
    69. J1970Y = 314 * y1 / y
    70. j1980.Width = J1980W
    71. j1980.Height = J1980H
    72. j1980.Top = J1980Y
    73. j1980.Left = J1980X
    74. J1980W = 230 * x1 / x
    75. J1980H = 67 * y1 / y
    76. J1980X = 134 * x1 / x
    77. J1980Y = 387 * y1 / y
    78. j1990.Width = J1990W
    79. j1990.Height = J1990H
    80. j1990.Top = J1990Y
    81. j1990.Left = J1990X
    82. J1990W = 230 * x1 / x
    83. J1990H = 67 * y1 / y
    84. J1990X = 134 * x1 / x
    85. J1990Y = 460 * y1 / y
    86. j2000.Width = J2000W
    87. j2000.Height = J2000H
    88. j2000.Top = J2000Y
    89. j2000.Left = J2000X
    90. J2000W = 230 * x1 / x
    91. J2000H = 67 * y1 / y
    92. J2000X = 134 * x1 / x
    93. J2000Y = 533 * y1 / y
    94. j2010.Width = J2010W
    95. j2010.Height = J2010H
    96. j2010.Top = J2010Y
    97. j2010.Left = J2010X
    98. J2010W = 230 * x1 / x
    99. J2010H = 67 * y1 / y
    100. J2010X = 134 * x1 / x
    101. J2010Y = 606 * y1 / y
    102. End If
    103. End Sub
    104. ' Jahre
    105. Private Sub B7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B7.Click
    106. ' wb.Navigate("F:\cfa\vkf\Filme")
    107. Ton("Jahr gang")
    108. j1960.Show()
    109. j1970.Show()
    110. j1980.Show()
    111. j1990.Show()
    112. j2000.Show()
    113. j2010.Show()
    114. png4.Hide()
    115. drea.Hide()
    116. koch.Hide()
    117. sel.Hide()
    118. png1.Hide()
    119. png2.Hide()
    120. png3.Show()
    121. B4.Show()
    122. B1.Show()
    123. B7.Hide()
    124. B2.Show()
    125. B3.Show()
    126. B5.Show()
    127. B8.Show()
    128. B9.Show()
    129. bbs.Hide()
    130. bbk.Hide()
    131. bbsa.Hide()
    132. bbf.Hide()
    133. wb.Hide()
    134. fsk18.Hide()
    135. fsk16.Hide()
    136. fsk6.Hide()
    137. fsk0.Hide()
    138. fsk12.Hide()
    139. wb2.Hide()
    140. hb4.Hide()
    141. hb2.Hide()
    142. hb1.Hide()
    143. hb3.Hide()
    144. h.Hide()
    145. n.Hide()
    146. sb1.Hide()
    147. sb2.Hide()
    148. sb3.Hide()
    149. sb4.Hide()
    150. sb5.Hide()
    151. sb6.Hide()
    152. sb7.Hide()
    153. sb8.Hide()
    154. sb9.Hide()
    155. sb10.Hide()
    156. sb11.Hide()
    157. sb12.Hide()
    158. kb1.Hide()
    159. kb2.Hide()
    160. kb3.Hide()
    161. kb4.Hide()
    162. kb5.Hide()
    163. kb6.Hide()
    164. kb7.Hide()
    165. kb8.Hide()
    166. kb9.Hide()
    167. kb10.Hide()
    168. kb11.Hide()
    169. kb12.Hide()
    170. kb13.Hide()
    171. kb14.Hide()
    172. kb15.Hide()
    173. kb16.Hide()
    174. kb17.Hide()
    175. kb18.Hide()
    176. kb19.Hide()
    177. kb20.Hide()
    178. kb21.Hide()
    179. kb22.Hide()
    180. kb23.Hide()
    181. kb24.Hide()
    182. kb25.Hide()
    183. kb26.Hide()
    184. kb27.Hide()
    185. kb28.Hide()
    186. kb29.Hide()
    187. kb30.Hide()
    188. End Sub
    189. End Class

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „RedfieId“ ()

    Du hast das alles sehr unschön gestaltet.
    1. Würde ich stat SAPI, den Speechsynthesizer nehmen
    2. Sind so viele Controls wirklich nötig ?
    3. benutze .Visible = true/false
    4. Nicht alle einzeln sonder mit einer For each schleife bedienen
    Kommt vielleicht eine ListBox mit einem Button in Frage ?
    Ich denke da an eine Schleife in der Art:

    VB.NET-Quellcode

    1. For Each Btn As Button In Me.Controls.OfType(Of Button)()
    2. 'irgendwas
    3. Next
    4. For Each ctrl As Control In Me.Controls
    5. Select Case True
    6. Case TypeOf ctrl Is TextBox
    7. 'irgendwas
    8. Case TypeOf ctrl Is Button
    9. 'irgendwas
    10. End Select
    11. Next