Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

合約保固書.vb 30KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. Option Strict Off
  2. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  3. Imports Microsoft.Office.Interop.Excel.Constants
  4. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  5. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  6. Imports Microsoft.Office.Interop.Excel.XlWindowState
  7. Imports Microsoft.Office.Interop.Excel
  8. Public Class 合約保固書
  9. ReadOnly ds6 As New DataSet
  10. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  11. Dim 放大, 簽回檔 As Boolean : Dim 選擇項 As Integer
  12. Private Sub Set_合約清單()
  13. 合約_dgv.DataSource = Nothing : ds6.Clear()
  14. 合約_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  15. 合約_dgv.ColumnHeadersHeight = 40 : 合約_dgv.AllowUserToAddRows = False
  16. PA46 = 合約編號1_cb.Text : PA47 = 工程期1_ch.Text : PA = 關鍵字搜尋_tb.Text
  17. SQL_合約清單_保固用()
  18. da.Fill(ds6) : 合約_dgv.DataSource = ds6.Tables(0) : conn.Close()
  19. 合約_dgv.Columns(0).FillWeight = 160 : 合約_dgv.Columns(1).Visible = False : 合約_dgv.Columns(2).Visible = False : 合約_dgv.Columns(3).Visible = False
  20. 合約_dgv.Columns(4).Visible = False : 合約_dgv.Columns(5).Visible = False : 合約_dgv.Columns(6).Visible = False : 合約_dgv.Columns(7).Visible = False
  21. 合約_dgv.Columns(8).Visible = False : 合約_dgv.Columns(9).Visible = False : 合約_dgv.Columns(10).Visible = False : 合約_dgv.Columns(11).Visible = False
  22. 合約_dgv.Columns(12).Visible = False : 合約_dgv.Columns(13).Visible = False : 合約_dgv.Columns(14).Visible = False : 合約_dgv.Columns(15).Visible = False
  23. 合約_dgv.Columns(16).Visible = False : 合約_dgv.Columns(17).Visible = False : 合約_dgv.Columns(18).Visible = False : 合約_dgv.Columns(19).Visible = False
  24. 合約_dgv.Columns(20).Visible = False : 合約_dgv.Columns(21).Visible = False : 合約_dgv.Columns(22).Visible = False : 合約_dgv.Columns(23).Visible = False
  25. 合約_dgv.Columns(24).Visible = False : 合約_dgv.Columns(25).Visible = False : 合約_dgv.Columns(26).Visible = False : 合約_dgv.Columns(27).Visible = False
  26. 合約_dgv.Columns(28).Visible = False : 合約_dgv.Columns(29).FillWeight = 50 : 合約_dgv.Columns(30).Visible = False : 合約_dgv.Columns(31).Visible = False
  27. 合約_dgv.Columns(32).FillWeight = 100 : 合約_dgv.Columns(33).FillWeight = 50 : 合約_dgv.Columns(34).Visible = False : 合約_dgv.Columns("工程名稱_中").FillWeight = 300
  28. 合約_dgv.Columns("簽回").FillWeight = 40 : 合約_dgv.Columns("簽回檔圖庫").Visible = False
  29. 合約_dgv.Columns(29).DefaultCellStyle.Format = "#,##0" : 合約_dgv.Columns(29).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  30. 合約_dgv.Columns(33).DefaultCellStyle.Format = "#,##0" : 合約_dgv.Columns(33).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  31. For i As Integer = 0 To 合約_dgv.Rows.Count - 1
  32. If IsDBNull(合約_dgv("簽回", i).Value) = True Then : 合約_dgv("簽回", i).Value = False : End If
  33. Next
  34. If 放大 = True Then
  35. 合約_dgv.Columns("工程名稱_中").Visible = True
  36. Else
  37. 合約_dgv.Columns("工程名稱_中").Visible = False
  38. End If
  39. End Sub
  40. Private Sub 甲方條件下拉清單讀取()
  41. SQL合約條件讀取() : 合約編號1_cb.Items.Clear() : 合約編號1_cb.Items.Add("") : While (dr.Read()) : 合約編號1_cb.Items.Add(dr("約號甲方")) : End While : conn.Close()
  42. End Sub
  43. Private Sub 語言轉換讀取()
  44. If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If
  45. Me.Text = 系統語言字典("H001-122-" & 語言) : ToolTip1.ToolTipTitle = 系統語言字典("G000-108-" & 語言)
  46. Label7.Text = 系統語言字典("H104-106-" & 語言) : Label11.Text = 系統語言字典("H110-118-" & 語言) : Label2.Text = 系統語言字典("H501-144-" & 語言)
  47. Label372.Text = 系統語言字典("H112-100-" & 語言) : Label375.Text = 系統語言字典("G000-215-" & 語言) : Label378.Text = 系統語言字典("G000-216-" & 語言)
  48. 表頭(1) = 系統語言字典("G000-156-" & 語言) : 表頭(2) = 系統語言字典("G000-237-" & 語言) : 表頭(3) = 系統語言字典("H114-123-" & 語言)
  49. 表頭(4) = 系統語言字典("H110-130-" & 語言) : 表頭(5) = 系統語言字典("H110-132-" & 語言) : 表頭(6) = 系統語言字典("H112-118-" & 語言)
  50. End Sub
  51. Private Sub 合約保固書_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  52. 風格() : H(111) = True : 介面 = "H111" : 語言轉換讀取() : 顯示說明(999, False)
  53. 甲方條件下拉清單讀取() : Set_合約清單() : 合約報價單_Siz()
  54. End Sub
  55. Private Sub 合約保固書_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  56. If 待辦進入 <> "" Then : lastFoundRowIndex = -1 : lastFoundColIndex = -1
  57. 關鍵字搜尋_tb.Text = 待辦進入 : 查詢DGV中的關鍵字_自動(合約_dgv, 關鍵字搜尋_tb) : 選擇項 = lastFoundRowIndex : 合約資料讀取()
  58. lastFoundRowIndex = -1 : lastFoundColIndex = -1 : 關鍵字搜尋_tb.Text = "" : 待辦進入 = ""
  59. End If
  60. End Sub
  61. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  62. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  63. End Sub
  64. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  65. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  66. End Sub
  67. Private Sub 合約報價單_Siz()
  68. MyMod.清單字體大小調整()
  69. 合約_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  70. End Sub
  71. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  72. 介面 = "H111" : 語言轉換讀取()
  73. End Sub
  74. Private Sub 合約_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約_dgv.CellClick
  75. If e.RowIndex = -1 Then : Else : 選擇項 = e.RowIndex : 合約資料讀取() : End If
  76. End Sub
  77. Private Sub 合約資料讀取()
  78. If 選擇項 <> -1 Then
  79. If 放大 = True Then : 縮放2_bt.PerformClick() : End If
  80. 圖片庫 = 合約_dgv("簽回檔圖庫", 選擇項).Value.ToString : 簽回檔 = 合約_dgv("簽回", 選擇項).Value
  81. 客戶名稱_tb.Text = 合約_dgv("客戶名稱", 選擇項).Value.ToString : 合約編號_tb.Text = 合約_dgv("合約編號", 選擇項).Value.ToString
  82. 工程名稱_中_tb.Text = 合約_dgv("工程名稱_中", 選擇項).Value.ToString : 工程名稱_英_tb.Text = 合約_dgv("工程名稱_英", 選擇項).Value.ToString
  83. 保固_cb.Text = 合約_dgv("保固期限", 選擇項).Value.ToString : 驗收完成_dtp.Value = 合約_dgv("驗收完成日期", 選擇項).Value.ToString
  84. If 合約_dgv("保固地址", 選擇項).Value.ToString <> "" Then : 保固地址_tb.Text = 合約_dgv("保固地址", 選擇項).Value.ToString : Else
  85. 保固地址_tb.Text = "Jl . kawasan Industri Terpadu Indonesia China (KITIC) Kav . 42 , Nagasari , Serang Baru , Kabupaten Bekasi 17330( I )"
  86. End If
  87. End If
  88. End Sub
  89. Private Sub 合約編號1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 合約編號1_cb.SelectedIndexChanged
  90. PA = 關鍵字搜尋_tb.Text : Set_合約清單()
  91. End Sub
  92. Private Sub 工程期1_ch_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程期1_ch.SelectedIndexChanged
  93. PA = 關鍵字搜尋_tb.Text : Set_合約清單()
  94. End Sub
  95. Private Sub 查閱文件_bt_Click(sender As Object, e As EventArgs) Handles 查閱文件_bt.Click
  96. If 合約編號_tb.Text = "" Then : MGB(系統語言字典("H110-111-" & 語言), 1) : Else
  97. If 簽回檔 = False Then
  98. MGB(系統語言字典("H106-111-" & 語言), 1)
  99. Else
  100. PA1 = 合約編號_tb.Text : PA2 = "保固" : 文件查閱視窗.ShowDialog()
  101. End If
  102. End If
  103. End Sub
  104. Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
  105. PA = 關鍵字搜尋_tb.Text : Set_合約清單()
  106. End Sub
  107. Private Sub 保固_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 保固_cb.SelectedIndexChanged
  108. 保固1_cb.SelectedIndex = 保固_cb.SelectedIndex
  109. If 保固_cb.Text <> "" Then : 保固完成_dtp.Value = 驗收完成_dtp.Value.AddMonths(CInt(保固_cb.Text)) : End If
  110. End Sub
  111. Private Sub 驗收完成_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 驗收完成_dtp.ValueChanged
  112. 保固完成_dtp.Value = 驗收完成_dtp.Value.AddMonths(CInt(保固_cb.Text))
  113. End Sub
  114. Private Sub 縮放2_bt_Click(sender As Object, e As EventArgs) Handles 縮放2_bt.Click
  115. Dim NX, NY As Integer : NX = 合約_dgv.Size.Width : NY = 合約_dgv.Size.Height
  116. If 放大 = True Then
  117. 合約_dgv.Size = New System.Drawing.Point(NX - 400, NY) : 放大 = False : 合約_dgv.Columns("工程名稱_中").Visible = False
  118. Else
  119. 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True : 合約_dgv.Columns("工程名稱_中").Visible = True
  120. End If
  121. End Sub
  122. Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
  123. PA = 合約編號_tb.Text : PA1 = 保固_cb.Text : PA2 = 保固地址_tb.Text : SQL_控制表_保固修改()
  124. MGB(系統語言字典("G000-119-" & 語言), 1) : PA = "" : Set_合約清單()
  125. End Sub
  126. Private Sub 列印_bt_MouseEnter(sender As Object, e As EventArgs) Handles 列印_bt.MouseEnter
  127. ToolTip1.SetToolTip(Me.列印_bt, 系統語言字典("G000-114-" & 語言))
  128. End Sub
  129. Private Sub 查閱文件_bt_MouseEnter(sender As Object, e As EventArgs) Handles 查閱文件_bt.MouseEnter
  130. ToolTip1.SetToolTip(Me.查閱文件_bt, 系統語言字典("H110-113-" & 語言))
  131. End Sub
  132. Private Sub 存檔_bt_MouseEnter(sender As Object, e As EventArgs) Handles 存檔_bt.MouseEnter
  133. ToolTip1.SetToolTip(Me.存檔_bt, 系統語言字典("G000-110-" & 語言))
  134. End Sub
  135. Private Sub 查詢_bt_MouseEnter(sender As Object, e As EventArgs) Handles 查詢_bt.MouseEnter
  136. ToolTip1.SetToolTip(Me.查詢_bt, 系統語言字典("G000-113-" & 語言))
  137. End Sub
  138. Private Sub 縮放2_bt_MouseEnter(sender As Object, e As EventArgs) Handles 縮放2_bt.MouseEnter
  139. ToolTip1.SetToolTip(Me.縮放2_bt, 系統語言字典("G000-198-" & 語言))
  140. End Sub
  141. Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
  142. If 合約編號_tb.Text = "" Then : MGB(系統語言字典("H104-112-" & 語言), 1) : Else
  143. PA = 合約編號_tb.Text : PA1 = 保固_cb.Text : PA2 = 保固地址_tb.Text : SQL_控制表_保固修改()
  144. '----------------------------------------------------------------------------------------------------------------------
  145. xlApp = CType(CreateObject("Excel.Application"), Application)
  146. xlApp.Visible = True
  147. xlApp.DisplayAlerts = True
  148. xlApp.Application.WindowState = xlMaximized
  149. xlBook = xlApp.Workbooks.Add
  150. '----------------------------------------------------------------------------------------------------------------------
  151. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "保固證書"
  152. xlBook.Activate() : xlSheet.Activate()
  153. Dim BF As String
  154. If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : BF = "PT HONG XHE INDUSTRIAL" : Else : BF = "PT PUNCAK GEMILANG SEMESTA" : End If
  155. xlSheet.Cells(2, 1) = "保 固 證 書" : xlSheet.Cells(3, 1) = "Warranty Certificate" : xlSheet.Cells(5, 1) = "工程名稱 : " & 工程名稱_中_tb.Text
  156. xlSheet.Cells(6, 1) = "Project Name : " & 工程名稱_英_tb.Text : xlSheet.Cells(8, 1) = "合約編號 :" & 合約編號_tb.Text
  157. xlSheet.Cells(9, 1) = "Contract Number : " & 合約編號_tb.Text : xlSheet.Cells(11, 1) = "保固期間 :自驗收合格日起保固 " & 保固_cb.Text & " 個月。"
  158. xlSheet.Cells(12, 1) = "Maintenance Period : Warranty for " & 保固1_cb.Text & " months from the date of acceptance."
  159. xlSheet.Cells(13, 2) = "(從 " & Strings.Format(驗收完成_dtp.Value, "yyyy/MM/dd") & " 到 " & Strings.Format(保固完成_dtp.Value, "yyyy/MM/dd") & ")"
  160. xlSheet.Cells(14, 2) = "(From " & Strings.Format(驗收完成_dtp.Value, "yyyy/MM/dd") & " To " & Strings.Format(保固完成_dtp.Value, "yyyy/MM/dd") & ")"
  161. xlSheet.Cells(16, 1) = "本公司保證於保固期間內,產品若有故障或狀況不良之情形,願負免費檢查並維修至完好狀態之責.惟屬天災,不可抗力或人為操作不當所造成之損壞,不在本公司保固範圍。"
  162. xlSheet.Cells(17, 1) = "We guarantee the warranty period, if the product is faulty or poor condition take a free inspection and repair to the intact state responsibility. Only a natural disaster, force majeure or man-made damage caused by improper operation, outside the scope of our warranty."
  163. xlSheet.Cells(19, 1) = "此致" : xlSheet.Cells(20, 1) = "Yours sincerely," : xlSheet.Cells(22, 1) = 客戶名稱_tb.Text : xlSheet.Cells(22, 3) = BF
  164. xlSheet.Cells(24, 1) = "負責人姓名: (蓋章)" : xlSheet.Cells(24, 3) = "負責人姓名: (蓋章)" : xlSheet.Cells(26, 1) = "Address :" & 保固地址_tb.Text
  165. AA(xlApp, xlSheet)
  166. If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet)
  167. '-------------轉換成PDF---------------------------------------------------------------------
  168. Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
  169. xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & 合約編號_tb.Text & "保固證書.pdf", XlFixedFormatQuality.xlQualityStandard, True)
  170. '-------------關閉EXCEL---------------------------------------------------------------------
  171. xlSheet.PageSetup.PrintArea = "" : xlApp.Cells.Select()
  172. xlApp.Application.WindowState = xlMinimized
  173. xlBook.Close(False)
  174. Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet)
  175. Runtime.InteropServices.Marshal.ReleaseComObject(xlBook)
  176. Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
  177. xlApp.Quit() : xlSheet = Nothing : xlBook = Nothing : xlApp = Nothing : GC.Collect()
  178. '-------------開啟PDF---------------------------------------------------------------------
  179. Dim pdfFilePath As String = SERT & "\" & 合約編號_tb.Text & "保固證書.pdf"
  180. If IsChromeInstalled() Then
  181. Try
  182. Dim chromeProcess As New Process()
  183. chromeProcess.StartInfo.FileName = "chrome"
  184. chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """"
  185. chromeProcess.Start() : MGB(系統語言字典("H508-121-" & 語言), 1)
  186. Catch ex As Exception
  187. MGB(系統語言字典("H508-121-" & 語言), 1)
  188. End Try
  189. Else
  190. Try
  191. System.Diagnostics.Process.Start("""" & pdfFilePath & """") : MGB(系統語言字典("H508-121-" & 語言), 1)
  192. Catch ex As Exception
  193. MGB(系統語言字典("H508-121-" & 語言), 1)
  194. End Try
  195. End If
  196. End If
  197. End Sub
  198. ' 檢查系統是否已安裝 Google Chrome
  199. Private Function IsChromeInstalled() As Boolean
  200. Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
  201. If key IsNot Nothing Then
  202. For Each subkeyName As String In key.GetSubKeyNames()
  203. Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey(subkeyName)
  204. Dim displayName As Object = subkey.GetValue("DisplayName")
  205. If displayName IsNot Nothing AndAlso displayName.ToString().Contains("Google Chrome") Then
  206. Return True
  207. End If
  208. Next
  209. End If
  210. Return False
  211. End Function
  212. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  213. Return CType(xlBook.Worksheets.Add, Worksheet)
  214. End Function
  215. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  216. xlSheet.Cells.Select()
  217. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  218. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  219. xlSheet.Columns("A:C").Select : myExcel.Selection.ColumnWidth = 43
  220. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95
  221. xlSheet.Rows("2:3").Select
  222. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  223. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  224. xlSheet.Rows("2:3").Select : myExcel.Selection.RowHeight = 35
  225. xlSheet.Range("A2:C2").Select()
  226. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  227. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  228. xlSheet.Range("A3:C3").Select()
  229. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  230. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  231. myExcel.Selection.Font.Underline = xlUnderlineStyleSingle
  232. xlSheet.Rows("4:15").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("16:16").Select : myExcel.Selection.RowHeight = 50
  233. xlSheet.Range("A16:C16").Select()
  234. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  235. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  236. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  237. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  238. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  239. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  240. xlSheet.Rows("17:17").Select : myExcel.Selection.RowHeight = 60
  241. xlSheet.Range("A17:C17").Select()
  242. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  243. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  244. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  245. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  246. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  247. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  248. xlSheet.Rows("18:20").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("21:21").Select : myExcel.Selection.RowHeight = 50
  249. xlSheet.Rows("23:23").Select : myExcel.Selection.RowHeight = 140 : xlSheet.Rows("26:26").Select : myExcel.Selection.RowHeight = 35
  250. xlSheet.Range("A26:C26").Select()
  251. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  252. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  253. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  254. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  255. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  256. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  257. xlSheet.Range("E6").Select() : myExcel.ActiveWindow.DisplayGridlines = False
  258. End Sub
  259. Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  260. Clipboard.SetDataObject(PictureBox1.Image)
  261. xlSheet.Range("A1").Select()
  262. myExcel.ActiveSheet.Pictures.Paste.Select
  263. myExcel.Selection.ShapeRange.Height = 93
  264. myExcel.Selection.ShapeRange.IncrementLeft(0)
  265. myExcel.Selection.ShapeRange.IncrementTop(0)
  266. End Sub
  267. Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  268. Clipboard.SetDataObject(PictureBox2.Image)
  269. xlSheet.Range("A1").Select()
  270. myExcel.ActiveSheet.Pictures.Paste.Select
  271. myExcel.Selection.ShapeRange.Height = 93
  272. myExcel.Selection.ShapeRange.IncrementLeft(0)
  273. myExcel.Selection.ShapeRange.IncrementTop(0)
  274. End Sub
  275. Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  276. If Strings.Left(合約編號_tb.Text, 2) = "HX" Then
  277. myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
  278. Str01 & "\HXBWLOG.png"
  279. Else
  280. myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
  281. Str01 & "\PGSBWLOG.png"
  282. End If
  283. myExcel.Application.PrintCommunication = False : With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With
  284. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  285. With myExcel.ActiveSheet.PageSetup : .LeftHeader = ""
  286. .CenterHeader = "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "&G"
  287. .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = ""
  288. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  289. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  290. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  291. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False
  292. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False
  293. .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True
  294. .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = ""
  295. .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = ""
  296. .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  297. End With : myExcel.Application.PrintCommunication = True
  298. End Sub
  299. Private Sub 風格()
  300. If 深色風格 = False Then
  301. Me.BackColor = SystemColors.Control : Label2.BackColor = SystemColors.Control : Label11.BackColor = SystemColors.Control
  302. Label16.BackColor = SystemColors.Control
  303. Label7.ForeColor = Color.Black : Label11.ForeColor = Color.Black : Label2.ForeColor = Color.Black : Label16.ForeColor = Color.Black
  304. Label372.ForeColor = Color.FromArgb(192, 0, 0) : Label375.ForeColor = Color.FromArgb(192, 0, 0) : Label378.ForeColor = Color.FromArgb(192, 0, 0)
  305. Label13.ForeColor = Color.Blue : Label14.ForeColor = Color.Blue : Label9.ForeColor = Color.Blue : Label12.ForeColor = Color.Blue
  306. Label1.ForeColor = Color.Blue : Label3.ForeColor = Color.Blue : Label17.ForeColor = Color.Blue : Label18.ForeColor = Color.Blue
  307. Label4.ForeColor = Color.Blue : Label5.ForeColor = Color.Blue : Label6.ForeColor = Color.Blue : Label8.ForeColor = Color.Blue
  308. Label15.ForeColor = Color.Blue
  309. 關鍵字搜尋_tb.BackColor = Color.White : 關鍵字搜尋_tb.ForeColor = Color.Black : 合約編號_tb.BackColor = Color.White : 合約編號_tb.ForeColor = Color.Black
  310. 客戶名稱_tb.BackColor = Color.White : 客戶名稱_tb.ForeColor = Color.Black : 工程名稱_中_tb.BackColor = Color.White : 工程名稱_中_tb.ForeColor = Color.Black
  311. 工程名稱_英_tb.BackColor = Color.White : 工程名稱_英_tb.ForeColor = Color.Black
  312. 合約編號1_cb.BackColor = Color.White : 合約編號1_cb.ForeColor = Color.Blue : 保固_cb.BackColor = Color.White : 保固_cb.ForeColor = Color.Blue
  313. 保固1_cb.BackColor = Color.White : 保固1_cb.ForeColor = Color.Blue : 保固地址_tb.BackColor = Color.White : 保固地址_tb.ForeColor = Color.Blue
  314. 語轉扭_bt.BackColor = Color.White : 語轉扭_bt.ForeColor = Color.Black : 查詢_bt.BackColor = Color.White : 查詢_bt.ForeColor = Color.Black
  315. 縮放2_bt.BackColor = Color.White : 縮放2_bt.ForeColor = Color.Black : 存檔_bt.BackColor = Color.White : 存檔_bt.ForeColor = Color.Black
  316. 查閱文件_bt.BackColor = Color.White : 查閱文件_bt.ForeColor = Color.Black : 列印_bt.BackColor = Color.White : 列印_bt.ForeColor = Color.Black
  317. 合約_dgv.EnableHeadersVisualStyles = True : 合約_dgv.BackgroundColor = Color.White : 合約_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  318. 合約_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
  319. 合約_dgv.DefaultCellStyle.BackColor = Color.White : 合約_dgv.DefaultCellStyle.ForeColor = Color.Black
  320. Else
  321. Me.BackColor = Color.Black : Label2.BackColor = Color.Black : Label11.BackColor = Color.Black : Label16.BackColor = Color.Black
  322. Label7.ForeColor = Color.White : Label11.ForeColor = Color.White : Label2.ForeColor = Color.White : Label16.ForeColor = Color.White
  323. Label372.ForeColor = Color.LightPink : Label375.ForeColor = Color.LightPink : Label378.ForeColor = Color.LightPink
  324. Label13.ForeColor = Color.LightBlue : Label14.ForeColor = Color.LightBlue : Label9.ForeColor = Color.LightBlue : Label12.ForeColor = Color.LightBlue
  325. Label1.ForeColor = Color.LightBlue : Label3.ForeColor = Color.LightBlue : Label17.ForeColor = Color.LightBlue : Label18.ForeColor = Color.LightBlue
  326. Label4.ForeColor = Color.LightBlue : Label5.ForeColor = Color.LightBlue : Label6.ForeColor = Color.LightBlue : Label8.ForeColor = Color.LightBlue
  327. Label15.ForeColor = Color.LightBlue
  328. 關鍵字搜尋_tb.BackColor = Color.DimGray : 關鍵字搜尋_tb.ForeColor = Color.White : 合約編號_tb.BackColor = Color.DimGray : 合約編號_tb.ForeColor = Color.White
  329. 客戶名稱_tb.BackColor = Color.DimGray : 客戶名稱_tb.ForeColor = Color.White : 工程名稱_中_tb.BackColor = Color.DimGray : 工程名稱_中_tb.ForeColor = Color.White
  330. 工程名稱_英_tb.BackColor = Color.DimGray : 工程名稱_英_tb.ForeColor = Color.White
  331. 合約編號1_cb.BackColor = Color.DimGray : 合約編號1_cb.ForeColor = Color.LightBlue : 保固_cb.BackColor = Color.DimGray : 保固_cb.ForeColor = Color.LightBlue
  332. 保固1_cb.BackColor = Color.DimGray : 保固1_cb.ForeColor = Color.LightBlue : 保固地址_tb.BackColor = Color.DimGray : 保固地址_tb.ForeColor = Color.LightBlue
  333. 語轉扭_bt.BackColor = Color.DimGray : 語轉扭_bt.ForeColor = Color.White : 查詢_bt.BackColor = Color.DimGray : 查詢_bt.ForeColor = Color.White
  334. 縮放2_bt.BackColor = Color.DimGray : 縮放2_bt.ForeColor = Color.White : 存檔_bt.BackColor = Color.DimGray : 存檔_bt.ForeColor = Color.White
  335. 查閱文件_bt.BackColor = Color.DimGray : 查閱文件_bt.ForeColor = Color.White : 列印_bt.BackColor = Color.DimGray : 列印_bt.ForeColor = Color.White
  336. 合約_dgv.EnableHeadersVisualStyles = False : 合約_dgv.BackgroundColor = Color.DimGray : 合約_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  337. 合約_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 合約_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  338. 合約_dgv.DefaultCellStyle.BackColor = Color.Black : 合約_dgv.DefaultCellStyle.ForeColor = Color.White
  339. End If
  340. End Sub
  341. End Class