Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. Public Class 下拉清單_1
  2. Dim 頁數, 總頁數, F1, F2, F3, F4, F5, F6, F7, F8 As Integer
  3. Dim 有選擇, 自動查 As Boolean
  4. Dim EER As String
  5. Private Sub PnlTitleBar_Paint(sender As Object, e As PaintEventArgs) Handles PnlTitleBar.Paint
  6. End Sub
  7. Private Sub 下拉清單_1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  8. '--目前設定PPBB最長3000格------
  9. End Sub
  10. Private Sub 下拉清單_1_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  11. If 有選擇 = False Then : PPAA = "" : End If
  12. End Sub
  13. Private Sub 下拉清單_1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  14. 風格()
  15. If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If
  16. If 系統語言 = "繁體中文" Then : 主題_lb.Text = "選擇清單" : EER = "選取的位置沒有資料!!"
  17. ElseIf 系統語言 = "English" Then : 主題_lb.Text = "Pick List" : EER = "No data available at selected location!!"
  18. ElseIf 系統語言 = "Indonesian" Then : 主題_lb.Text = "Daftar Pilih" : EER = "Tidak ada data yang tersedia di lokasi yang dipilih!!" : End If
  19. 有選擇 = False
  20. 總頁數 = NN1 / 99 + 1 : 頁數 = 1 : F1 = 0 : F2 = 24 : F3 = 25 : F4 = 49 : F5 = 50 : F6 = 74 : F7 = 75 : F8 = 99
  21. If NN1 < 99 Then : 上一頁_bt.Enabled = False : 下一頁_bt.Enabled = False : Else : 上一頁_bt.Enabled = False : 下一頁_bt.Enabled = True : End If
  22. ListBox1.Items.Clear() : ListBox2.Items.Clear() : ListBox3.Items.Clear() : ListBox4.Items.Clear()
  23. If NN1 <= 24 Then
  24. For I As Integer = F1 To NN1 : ListBox1.Items.Add(PPBB(I)) : Next
  25. ElseIf NN1 > 24 And NN1 <= 49 Then
  26. For I As Integer = F1 To F2 : ListBox1.Items.Add(PPBB(I)) : Next : For I As Integer = F3 To NN1 : ListBox2.Items.Add(PPBB(I)) : Next
  27. ElseIf NN1 > 49 And NN1 <= 74 Then
  28. For I As Integer = F1 To F2 : ListBox1.Items.Add(PPBB(I)) : Next : For I As Integer = F3 To F4 : ListBox2.Items.Add(PPBB(I)) : Next
  29. For I As Integer = F5 To NN1 : ListBox3.Items.Add(PPBB(I)) : Next
  30. ElseIf NN1 > 74 Then
  31. For I As Integer = F1 To F2 : ListBox1.Items.Add(PPBB(I)) : Next : For I As Integer = F3 To F4 : ListBox2.Items.Add(PPBB(I)) : Next
  32. For I As Integer = F5 To F6 : ListBox3.Items.Add(PPBB(I)) : Next : For I As Integer = F7 To F8 : ListBox4.Items.Add(PPBB(I)) : Next
  33. End If
  34. End Sub
  35. Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
  36. 查詢()
  37. End Sub
  38. Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
  39. 查詢()
  40. End Sub
  41. Private Sub 查詢()
  42. 自動查 = True : For I As Integer = 1 To 10 : If 上一頁_bt.Enabled = True Then : 上一頁_bt.PerformClick() : Else : Exit For : End If : Next
  43. For I As Integer = 1 To 10 : Dim keyword As String = TextBox1.Text.ToLower()
  44. Dim foundInListBox1 As Boolean = SearchInListBox(ListBox1, keyword) : Dim foundInListBox2 As Boolean = SearchInListBox(ListBox2, keyword)
  45. Dim foundInListBox3 As Boolean = SearchInListBox(ListBox3, keyword) : Dim foundInListBox4 As Boolean = SearchInListBox(ListBox4, keyword)
  46. If Not (foundInListBox1 Or foundInListBox2 Or foundInListBox3 Or foundInListBox4) Then
  47. If 下一頁_bt.Enabled = True Then : 下一頁_bt.PerformClick() : Else
  48. MessageBox.Show(系統語言字典("G000-264-" & 語言), "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information) : Exit For
  49. End If
  50. Else : Exit For : End If
  51. Next : 自動查 = False
  52. End Sub
  53. Private Function SearchInListBox(listBox As ListBox, keyword As String) As Boolean
  54. For i As Integer = 0 To listBox.Items.Count - 1 : If listBox.Items(i).ToString().ToLower().Contains(keyword) Then : listBox.SelectedIndex = i : Return True : End If : Next
  55. listBox.ClearSelected() : Return False
  56. End Function
  57. Private Sub 上一頁_bt_Click(sender As Object, e As EventArgs) Handles 上一頁_bt.Click
  58. 頁數 -= 1 : ListBox1.Items.Clear() : ListBox2.Items.Clear() : ListBox3.Items.Clear() : ListBox4.Items.Clear()
  59. F1 -= 100 : F2 -= 100 : F3 -= 100 : F4 -= 100 : F5 -= 100 : F6 -= 100 : F7 -= 100 : F8 -= 100
  60. If 頁數 = 1 Then
  61. 上一頁_bt.Enabled = False : 下一頁_bt.Enabled = True
  62. ElseIf 頁數 > 1 Then
  63. 上一頁_bt.Enabled = True : 下一頁_bt.Enabled = True
  64. End If
  65. For I As Integer = F1 To F2 : ListBox1.Items.Add(PPBB(I)) : Next : For I As Integer = F3 To F4 : ListBox2.Items.Add(PPBB(I)) : Next
  66. For I As Integer = F5 To F6 : ListBox3.Items.Add(PPBB(I)) : Next : For I As Integer = F7 To F8 : ListBox4.Items.Add(PPBB(I)) : Next
  67. End Sub
  68. Private Sub 下一頁_bt_Click(sender As Object, e As EventArgs) Handles 下一頁_bt.Click
  69. 頁數 += 1 : ListBox1.Items.Clear() : ListBox2.Items.Clear() : ListBox3.Items.Clear() : ListBox4.Items.Clear()
  70. F1 += 100 : F2 += 100 : F3 += 100 : F4 += 100 : F5 += 100 : F6 += 100 : F7 += 100 : F8 += 100
  71. If 頁數 < 總頁數 Then
  72. 上一頁_bt.Enabled = True : 下一頁_bt.Enabled = True
  73. For I As Integer = F1 To F2 : ListBox1.Items.Add(PPBB(I)) : Next : For I As Integer = F3 To F4 : ListBox2.Items.Add(PPBB(I)) : Next
  74. For I As Integer = F5 To F6 : ListBox3.Items.Add(PPBB(I)) : Next : For I As Integer = F7 To F8 : ListBox4.Items.Add(PPBB(I)) : Next
  75. ElseIf 頁數 = 總頁數 Then
  76. 上一頁_bt.Enabled = True : 下一頁_bt.Enabled = False
  77. If NN1 <= F2 Then
  78. For I As Integer = F1 To NN1 : ListBox1.Items.Add(PPBB(I)) : Next
  79. ElseIf NN1 <= F4 Then
  80. For I As Integer = F1 To F2 : ListBox1.Items.Add(PPBB(I)) : Next : For I As Integer = F3 To NN1 : ListBox2.Items.Add(PPBB(I)) : Next
  81. ElseIf NN1 <= F6 Then
  82. For I As Integer = F1 To F2 : ListBox1.Items.Add(PPBB(I)) : Next : For I As Integer = F3 To F4 : ListBox2.Items.Add(PPBB(I)) : Next
  83. For I As Integer = F5 To NN1 : ListBox3.Items.Add(PPBB(I)) : Next
  84. ElseIf NN1 <= F8 Then
  85. For I As Integer = F1 To F2 : ListBox1.Items.Add(PPBB(I)) : Next : For I As Integer = F3 To F4 : ListBox2.Items.Add(PPBB(I)) : Next
  86. For I As Integer = F5 To F6 : ListBox3.Items.Add(PPBB(I)) : Next : For I As Integer = F7 To NN1 : ListBox4.Items.Add(PPBB(I)) : Next
  87. End If
  88. End If
  89. End Sub
  90. Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
  91. If IsNothing(ListBox1.SelectedItem) = True Then : 有選擇 = False ': 通知訊息 = EER : 訊息類型 = "1" : 通知視窗.ShowDialog()
  92. Else : PPAA = ListBox1.SelectedItem.ToString() : 有選擇 = True : If 自動查 <> True Then : Me.Close() : End If : End If
  93. End Sub
  94. Private Sub ListBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox2.SelectedIndexChanged
  95. If IsNothing(ListBox2.SelectedItem) = True Then : 有選擇 = False ': 通知訊息 = EER : 訊息類型 = "1" : 通知視窗.ShowDialog()
  96. Else : PPAA = ListBox2.SelectedItem.ToString() : 有選擇 = True : If 自動查 <> True Then : Me.Close() : End If : End If
  97. End Sub
  98. Private Sub ListBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox3.SelectedIndexChanged
  99. If IsNothing(ListBox3.SelectedItem) = True Then : 有選擇 = False ': 通知訊息 = EER : 訊息類型 = "1" : 通知視窗.ShowDialog()
  100. Else : PPAA = ListBox3.SelectedItem.ToString() : 有選擇 = True : If 自動查 <> True Then : Me.Close() : End If : End If
  101. End Sub
  102. Private Sub ListBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox4.SelectedIndexChanged
  103. If IsNothing(ListBox4.SelectedItem) = True Then : 有選擇 = False ': 通知訊息 = EER : 訊息類型 = "1" : 通知視窗.ShowDialog()
  104. Else : PPAA = ListBox4.SelectedItem.ToString() : 有選擇 = True : If 自動查 <> True Then : Me.Close() : End If : End If
  105. End Sub
  106. Private Sub Cancel_bt_Click(sender As Object, e As EventArgs) Handles Cancel_bt.Click
  107. Me.Close()
  108. End Sub
  109. Private Sub 風格()
  110. If 深色風格 = False Then
  111. Me.BackColor = Color.Linen : Panel1.BackgroundImage = My.Resources._62951168976601486 : 主題_lb.ForeColor = Color.Black
  112. ListBox1.BackColor = Color.White : ListBox1.ForeColor = Color.Black : ListBox2.BackColor = Color.White : ListBox2.ForeColor = Color.Black
  113. ListBox3.BackColor = Color.White : ListBox3.ForeColor = Color.Black : ListBox4.BackColor = Color.White : ListBox4.ForeColor = Color.Black
  114. Else
  115. Me.BackColor = Color.Black : Panel1.BackgroundImage = My.Resources._20157059_MotionElements_diagonal_lines : 主題_lb.ForeColor = Color.White
  116. ListBox1.BackColor = Color.DimGray : ListBox1.ForeColor = Color.White : ListBox2.BackColor = Color.DimGray : ListBox2.ForeColor = Color.White
  117. ListBox3.BackColor = Color.DimGray : ListBox3.ForeColor = Color.White : ListBox4.BackColor = Color.DimGray : ListBox4.ForeColor = Color.White
  118. End If
  119. End Sub
  120. Dim nOldWndLeft, nOldWndTop, nClickX, nClickY As Integer
  121. Private Sub PnlTitleBar_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PnlTitleBar.MouseDown
  122. '紀錄滑鼠點選時的視窗位置與滑鼠點選位置
  123. nOldWndLeft = Me.Left : nOldWndTop = Me.Top : nClickX = e.X : nClickY = e.Y
  124. End Sub
  125. Private Sub PnlTitleBar_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PnlTitleBar.MouseMove
  126. If PnlTitleBar.Capture = True Then '如果滑鼠按著拖曳
  127. Me.Top = e.Y + nOldWndTop - nClickY : Me.Left = e.X + nOldWndLeft - nClickX '設定新的視窗位置
  128. nOldWndLeft = Me.Left : nOldWndTop = Me.Top '更新紀錄的視窗位置
  129. End If
  130. End Sub
  131. Private Sub 主題_lb_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 主題_lb.MouseDown
  132. '紀錄滑鼠點選時的視窗位置與滑鼠點選位置
  133. nOldWndLeft = Me.Left : nOldWndTop = Me.Top : nClickX = e.X : nClickY = e.Y
  134. End Sub
  135. Private Sub 主題_lb_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 主題_lb.MouseMove
  136. If 主題_lb.Capture = True Then '如果滑鼠按著拖曳
  137. Me.Top = e.Y + nOldWndTop - nClickY : Me.Left = e.X + nOldWndLeft - nClickX '設定新的視窗位置
  138. nOldWndLeft = Me.Left : nOldWndTop = Me.Top '更新紀錄的視窗位置
  139. End If
  140. End Sub
  141. End Class