Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

臨時工卡片管理.vb 41KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. Option Explicit On
  2. Imports System.IO
  3. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  4. Imports Microsoft.Office.Interop.Excel.Constants
  5. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  6. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  7. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  8. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  9. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  10. Imports Microsoft.Office.Interop.Excel.XlWindowState
  11. Imports Microsoft.Office.Interop.Excel
  12. Public Class 臨時工卡片管理
  13. Dim 可激活 As Boolean
  14. Dim 行數, 資料數, 換行, X軸, 剩下, 頁數, 開始, 結尾, II2, II3 As Integer
  15. Dim RI As Integer = -1
  16. Dim SK As String = "要查找的 KEY"
  17. Dim Str As String = System.Windows.Forms.Application.StartupPath
  18. DIM 對話框(36) As String
  19. ReadOnly QRCODE As DotNetBarcode = New DotNetBarcode
  20. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  21. Private Sub Set_使用者清單()
  22. Dim ds1, ds2 As New DataSet
  23. 清單1_dgv.DataSource = Nothing : ds1.Clear()
  24. 清單1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  25. 清單1_dgv.ColumnHeadersHeight = 25 : 清單1_dgv.AllowUserToAddRows = False : 清單1_dgv.RowTemplate.Height = 25
  26. If 空白臨時卡_ch.Checked = True Then : SQL5 = " AND (使用者權限管理表.姓名 LIKE '未啟用/Not Enabled') "
  27. Else : SQL5 = " AND (使用者權限管理表.姓名 NOT LIKE '未啟用/Not Enabled') " : End If
  28. SQL_臨時工卡片管理清單()
  29. da.Fill(ds1) : 清單1_dgv.DataSource = ds1.Tables(0) : conn.Close()
  30. 清單1_dgv.Columns(1).FillWeight = 40 : 清單1_dgv.Columns(1).ReadOnly = True : 清單1_dgv.Columns(2).ReadOnly = True : 清單1_dgv.Columns(3).Visible = False
  31. If 空白臨時卡_ch.Checked = True Then
  32. 清單1_dgv.Columns(0).ReadOnly = False
  33. 清單1_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  34. For i As Integer = 0 To 清單1_dgv.Rows.Count - 1 : 清單1_dgv.Rows(i).Cells(表頭(0)).Value = "" : Next
  35. Else : 清單1_dgv.Columns(0).ReadOnly = True : End If : 筆數_tb.Text = 清單1_dgv.Rows.Count
  36. For I As Integer = 0 To 清單1_dgv.Rows.Count - 1
  37. If 清單1_dgv.Rows(I).Cells(0).Value.ToString <> "" Then
  38. 清單1_dgv.Rows(I).Cells(0).Value = 清單1_dgv.Rows(I).Cells(0).Value.ToString.ToUpper
  39. End If
  40. Next
  41. 清單_dgv.DataSource = Nothing : ds2.Clear()
  42. 清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  43. 清單_dgv.ColumnHeadersHeight = 25 : 清單_dgv.AllowUserToAddRows = False : 清單_dgv.RowTemplate.Height = 25
  44. SQL_臨時工卡片管理清單1()
  45. da.Fill(ds2) : 清單_dgv.DataSource = ds2.Tables(0) : conn.Close()
  46. End Sub
  47. Private Sub Set_語言()
  48. 語言_dgv.DataSource = Nothing
  49. 語言_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  50. 語言_dgv.ColumnHeadersHeight = 25 : 語言_dgv.AllowUserToAddRows = False
  51. For i As Integer = 0 To 語言_dgv.Rows.Count - 1 : 語言_dgv.Rows.RemoveAt(0) : Next
  52. If File.Exists(Str + "\LANGUAGE_FILE.csv") Then
  53. Dim filereader = My.Computer.FileSystem.OpenTextFileReader(Str + "\LANGUAGE_FILE.csv", System.Text.Encoding.Default)
  54. Dim line As String = filereader.ReadLine()
  55. While Not (line Is Nothing)
  56. line = filereader.ReadLine()
  57. If line <> Nothing Then
  58. line = line.Replace("""", "")
  59. If Strings.Left(line, 4) = "G000" Or Strings.Left(line, 8) = "H001-271" Or Strings.Left(line, 8) = "H602-102" Or Strings.Left(line, 8) = "H204-134" Or
  60. Strings.Left(line, 8) = "H601-104" Or Strings.Left(line, 4) = 介面 Then
  61. If 系統語言 = "繁體中文" Then
  62. If Strings.Mid(line, 10, 2) = "CH" Then : 語言_dgv.Rows.Insert(0)
  63. 語言_dgv.Rows(0).Cells(0).Value = Strings.Left(line, 11)
  64. If Strings.Mid(line, 13, 300).EndsWith(",") Then
  65. 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300).Substring(0, Strings.Mid(line, 13, 300).Length - 1)
  66. Else : 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300) : End If
  67. End If
  68. ElseIf 系統語言 = "English" Then
  69. If Strings.Mid(line, 10, 2) = "EN" Then : 語言_dgv.Rows.Insert(0)
  70. 語言_dgv.Rows(0).Cells(0).Value = Strings.Left(line, 11)
  71. If Strings.Mid(line, 13, 300).EndsWith(",") Then
  72. 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300).Substring(0, Strings.Mid(line, 13, 300).Length - 1)
  73. Else : 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300) : End If
  74. End If
  75. ElseIf 系統語言 = "Indonesian" Then
  76. If Strings.Mid(line, 10, 2) = "IN" Then : 語言_dgv.Rows.Insert(0)
  77. 語言_dgv.Rows(0).Cells(0).Value = Strings.Left(line, 11)
  78. If Strings.Mid(line, 13, 300).EndsWith(",") Then
  79. 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300).Substring(0, Strings.Mid(line, 13, 300).Length - 1)
  80. Else : 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300) : End If
  81. End If
  82. End If
  83. End If
  84. End If
  85. End While
  86. filereader.Close()
  87. End If
  88. End Sub
  89. Private Sub Set_語言查詢()
  90. RI = -1 : For Each row As DataGridViewRow In 語言_dgv.Rows
  91. If Strings.Left(row.Cells(0).Value.ToString(), 8) = SK Then
  92. RI = row.Index : Exit For
  93. End If
  94. Next
  95. End Sub
  96. Private Sub 語言轉換讀取()
  97. Set_語言()
  98. SK = "H001-271" : Set_語言查詢() : Me.Text = 語言_dgv(1, RI).Value.ToString : SK = "G000-108" : Set_語言查詢() : ToolTip1.ToolTipTitle = 語言_dgv(1, RI).Value.ToString
  99. SK = "H610-100" : Set_語言查詢() : 臨時卡激活_tp.Text = 語言_dgv(1, RI).Value.ToString : SK = "H610-101" : Set_語言查詢() : 臨時卡列印_tp.Text = 語言_dgv(1, RI).Value.ToString
  100. SK = "H610-102" : Set_語言查詢() : Label7.Text = 語言_dgv(1, RI).Value.ToString : SK = "H610-103" : Set_語言查詢() : Label2.Text = 語言_dgv(1, RI).Value.ToString
  101. SK = "G000-114" : Set_語言查詢() : 對話框(0) = 語言_dgv(1, RI).Value.ToString : SK = "H610-104" : Set_語言查詢() : Label1.Text = 語言_dgv(1, RI).Value.ToString
  102. SK = "H610-105" : Set_語言查詢() : Label3.Text = 語言_dgv(1, RI).Value.ToString : SK = "H610-106" : Set_語言查詢() : Label4.Text = 語言_dgv(1, RI).Value.ToString
  103. SK = "H610-107" : Set_語言查詢() : Label5.Text = 語言_dgv(1, RI).Value.ToString : SK = "H601-104" : Set_語言查詢() : 表頭(1) = 語言_dgv(1, RI).Value.ToString
  104. SK = "G000-113" : Set_語言查詢() : 對話框(1) = 語言_dgv(1, RI).Value.ToString : SK = "H610-108" : Set_語言查詢() : 對話框(2) = 語言_dgv(1, RI).Value.ToString
  105. SK = "G000-127" : Set_語言查詢() : 對話框(3) = 語言_dgv(1, RI).Value.ToString : SK = "H610-109" : Set_語言查詢() : Label11.Text = 語言_dgv(1, RI).Value.ToString
  106. SK = "G000-162" : Set_語言查詢() : 對話框(4) = 語言_dgv(1, RI).Value.ToString : SK = "G000-163" : Set_語言查詢() : 對話框(5) = 語言_dgv(1, RI).Value.ToString
  107. SK = "H610-110" : Set_語言查詢() : 空白臨時卡_ch.Text = 語言_dgv(1, RI).Value.ToString : SK = "H610-111" : Set_語言查詢() : 已使用的臨時卡_ch.Text = 語言_dgv(1, RI).Value.ToString
  108. SK = "H610-112" : Set_語言查詢() : 對話框(6) = 語言_dgv(1, RI).Value.ToString : SK = "G000-119" : Set_語言查詢() : 對話框(7) = 語言_dgv(1, RI).Value.ToString
  109. SK = "H610-113" : Set_語言查詢() : 對話框(8) = 語言_dgv(1, RI).Value.ToString : SK = "H204-134" : Set_語言查詢() : 對話框(9) = 語言_dgv(1, RI).Value.ToString
  110. SK = "H610-114" : Set_語言查詢() : 對話框(10) = 語言_dgv(1, RI).Value.ToString : 表頭(2) = 系統語言字典("H611-105-" & 語言)
  111. SK = "H602-102" : Set_語言查詢() : 姓名_lb.Text = 語言_dgv(1, RI).Value.ToString : 表頭(0) = 語言_dgv(1, RI).Value.ToString
  112. End Sub
  113. Private Sub 列印成EXCEL_bt_MouseEnter(sender As Object, e As EventArgs) Handles 列印成EXCEL_bt.MouseEnter
  114. ToolTip1.SetToolTip(Me.列印成EXCEL_bt, 對話框(0))
  115. End Sub
  116. Private Sub 列印成EXCEL1_bt_MouseEnter(sender As Object, e As EventArgs) Handles 列印成EXCEL1_bt.MouseEnter
  117. ToolTip1.SetToolTip(Me.列印成EXCEL1_bt, 對話框(0))
  118. End Sub
  119. Private Sub 查詢_bt_MouseEnter(sender As Object, e As EventArgs) Handles 查詢_bt.MouseEnter
  120. ToolTip1.SetToolTip(Me.查詢_bt, 對話框(1))
  121. End Sub
  122. Private Sub 確認新增_bt_MouseEnter(sender As Object, e As EventArgs) Handles 確認新增_bt.MouseEnter
  123. ToolTip1.SetToolTip(Me.確認新增_bt, 對話框(2))
  124. End Sub
  125. Private Sub 確認新增1_bt_MouseEnter(sender As Object, e As EventArgs) Handles 確認新增1_bt.MouseEnter
  126. ToolTip1.SetToolTip(Me.確認新增1_bt, 對話框(2))
  127. End Sub
  128. Private Sub 群組清單()
  129. SQL_人員薪資表_群組() : 群組_cb.Items.Clear() : 群組_cb.Items.Add("")
  130. While (dr.Read()) : 群組_cb.Items.Add(dr("部門名稱")) : End While : conn.Close()
  131. End Sub
  132. Private Sub 臨時工卡片管理_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  133. 群組_cb.SendToBack()
  134. 清單1_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  135. 查詢_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  136. End Sub
  137. Private Sub 臨時工卡片管理_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  138. 風格() : H(610) = True : 介面 = "H610" : 語言轉換讀取() : 顯示說明(999, False)
  139. 視窗3_pl.Visible = False : 視窗3_pl.BringToFront() : 空白臨時卡_ch.Checked = True : Panel1.SendToBack()
  140. If Strings.Left(登入人部門, 1) = "3" Then : Panel2.Enabled = False : End If
  141. 群組清單() : Set_使用者清單()
  142. End Sub
  143. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  144. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  145. End Sub
  146. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  147. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  148. End Sub
  149. Private Sub 清單1_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 清單1_dgv.CellClick
  150. If e.RowIndex = -1 Then : Else
  151. QRCode1_pb.Image = Nothing : QRCode1_pb.Image = New Bitmap(QRCode1_pb.Width, QRCode1_pb.Height)
  152. Dim GP As Graphics = Graphics.FromImage(QRCode1_pb.Image) : QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0
  153. QRCODE.QRWriteBar(清單1_dgv.Rows(e.RowIndex).Cells(表頭(1)).Value.ToString, 12, 12, 3.3, GP)
  154. QRCode1_pb.SizeMode = 4
  155. End If
  156. End Sub
  157. Private Sub 查詢_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 查詢_dgv.CellClick
  158. 姓名_tb.Text = 查詢_dgv.Rows(e.RowIndex).Cells(表頭(0)).Value.ToString : ID卡號_tb.Text = 查詢_dgv.Rows(e.RowIndex).Cells(表頭(1)).Value.ToString
  159. QRCode_pb.Image = Nothing : QRCode2_pb.Image = Nothing
  160. QRCode_pb.Image = New Bitmap(QRCode_pb.Width, QRCode_pb.Height) : QRCode2_pb.Image = New Bitmap(QRCode2_pb.Width, QRCode2_pb.Height)
  161. Dim GP As Graphics = Graphics.FromImage(QRCode_pb.Image) : QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0
  162. Dim GP1 As Graphics = Graphics.FromImage(QRCode2_pb.Image) : QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0
  163. QRCODE.QRWriteBar(查詢_dgv.Rows(e.RowIndex).Cells(表頭(1)).Value.ToString, 16, 16, 7.2, GP)
  164. QRCODE.QRWriteBar(查詢_dgv.Rows(e.RowIndex).Cells(表頭(1)).Value.ToString, 12, 12, 3.3, GP1)
  165. QRCode_pb.SizeMode = 4 : QRCode2_pb.SizeMode = 4
  166. 視窗3_pl.Visible = False : Label6.Text = 對話框(5)
  167. If 姓名_tb.Text = "未啟用/Not Enabled" Then : 可激活 = True : Else : 可激活 = False : End If
  168. End Sub
  169. Private Sub 清單1_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 清單1_dgv.MouseUp
  170. 'If 清單1_dgv.SelectedCells.Count = 1 Then : MsgBox(清單1_dgv.SelectedCells(0).ColumnIndex & " " & 清單1_dgv.SelectedCells(0).RowIndex) : End If
  171. If 清單1_dgv.SelectedCells.Count > 0 Then
  172. If 清單1_dgv.SelectedCells(0).ColumnIndex = 2 Then
  173. 群組_cb.Text = 清單1_dgv.Rows(清單1_dgv.SelectedCells(0).RowIndex).Cells(2).Value.ToString
  174. CB選擇清單(群組_cb, 群組_cb.Text)
  175. 清單1_dgv.Rows(清單1_dgv.SelectedCells(0).RowIndex).Cells(2).Value = 群組_cb.Text
  176. End If
  177. End If
  178. End Sub
  179. Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
  180. Dim 運算 As Boolean
  181. If 姓名_tb.Text = "" And ID卡號_tb.Text = "" Then : MGB(對話框(3), 1) : 運算 = False
  182. ElseIf 姓名_tb.Text <> "" And ID卡號_tb.Text = "" Then : PA5 = 姓名_tb.Text : SQL2 = "姓名 LIKE N'%" & PA5 & "%'" : 運算 = True
  183. ElseIf 姓名_tb.Text = "" And ID卡號_tb.Text <> "" Then : PA6 = ID卡號_tb.Text : SQL2 = "ID卡號 LIKE N'" & PA6 & "'" : 運算 = True
  184. ElseIf 姓名_tb.Text <> "" And ID卡號_tb.Text <> "" Then : PA5 = 姓名_tb.Text : PA6 = ID卡號_tb.Text : SQL2 = "姓名 LIKE N'%" & PA5 & "%' AND ID卡號 LIKE N'" & PA6 & "'" : 運算 = True
  185. End If
  186. If 運算 = True Then
  187. Dim ds1 As New DataSet
  188. 查詢_dgv.DataSource = Nothing : ds1.Clear()
  189. 查詢_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  190. 查詢_dgv.ColumnHeadersHeight = 25 : 查詢_dgv.AllowUserToAddRows = False : 查詢_dgv.RowTemplate.Height = 25
  191. SQL_臨時工卡片查詢()
  192. da.Fill(ds1) : 查詢_dgv.DataSource = ds1.Tables(0) : conn.Close()
  193. Else : 查詢_dgv.DataSource = Nothing
  194. End If
  195. If 查詢_dgv.Rows.Count = 0 Then : 可激活 = False
  196. Label6.Text = 對話框(4) : QRCode_pb.Image = Nothing : QRCode2_pb.Image = Nothing
  197. ElseIf 查詢_dgv.Rows.Count = 1 Then
  198. Label6.Text = 對話框(5) : 姓名_tb.Text = 查詢_dgv.Rows(0).Cells(表頭(0)).Value.ToString : ID卡號_tb.Text = 查詢_dgv.Rows(0).Cells(表頭(1)).Value.ToString
  199. QRCode_pb.Image = Nothing : QRCode2_pb.Image = Nothing
  200. QRCode_pb.Image = New Bitmap(QRCode_pb.Width, QRCode_pb.Height) : QRCode2_pb.Image = New Bitmap(QRCode2_pb.Width, QRCode2_pb.Height)
  201. Dim GP As Graphics = Graphics.FromImage(QRCode_pb.Image) : QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0
  202. Dim GP1 As Graphics = Graphics.FromImage(QRCode2_pb.Image) : QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0
  203. QRCODE.QRWriteBar(查詢_dgv.Rows(0).Cells(表頭(1)).Value.ToString, 100, 20, 9, GP)
  204. QRCODE.QRWriteBar(查詢_dgv.Rows(0).Cells(表頭(1)).Value.ToString, 12, 12, 3.3, GP1)
  205. QRCode_pb.SizeMode = 4 : QRCode2_pb.SizeMode = 4
  206. If 姓名_tb.Text = "未啟用/Not Enabled" Then : 可激活 = True : Else : 可激活 = False : End If
  207. ElseIf 查詢_dgv.Rows.Count > 0 Then
  208. 視窗3_pl.Visible = True
  209. End If
  210. End Sub
  211. Private Sub 空白臨時卡_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 空白臨時卡_ch.Click
  212. 空白臨時卡_ch.Checked = True : 已使用的臨時卡_ch.Checked = False : Set_使用者清單()
  213. End Sub
  214. Private Sub 已使用的臨時卡_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 已使用的臨時卡_ch.Click
  215. 空白臨時卡_ch.Checked = False : 已使用的臨時卡_ch.Checked = True : Set_使用者清單()
  216. End Sub
  217. Private Sub 確認新增1_bt_Click(sender As Object, e As EventArgs) Handles 確認新增1_bt.Click
  218. If 空白臨時卡_ch.Checked = True Then
  219. Dim 重複姓名 As String = "" : Dim 有資料 As Boolean
  220. For i As Integer = 0 To 清單1_dgv.Rows.Count - 1
  221. If 清單1_dgv.Rows(i).Cells(表頭(0)).Value.ToString <> "" Then : SK = 清單1_dgv.Rows(i).Cells(表頭(0)).Value.ToString
  222. RI = -1
  223. For Each row As DataGridViewRow In 清單1_dgv.Rows : If row.Cells(0).Value.ToString().ToUpper = SK.ToUpper Then : RI = row.Index : Exit For : End If : Next
  224. If 重複姓名 = "" Then : If RI <> i Then : 重複姓名 = 清單1_dgv(0, RI).Value.ToString() : End If
  225. Else : If RI <> i Then : 重複姓名 = 重複姓名 & "、" & 清單1_dgv(0, RI).Value.ToString() : End If : End If
  226. RI = -1
  227. For Each row As DataGridViewRow In 清單_dgv.Rows : If row.Cells(0).Value.ToString().ToUpper = SK.ToUpper Then : RI = row.Index : Exit For : End If : Next
  228. If 重複姓名 = "" Then : If RI > -1 Then : 重複姓名 = 清單_dgv(0, RI).Value.ToString() : End If
  229. Else : If RI > -1 Then : 重複姓名 = 重複姓名 & "、" & 清單_dgv(0, RI).Value.ToString() : End If : End If
  230. 有資料 = True
  231. End If
  232. Next
  233. If 有資料 = False Then : MGB(對話框(8), 1) : Else
  234. If 重複姓名 <> "" Then : MGB(對話框(6) & 重複姓名, 1) : Else
  235. For i As Integer = 0 To 清單1_dgv.Rows.Count - 1
  236. If 清單1_dgv.Rows(i).Cells(表頭(0)).Value.ToString <> "" Then
  237. PA32 = 清單1_dgv.Rows(i).Cells(表頭(0)).Value.ToString : PA33 = 清單1_dgv.Rows(i).Cells(表頭(1)).Value.ToString
  238. PA30 = 清單1_dgv.Rows(i).Cells(2).Value.ToString : PA31 = 清單1_dgv.Rows(i).Cells(2).Value.ToString
  239. SQL_臨時工人開卡()
  240. End If
  241. Next : MGB(對話框(7), 1) : Set_使用者清單()
  242. End If
  243. End If
  244. End If
  245. End Sub
  246. Private Sub 確認新增_bt_Click(sender As Object, e As EventArgs) Handles 確認新增_bt.Click
  247. If 可激活 = False Then : MGB(對話框(10), 1) : Else
  248. If 姓名_tb.Text = "" Or 姓名_tb.Text = "未啟用/Not Enabled" Then : MGB(對話框(10), 1) : Else
  249. If ID卡號_tb.Text <> "" Then : PA32 = 姓名_tb.Text : PA33 = ID卡號_tb.Text : SQL_臨時工人開卡() : MGB(對話框(7), 1) : Set_使用者清單() : End If
  250. End If
  251. End If
  252. End Sub
  253. Private Sub 列印成EXCEL1_bt_Click(sender As Object, e As EventArgs) Handles 列印成EXCEL1_bt.Click
  254. xlApp = CType(CreateObject("Excel.Application"), Application)
  255. xlApp.Visible = True
  256. xlApp.DisplayAlerts = True
  257. xlApp.Application.WindowState = xlMaximized
  258. xlBook = xlApp.Workbooks.Add
  259. '----------------------------------------------------------------------------------------------------------------------
  260. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select
  261. xlBook.Activate() : xlSheet.Activate()
  262. xlSheet.Cells(4, 2) = ID卡號_tb.Text : xlSheet.Cells(5, 2) = 姓名_tb.Text
  263. AA1(xlApp, xlSheet) : BB1(xlApp, xlSheet)
  264. xlSheet.PageSetup.PrintArea = ""
  265. xlApp.Cells.Select()
  266. xlApp.Application.WindowState = xlMinimized
  267. MGB(對話框(9), 1)
  268. End Sub
  269. Private Sub 列印成EXCEL_bt_Click(sender As Object, e As EventArgs) Handles 列印成EXCEL_bt.Click
  270. xlApp = CType(CreateObject("Excel.Application"), Application)
  271. xlApp.Visible = True
  272. xlApp.DisplayAlerts = True
  273. xlApp.Application.WindowState = xlMaximized
  274. xlBook = xlApp.Workbooks.Add
  275. 剩下 = 清單1_dgv.Rows.Count
  276. If 剩下 < 46 Then : 頁數 = 1 : ElseIf 剩下 < 91 Then : 頁數 = 2 : ElseIf 剩下 < 136 Then : 頁數 = 3 : ElseIf 剩下 < 181 Then : 頁數 = 4 : ElseIf 剩下 < 226 Then : 頁數 = 5
  277. ElseIf 剩下 < 271 Then : 頁數 = 6 : ElseIf 剩下 < 316 Then : 頁數 = 7 : ElseIf 剩下 < 361 Then : 頁數 = 8 : ElseIf 剩下 < 406 Then : 頁數 = 9 : ElseIf 剩下 < 451 Then : 頁數 = 10
  278. ElseIf 剩下 < 496 Then : 頁數 = 11 : ElseIf 剩下 < 541 Then : 頁數 = 12 : ElseIf 剩下 < 586 Then : 頁數 = 13 : ElseIf 剩下 < 631 Then : 頁數 = 14 : ElseIf 剩下 < 676 Then : 頁數 = 15
  279. ElseIf 剩下 < 721 Then : 頁數 = 16 : ElseIf 剩下 < 766 Then : 頁數 = 17 : ElseIf 剩下 < 811 Then : 頁數 = 18 : End If
  280. 開始 = 1 : II2 = 0 : II3 = 0
  281. For AZ As Integer = 1 To 頁數
  282. X軸 = 0 : 換行 = 0
  283. If AZ = 頁數 Then : 結尾 = 剩下 : Else : 結尾 = AZ * 45 : End If
  284. '----------------------------------------------------------------------------------------------------------------------
  285. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select
  286. xlBook.Activate() : xlSheet.Activate()
  287. For BZ As Integer = 開始 To 結尾
  288. X軸 += 1 : If X軸 = 4 Then : X軸 = 1 : End If
  289. If X軸 = 1 Then : xlSheet.Cells(4 + 換行, 2) = 清單1_dgv.Rows(II2).Cells(表頭(1)).Value.ToString : xlSheet.Cells(5 + 換行, 2) = 清單1_dgv.Rows(II2).Cells(表頭(0)).Value.ToString
  290. ElseIf X軸 = 2 Then : xlSheet.Cells(4 + 換行, 4) = 清單1_dgv.Rows(II2).Cells(表頭(1)).Value.ToString : xlSheet.Cells(5 + 換行, 4) = 清單1_dgv.Rows(II2).Cells(表頭(0)).Value.ToString
  291. ElseIf X軸 = 3 Then : xlSheet.Cells(4 + 換行, 6) = 清單1_dgv.Rows(II2).Cells(表頭(1)).Value.ToString : xlSheet.Cells(5 + 換行, 6) = 清單1_dgv.Rows(II2).Cells(表頭(0)).Value.ToString
  292. End If : If X軸 = 3 Then : 換行 += 5 : End If : II2 += 1
  293. Next
  294. 資料數 = 結尾 - 開始 : 行數 = 0 : For i As Integer = 0 To 9999 : If 資料數 <= 3 Then : 行數 += 1 : Exit For : Else : 資料數 -= 3 : 行數 += 1 : End If : Next
  295. AA(xlApp, xlSheet) : BB(xlApp, xlSheet) : 開始 += 45
  296. Next
  297. xlSheet.PageSetup.PrintArea = ""
  298. xlApp.Cells.Select()
  299. xlApp.Application.WindowState = xlMinimized
  300. MGB(對話框(9), 1)
  301. End Sub
  302. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  303. Return CType(xlBook.Worksheets.Add, Worksheet)
  304. End Function
  305. Private Sub BB1(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  306. xlSheet.Rows(1 & ":" & 1).Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows(2 & ":" & 2).Select : myExcel.Selection.RowHeight = 50
  307. xlSheet.Rows(3 & ":" & 3).Select : myExcel.Selection.RowHeight = 130 : xlSheet.Rows(4 & ":" & 4).Select : myExcel.Selection.RowHeight = 20
  308. xlSheet.Rows(5 & ":" & 5).Select : myExcel.Selection.RowHeight = 35
  309. xlSheet.Range("B4:B5").Select()
  310. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  311. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  312. xlSheet.Range("B2:B5").Select()
  313. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  314. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  315. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  316. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  317. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  318. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  319. Clipboard.SetDataObject(LOGO_pb.Image) : xlSheet.Range("B2").Select() : myExcel.ActiveSheet.Pictures.Paste.Select
  320. myExcel.Selection.ShapeRange.Height = 45 : myExcel.Selection.ShapeRange.IncrementLeft(17) : myExcel.Selection.ShapeRange.IncrementTop(2)
  321. Clipboard.SetDataObject(QRCode2_pb.Image) : xlSheet.Range("B3").Select() : myExcel.ActiveSheet.Pictures.Paste.Select
  322. myExcel.Selection.ShapeRange.Height = 120 : myExcel.Selection.ShapeRange.IncrementLeft(17) : myExcel.Selection.ShapeRange.IncrementTop(2)
  323. myExcel.Application.PrintCommunication = False
  324. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With
  325. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  326. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  327. .LeftMargin = myExcel.Application.InchesToPoints(0.25) : .RightMargin = myExcel.Application.InchesToPoints(0.25) : .TopMargin = myExcel.Application.InchesToPoints(0.75)
  328. .BottomMargin = myExcel.Application.InchesToPoints(0.75) : .HeaderMargin = myExcel.Application.InchesToPoints(0.3) : .FooterMargin = myExcel.Application.InchesToPoints(0.3)
  329. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = False : .CenterVertically = False : .Draft = False
  330. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = 100 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False
  331. .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = ""
  332. .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = ""
  333. .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  334. End With : myExcel.Application.PrintCommunication = True
  335. End Sub
  336. Private Sub BB(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  337. 換行 = 0
  338. For i As Integer = 1 To 行數
  339. xlSheet.Rows(1 + 換行 & ":" & 1 + 換行).Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows(2 + 換行 & ":" & 2 + 換行).Select : myExcel.Selection.RowHeight = 50
  340. xlSheet.Rows(3 + 換行 & ":" & 3 + 換行).Select : myExcel.Selection.RowHeight = 130 : xlSheet.Rows(4 + 換行 & ":" & 4 + 換行).Select : myExcel.Selection.RowHeight = 20
  341. xlSheet.Rows(5 + 換行 & ":" & 5 + 換行).Select : myExcel.Selection.RowHeight = 35
  342. xlSheet.Range("B" & 4 + 換行 & ":B" & 5 + 換行).Select()
  343. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  344. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  345. xlSheet.Range("D" & 4 + 換行 & ":D" & 5 + 換行).Select()
  346. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  347. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  348. xlSheet.Range("F" & 4 + 換行 & ":F" & 5 + 換行).Select()
  349. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  350. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  351. xlSheet.Range("B" & 2 + 換行 & ":B" & 5 + 換行).Select()
  352. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  353. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  354. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  355. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  356. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  357. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  358. xlSheet.Range("D" & 2 + 換行 & ":D" & 5 + 換行).Select()
  359. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  360. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  361. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  362. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  363. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  364. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  365. xlSheet.Range("F" & 2 + 換行 & ":F" & 5 + 換行).Select()
  366. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  367. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  368. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  369. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  370. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  371. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  372. Clipboard.SetDataObject(LOGO_pb.Image) : xlSheet.Range("B" & 2 + 換行).Select() : myExcel.ActiveSheet.Pictures.Paste.Select
  373. myExcel.Selection.ShapeRange.Height = 45 : myExcel.Selection.ShapeRange.IncrementLeft(17) : myExcel.Selection.ShapeRange.IncrementTop(2)
  374. Clipboard.SetDataObject(LOGO_pb.Image) : xlSheet.Range("D" & 2 + 換行).Select() : myExcel.ActiveSheet.Pictures.Paste.Select
  375. myExcel.Selection.ShapeRange.Height = 45 : myExcel.Selection.ShapeRange.IncrementLeft(17) : myExcel.Selection.ShapeRange.IncrementTop(2)
  376. Clipboard.SetDataObject(LOGO_pb.Image) : xlSheet.Range("F" & 2 + 換行).Select() : myExcel.ActiveSheet.Pictures.Paste.Select
  377. myExcel.Selection.ShapeRange.Height = 45 : myExcel.Selection.ShapeRange.IncrementLeft(17) : myExcel.Selection.ShapeRange.IncrementTop(2)
  378. 換行 += 5
  379. Next
  380. X軸 = 0 : 換行 = 0
  381. For BZ As Integer = 開始 To 結尾
  382. X軸 += 1 : If X軸 = 4 Then : X軸 = 1 : End If
  383. QRCode1_pb.Image = Nothing : QRCode1_pb.Image = New Bitmap(QRCode1_pb.Width, QRCode1_pb.Height)
  384. Dim GP As Graphics = Graphics.FromImage(QRCode1_pb.Image) : QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0
  385. QRCODE.QRWriteBar(清單1_dgv.Rows(II3).Cells(表頭(1)).Value.ToString, 12, 12, 3.3, GP)
  386. QRCode1_pb.SizeMode = 4
  387. If X軸 = 1 Then
  388. Clipboard.SetDataObject(QRCode1_pb.Image) : xlSheet.Range("B" & 3 + 換行).Select() : myExcel.ActiveSheet.Pictures.Paste.Select
  389. myExcel.Selection.ShapeRange.Height = 120 : myExcel.Selection.ShapeRange.IncrementLeft(17) : myExcel.Selection.ShapeRange.IncrementTop(2)
  390. ElseIf X軸 = 2 Then
  391. Clipboard.SetDataObject(QRCode1_pb.Image) : xlSheet.Range("D" & 3 + 換行).Select() : myExcel.ActiveSheet.Pictures.Paste.Select
  392. myExcel.Selection.ShapeRange.Height = 120 : myExcel.Selection.ShapeRange.IncrementLeft(17) : myExcel.Selection.ShapeRange.IncrementTop(2)
  393. ElseIf X軸 = 3 Then
  394. Clipboard.SetDataObject(QRCode1_pb.Image) : xlSheet.Range("F" & 3 + 換行).Select() : myExcel.ActiveSheet.Pictures.Paste.Select
  395. myExcel.Selection.ShapeRange.Height = 120 : myExcel.Selection.ShapeRange.IncrementLeft(17) : myExcel.Selection.ShapeRange.IncrementTop(2)
  396. End If
  397. If X軸 = 3 Then : 換行 += 5 : End If : II3 += 1
  398. Next
  399. myExcel.Application.PrintCommunication = False
  400. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With
  401. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  402. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  403. .LeftMargin = myExcel.Application.InchesToPoints(0.25) : .RightMargin = myExcel.Application.InchesToPoints(0.25) : .TopMargin = myExcel.Application.InchesToPoints(0.75)
  404. .BottomMargin = myExcel.Application.InchesToPoints(0.75) : .HeaderMargin = myExcel.Application.InchesToPoints(0.3) : .FooterMargin = myExcel.Application.InchesToPoints(0.3)
  405. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = False : .CenterVertically = False : .Draft = False
  406. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = 100 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False
  407. .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = ""
  408. .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = ""
  409. .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  410. End With : myExcel.Application.PrintCommunication = True
  411. End Sub
  412. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  413. xlSheet.Cells.Select()
  414. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  415. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  416. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 25
  417. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 25
  418. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 25
  419. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 5 : myExcel.ActiveWindow.DisplayGridlines = False
  420. End Sub
  421. Private Sub AA1(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  422. xlSheet.Cells.Select()
  423. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  424. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  425. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 25
  426. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 5 : myExcel.ActiveWindow.DisplayGridlines = False
  427. End Sub
  428. Private Sub 風格()
  429. If 深色風格 = False Then
  430. 臨時卡列印_tp.BackColor = SystemColors.Control : 臨時卡激活_tp.BackgroundImage = My.Resources._62951168976601486
  431. 視窗3_pl.BackColor = SystemColors.Control : Panel4.BackColor = Color.White
  432. 姓名_lb.ForeColor = Color.Black : Label6.ForeColor = Color.Black : Label1.ForeColor = Color.Black : 空白臨時卡_ch.ForeColor = Color.Black
  433. Label3.ForeColor = Color.Black : Label4.ForeColor = Color.Black : Label5.ForeColor = Color.Black : Label7.ForeColor = Color.Black
  434. Label2.ForeColor = Color.Black : 已使用的臨時卡_ch.ForeColor = Color.Black
  435. 筆數_tb.BackColor = Color.White : 筆數_tb.ForeColor = Color.Black
  436. 姓名_tb.BackColor = Color.White : 姓名_tb.ForeColor = Color.Black : ID卡號_tb.BackColor = Color.White : ID卡號_tb.ForeColor = Color.Black
  437. 查詢_bt.BackColor = Color.White : 列印成EXCEL_bt.BackColor = Color.White : 列印成EXCEL1_bt.BackColor = Color.White : 確認新增_bt.BackColor = Color.White
  438. 確認新增1_bt.BackColor = Color.White
  439. 清單1_dgv.EnableHeadersVisualStyles = True : 清單1_dgv.BackgroundColor = Color.White : 清單1_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  440. 清單1_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
  441. 清單1_dgv.DefaultCellStyle.BackColor = Color.White : 清單1_dgv.DefaultCellStyle.ForeColor = Color.Black
  442. 查詢_dgv.EnableHeadersVisualStyles = True : 查詢_dgv.BackgroundColor = Color.White : 查詢_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  443. 查詢_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
  444. 查詢_dgv.DefaultCellStyle.BackColor = Color.White : 查詢_dgv.DefaultCellStyle.ForeColor = Color.Black
  445. Else
  446. 臨時卡列印_tp.BackColor = Color.Black : 臨時卡激活_tp.BackgroundImage = My.Resources._20157059_MotionElements_diagonal_lines
  447. 視窗3_pl.BackColor = Color.DimGray : Panel4.BackColor = Color.Black
  448. 姓名_lb.ForeColor = Color.White : Label6.ForeColor = Color.White : Label1.ForeColor = Color.White : 空白臨時卡_ch.ForeColor = Color.White
  449. Label3.ForeColor = Color.White : Label4.ForeColor = Color.White : Label5.ForeColor = Color.White : Label7.ForeColor = Color.White
  450. Label2.ForeColor = Color.White : 已使用的臨時卡_ch.ForeColor = Color.White
  451. 筆數_tb.BackColor = Color.DimGray : 筆數_tb.ForeColor = Color.White
  452. 姓名_tb.BackColor = Color.DimGray : 姓名_tb.ForeColor = Color.White : ID卡號_tb.BackColor = Color.DimGray : ID卡號_tb.ForeColor = Color.White
  453. 查詢_bt.BackColor = Color.DimGray : 列印成EXCEL_bt.BackColor = Color.DimGray : 列印成EXCEL1_bt.BackColor = Color.DimGray : 確認新增_bt.BackColor = Color.DimGray
  454. 確認新增1_bt.BackColor = Color.DimGray
  455. 清單1_dgv.EnableHeadersVisualStyles = False : 清單1_dgv.BackgroundColor = Color.DimGray : 清單1_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  456. 清單1_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 清單1_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  457. 清單1_dgv.DefaultCellStyle.BackColor = Color.Black : 清單1_dgv.DefaultCellStyle.ForeColor = Color.White
  458. 查詢_dgv.EnableHeadersVisualStyles = False : 查詢_dgv.BackgroundColor = Color.DimGray : 查詢_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  459. 查詢_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 查詢_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  460. 查詢_dgv.DefaultCellStyle.BackColor = Color.Black : 查詢_dgv.DefaultCellStyle.ForeColor = Color.White
  461. End If
  462. End Sub
  463. End Class