Option Strict Off Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle Imports Microsoft.Office.Interop.Excel.Constants Imports Microsoft.Office.Interop.Excel.XlBordersIndex Imports Microsoft.Office.Interop.Excel.XlLineStyle Imports Microsoft.Office.Interop.Excel.XlBorderWeight Imports Microsoft.Office.Interop.Excel.XlThemeFont Imports Microsoft.Office.Interop.Excel.XlThemeColor Imports Microsoft.Office.Interop.Excel.XlWindowState Imports Microsoft.Office.Interop.Excel Public Class 附錄合約 ReadOnly ds8 As New DataSet Dim 放大 As Boolean Dim ESTR As String Dim EDR As Integer = 0 Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet Dim 對話框(7) As String Private Sub Set_合約清單() Dim ds6 As New DataSet : 合約_dgv.DataSource = Nothing : ds6.Clear() 合約_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 合約_dgv.ColumnHeadersHeight = 25 : 合約_dgv.AllowUserToAddRows = False PA46 = 合約編號1_cb.Text : PA47 = 工程期1_ch.Text SQL_合約清單() da.Fill(ds6) : 合約_dgv.DataSource = ds6.Tables(0) : conn.Close() 合約_dgv.Columns(0).FillWeight = 160 : 合約_dgv.Columns(1).Visible = False : 合約_dgv.Columns(2).Visible = False : 合約_dgv.Columns(3).Visible = False 合約_dgv.Columns(4).Visible = False : 合約_dgv.Columns(5).Visible = False : 合約_dgv.Columns(6).Visible = False : 合約_dgv.Columns(7).Visible = False 合約_dgv.Columns(8).Visible = False : 合約_dgv.Columns(9).Visible = False : 合約_dgv.Columns(10).Visible = False : 合約_dgv.Columns(11).Visible = False 合約_dgv.Columns(12).Visible = False : 合約_dgv.Columns(13).Visible = False : 合約_dgv.Columns(14).Visible = False : 合約_dgv.Columns(15).Visible = False 合約_dgv.Columns(16).Visible = False : 合約_dgv.Columns(17).Visible = False : 合約_dgv.Columns(18).Visible = False : 合約_dgv.Columns(19).Visible = False 合約_dgv.Columns(20).Visible = False : 合約_dgv.Columns(21).Visible = False : 合約_dgv.Columns(22).Visible = False : 合約_dgv.Columns(23).Visible = False 合約_dgv.Columns(24).FillWeight = 100 : 合約_dgv.Columns(25).Visible = False : 合約_dgv.Columns(26).Visible = False : 合約_dgv.Columns(27).Visible = False 合約_dgv.Columns(28).Visible = False : 合約_dgv.Columns("工程").FillWeight = 300 : 合約_dgv.Columns("Project").FillWeight = 300 合約_dgv.Columns(0).ReadOnly = True : 合約_dgv.Columns("工程").ReadOnly = True : 合約_dgv.Columns("Project").ReadOnly = True If 系統語言 = "繁體中文" Then If 放大 = True Then : 合約_dgv.Columns("工程").Visible = True : Else : 合約_dgv.Columns("工程").Visible = False : End If Else If 放大 = True Then : 合約_dgv.Columns("Project").Visible = True : Else : 合約_dgv.Columns("Project").Visible = False : End If End If End Sub Private Sub Set_附錄清單() Dim ds1 As New DataSet 合約附錄_dgv.DataSource = Nothing : ds1.Clear() 合約附錄_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 合約附錄_dgv.ColumnHeadersHeight = 25 : 合約附錄_dgv.AllowUserToAddRows = False SQL_附錄合約_清單查詢() da.Fill(ds1) : 合約附錄_dgv.DataSource = ds1.Tables(0) : conn.Close() 合約附錄_dgv.Columns(0).Visible = False : 合約附錄_dgv.Columns(1).FillWeight = 160 : 合約附錄_dgv.Columns(2).Visible = False : 合約附錄_dgv.Columns(3).Visible = False 合約附錄_dgv.Columns(4).Visible = False : 合約附錄_dgv.Columns(5).Visible = False : 合約附錄_dgv.Columns(6).Visible = False : 合約附錄_dgv.Columns(7).FillWeight = 70 End Sub Private Sub 甲方條件下拉清單讀取() SQL合約條件讀取() : 合約編號1_cb.Items.Clear() : 合約編號1_cb.Items.Add("") : While (dr.Read()) : 合約編號1_cb.Items.Add(dr("約號甲方")) : End While : conn.Close() End Sub Private Sub 語言轉換讀取() If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If Me.Text = 系統語言字典("H001-163-" & 語言) : ToolTip1.ToolTipTitle = 系統語言字典("G000-108-" & 語言) : 表頭(116) = 系統語言字典("G000-157-" & 語言) 表頭(134) = 系統語言字典("H501-152-" & 語言) : 表頭(99) = 系統語言字典("H104-100-" & 語言) : 表頭(179) = 系統語言字典("H307-106-" & 語言) 工程名稱_中_lb.Text = 系統語言字典("G000-215-" & 語言) : 工程名稱_英_lb.Text = 系統語言字典("G000-216-" & 語言) : 不列印金額_ch.Text = 系統語言字典("H104-101-" & 語言) 甲方_lb.Text = 系統語言字典("H110-118-" & 語言) : 立約日期_lb.Text = 系統語言字典("H104-102-" & 語言) : 合約附錄停用_ch.Text = 系統語言字典("H104-103-" & 語言) 合約編號_lb.Text = 系統語言字典("H506-160-" & 語言) : 其他內容_lb.Text = 系統語言字典("H104-104-" & 語言) : 附錄編號_lb.Text = 系統語言字典("H104-105-" & 語言) 客戶名稱_lb.Text = 系統語言字典("H112-100-" & 語言) : 搜尋_lb.Text = 系統語言字典("H104-106-" & 語言) : 原合约金额_lb.Text = 系統語言字典("H104-107-" & 語言) 追加减_lb.Text = 系統語言字典("H104-108-" & 語言) : 總金額_lb.Text = 系統語言字典("H104-109-" & 語言) : 對話框(0) = 系統語言字典("H110-111-" & 語言) 對話框(1) = 系統語言字典("H104-110-" & 語言) : 對話框(2) = 系統語言字典("H104-111-" & 語言) : 對話框(3) = 系統語言字典("G000-119-" & 語言) 對話框(4) = 系統語言字典("H104-112-" & 語言) : 對話框(5) = 系統語言字典("H104-113-" & 語言) : 對話框(6) = 系統語言字典("H104-114-" & 語言) 對話框(7) = 系統語言字典("H508-121-" & 語言) End Sub Private Sub 縮放2_rbt_MouseEnter(sender As Object, e As EventArgs) Handles 縮放2_rbt.MouseEnter ToolTip1.SetToolTip(Me.縮放2_rbt, 系統語言字典("G000-198-" & 語言)) End Sub Private Sub 查詢_rbt_MouseEnter(sender As Object, e As EventArgs) Handles 查詢_rbt.MouseEnter ToolTip1.SetToolTip(Me.查詢_rbt, 系統語言字典("G000-113-" & 語言)) End Sub Private Sub 新增資料_rbt_MouseEnter(sender As Object, e As EventArgs) Handles 新增資料_rbt.MouseEnter ToolTip1.SetToolTip(Me.新增資料_rbt, 系統語言字典("H104-115-" & 語言)) End Sub Private Sub 存檔_rbt_MouseEnter(sender As Object, e As EventArgs) Handles 存檔_rbt.MouseEnter ToolTip1.SetToolTip(Me.存檔_rbt, 系統語言字典("G000-110-" & 語言)) End Sub Private Sub 列印_rbt_MouseEnter(sender As Object, e As EventArgs) Handles 列印_rbt.MouseEnter ToolTip1.SetToolTip(Me.列印_rbt, 系統語言字典("G000-114-" & 語言)) End Sub Private Sub 刪除_rbt_MouseEnter(sender As Object, e As EventArgs) Handles 刪除_rbt.MouseEnter ToolTip1.SetToolTip(Me.刪除_rbt, 系統語言字典("G000-112-" & 語言)) End Sub Private Sub 附錄合約_Load(sender As Object, e As EventArgs) Handles MyBase.Load H(104) = True : 介面 = "H104" : 語言轉換讀取() : 風格() : 顯示說明(999, True) End Sub Private Sub 附錄合約_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown 甲方條件下拉清單讀取() : Set_合約清單() : Set_附錄清單() : 合約報價單_Siz() End Sub Private Sub 合約報價單_Siz() MyMod.清單字體大小調整() 合約_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) 合約附錄_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) End Sub Private Sub 附錄合約_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed H(104) = False End Sub Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click 介面 = "H104" : 語言轉換讀取() : Set_合約清單() : Set_附錄清單() End Sub Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True End Sub Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True End Sub Private Sub 合約_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約_dgv.CellClick If e.RowIndex = -1 Then : Else 客戶名稱_tb.Text = 合約_dgv("客戶名稱", e.RowIndex).Value.ToString : 合約編號_rtb.Text = 合約_dgv(表頭(134), e.RowIndex).Value.ToString 工程名稱_中_rtb.Text = 合約_dgv("工程", e.RowIndex).Value.ToString : 工程名稱_英_rtb.Text = 合約_dgv("Project", e.RowIndex).Value.ToString NUD3.Text = Strings.Format(CLng(合約_dgv("工程總價", e.RowIndex).Value), "#,##0") : NUD_2.Value = 0 : 其他內容_tb.Text = "" PA = 合約編號_rtb.Text : Set_附錄清單() : If 放大 = True Then : 縮放2_rbt.PerformClick() : End If End If End Sub Private Sub 合約附錄_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約附錄_dgv.CellClick NUD3.Text = Strings.Format(CLng(合約附錄_dgv("原金額", e.RowIndex).Value), "#,##0") 附錄編號_rtb.Text = 合約附錄_dgv(表頭(99), e.RowIndex).Value.ToString : 其他內容_tb.Text = 合約附錄_dgv("其他內容", e.RowIndex).Value.ToString 合約附錄停用_ch.Checked = 合約附錄_dgv(表頭(179), e.RowIndex).Value : NUD_2.Value = 合約附錄_dgv("追加減", e.RowIndex).Value.ToString End Sub Private Sub 合約編號1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 合約編號1_cb.SelectedIndexChanged Set_合約清單() End Sub Private Sub 合約編號1_cb_Click(sender As Object, e As EventArgs) Handles 合約編號1_cb.Click CB選擇清單(合約編號1_cb) End Sub Private Sub 工程期1_ch_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程期1_ch.SelectedIndexChanged Set_合約清單() End Sub Private Sub 查詢_rbt_Click(sender As Object, e As EventArgs) Handles 查詢_rbt.Click PA = 關鍵字搜尋_rtb.Text : Set_合約清單() End Sub Private Sub 新增資料_rbt_Click(sender As Object, e As EventArgs) Handles 新增資料_rbt.Click If 合約編號_rtb.Text = "" Then : MGB(對話框(0), 1) : Else SQL_附錄合約_最後一筆資料() If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("附錄編號").ToString, 9)) : Else : EDR = 0 : End If conn.Close() : EDR += 1 If EDR < 10 Then : ESTR = "HP" & "00000000" & EDR ElseIf EDR > 9 And EDR < 100 Then : ESTR = "HP" & "0000000" & EDR ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "HP" & "000000" & EDR ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "HP" & "00000" & EDR ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "HP" & "0000" & EDR ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "HP" & "000" & EDR ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "HP" & "00" & EDR ElseIf EDR > 9999999 And EDR < 10000000 Then : ESTR = "HP" & "0" & EDR ElseIf EDR > 99999999 Then : ESTR = "HP" & EDR : End If 附錄編號_rtb.Text = ESTR : NUD_2.Value = 0 : 其他內容_tb.Text = "" End If End Sub Private Sub 刪除_rbt_Click(sender As Object, e As EventArgs) Handles 刪除_rbt.Click If 合約編號_rtb.Text = "" Then : MGB(對話框(0), 1) : Else If 附錄編號_rtb.Text = "" Then : MGB(對話框(1), 1) : Else PA1 = 附錄編號_rtb.Text : SQL_附錄合約_刪除() : Set_附錄清單() : MGB(對話框(2), 1) End If End If End Sub Private Sub 存檔_rbt_Click(sender As Object, e As EventArgs) Handles 存檔_rbt.Click If 合約編號_rtb.Text = "" Then : MGB(對話框(0), 1) : Else If 附錄編號_rtb.Text = "" Then : MGB(對話框(1), 1) : Else PA = 合約編號_rtb.Text : PA1 = 附錄編號_rtb.Text : PA2 = Strings.Format(立約日期_dtp.Value, "yyyy/MM/dd") PA3 = Strings.Format(CLng(NUD3.Text), "#,##0") : PA4 = NUD_2.Value PA5 = Strings.Format(CLng(NUD1.Text), "#,##0") : PA6 = 其他內容_tb.Text : BL1 = 合約附錄停用_ch.Checked SQL_附錄合約_最後一筆資料1() : If dr.Read() Then : SQL_附錄合約_修改() : Else : SQL_附錄合約_新增() : End If : Set_附錄清單() MGB(對話框(3), 1) End If End If End Sub Private Sub NUD3_TextChanged(sender As Object, e As EventArgs) Handles NUD3.TextChanged NUD1.Text = Strings.Format(CLng(NUD3.Text) + NUD_2.Value) NUD3.Text = Strings.Format(CLng(NUD3.Text), "#,##0") End Sub Private Sub NUD_2_ValueChanged(sender As Object, e As EventArgs) Handles NUD_2.ValueChanged NUD1.Text = Strings.Format(CLng(NUD3.Text) + NUD_2.Value) End Sub Private Sub NUD1_TextChanged(sender As Object, e As EventArgs) Handles NUD1.TextChanged If NUD1.Text = "" Then : NUD1.Text = "0" : End If NUD1.Text = Strings.Format(CLng(NUD1.Text), "#,##0") End Sub Private Sub 縮放2_rbt_Click(sender As Object, e As EventArgs) Handles 縮放2_rbt.Click Dim NX, NY As Integer : NX = 合約_dgv.Size.Width : NY = 合約_dgv.Size.Height If 放大 = True Then 合約_dgv.Size = New System.Drawing.Point(NX - 400, NY) : 放大 = False If 系統語言 = "繁體中文" Then : 合約_dgv.Columns("工程").Visible = False : Else : 合約_dgv.Columns("Project").Visible = False : End If Else 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True If 系統語言 = "繁體中文" Then : 合約_dgv.Columns("工程").Visible = True : Else : 合約_dgv.Columns("Project").Visible = False : End If End If End Sub Private Sub 列印_rbt_Click(sender As Object, e As EventArgs) Handles 列印_rbt.Click If 合約編號_rtb.Text = "" Then : MGB(對話框(4), 1) : Else If 附錄編號_rtb.Text = "" Then : MGB(對話框(5), 1) : Else If 合約附錄停用_ch.Checked = True Then : MGB(對話框(6), 1) : Else xlApp = CType(CreateObject("Excel.Application"), Application) xlApp.Visible = True xlApp.DisplayAlerts = True xlApp.Application.WindowState = xlMaximized xlBook = xlApp.Workbooks.Add '---------------------------------------------------------------------------------------------------------------------- xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "合約附錄" xlBook.Activate() : xlSheet.Activate() xlSheet.Cells(2, 1) = "附錄合約" : xlSheet.Cells(3, 1) = "Appendix contract" : xlSheet.Cells(4, 1) = "編號(No) : " & 合約編號_rtb.Text xlSheet.Cells(5, 1) = 工程名稱_中_rtb.Text : xlSheet.Cells(6, 1) = 工程名稱_英_rtb.Text xlSheet.Cells(7, 1) = "日期(Date) : " & Strings.Format(立約日期_dtp.Value, "yyyy/MM/dd") Dim BF As String If Strings.Left(合約編號_rtb.Text, 2) = "HX" Then : BF = "PT HONG XHE INDUSTRIAL" : Else : BF = "PT PUNCAK GEMILANG SEMESTA" End If xlSheet.Cells(8, 1) = "根據 " & 合約編號_rtb.Text & " 號合同,雙方為A方 " & 客戶名稱_tb.Text & " 和B方 " & BF xlSheet.Cells(9, 1) = "According to the contract of " & 合約編號_rtb.Text & ", both parties are " & 客戶名稱_tb.Text & " of Party A and " & BF If 不列印金額_ch.Checked = False Then xlSheet.Cells(11, 1) = "雙方同意此 " & 合約編號_rtb.Text & " 號合同工程款变更为:" xlSheet.Cells(12, 1) = "The parties agree that the contract amount of this " & 合約編號_rtb.Text & " will be changed to: " xlSheet.Cells(13, 1) = "1、原合约金额(含税) :" & Strings.Format(CLng(NUD3.Text), "#,##0") & " RP" xlSheet.Cells(14, 1) = " Original contract amount (including tax): " & Strings.Format(CLng(NUD3.Text), "#,##0") & " RP" xlSheet.Cells(16, 1) = "2、追加/追减金额(含税) :" & Strings.Format(NUD_2.Value, "#,##0") & " RP" xlSheet.Cells(17, 1) = " Additional/reduction amount (including tax): " & Strings.Format(NUD_2.Value, "#,##0") & " RP" xlSheet.Cells(19, 1) = "3、结算总金額(含税) : " & Strings.Format(CLng(NUD1.Text), "#,##0") & " RP" xlSheet.Cells(20, 1) = " Total settlement amount (including tax): " & Strings.Format(CLng(NUD1.Text), "#,##0") & " RP" xlSheet.Cells(22, 1) = 其他內容_tb.Text xlSheet.Cells(24, 1) = "此份附錄合同立成02份(中,英文版),A方執01份、B方執01份,在法律上均具同時等價值。 " xlSheet.Cells(25, 1) = "This appendix has a contract of 02 copies (in Chinese and English), with A party holding 01 copies and Party B holding 01 copies, which are legally equivalent" xlSheet.Cells(27, 1) = "Party A (A方)" : xlSheet.Cells(27, 3) = "Party B (B方)" Else xlSheet.Cells(11, 1) = 其他內容_tb.Text xlSheet.Cells(13, 1) = "此份附錄合同立成02份(中,英文版),A方執01份、B方執01份,在法律上均具同時等價值。 " xlSheet.Cells(14, 1) = "This appendix has a contract of 02 copies (in Chinese and English), with A party holding 01 copies and Party B holding 01 copies, which are legally equivalent" xlSheet.Cells(16, 1) = "Party A (A方)" : xlSheet.Cells(27, 3) = "Party B (B方)" End If AA(xlApp, xlSheet) If Strings.Left(合約編號_rtb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet) xlApp.Sheets(2).Delete : xlSheet.PageSetup.PrintArea = "" '-------------轉換成PDF--------------------------------------------------------------------- Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & 合約編號_rtb.Text & "附錄合約.pdf", XlFixedFormatQuality.xlQualityStandard, True) '-------------關閉EXCEL--------------------------------------------------------------------- xlApp.Cells.Select() : xlApp.Application.WindowState = xlMinimized xlBook.Close(False) Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet) Runtime.InteropServices.Marshal.ReleaseComObject(xlBook) Runtime.InteropServices.Marshal.ReleaseComObject(xlApp) xlApp.Quit() : xlSheet = Nothing : xlBook = Nothing : xlApp = Nothing : GC.Collect() '-------------開啟PDF--------------------------------------------------------------------- Dim pdfFilePath As String = SERT & "\" & 合約編號_rtb.Text & "附錄合約.pdf" If IsChromeInstalled() Then Try Dim chromeProcess As New Process() chromeProcess.StartInfo.FileName = "chrome" chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """" chromeProcess.Start() Catch ex As Exception End Try Else Try System.Diagnostics.Process.Start("""" & pdfFilePath & """") Catch ex As Exception End Try End If MGB(對話框(7), 1) End If End If End If End Sub ' 檢查系統是否已安裝 Google Chrome Private Function IsChromeInstalled() As Boolean Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") If key IsNot Nothing Then For Each subkeyName As String In key.GetSubKeyNames() Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey(subkeyName) Dim displayName As Object = subkey.GetValue("DisplayName") If displayName IsNot Nothing AndAlso displayName.ToString().Contains("Google Chrome") Then Return True End If Next End If Return False End Function Private Shared Function NewMethod(xlBook As Workbook) As Worksheet Return CType(xlBook.Worksheets.Add, Worksheet) End Function Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet) xlSheet.Cells.Select() With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95 xlSheet.Columns("A:C").Select : myExcel.Selection.ColumnWidth = 40 xlSheet.Range("A2:C2").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Range("A3:C3").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With myExcel.Selection.Font.Underline = xlUnderlineStyleSingle xlSheet.Range("A4:C4").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("A5:C5").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("A6:C6").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("A7:C7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A8:C8").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 45 xlSheet.Range("A9:C9").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 45 If 不列印金額_ch.Checked = False Then xlSheet.Range("A11:C11").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("11:11").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A12:C12").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("12:12").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A13:C13").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A14:C14").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A16:C16").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("16:16").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A17:C17").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("17:17").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A19:C19").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("19:19").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A20:C20").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("20:20").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A22:C22").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("22:22").Select : myExcel.Selection.RowHeight = 250 xlSheet.Range("A24:C24").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("24:24").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A25:C25").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("25:25").Select : myExcel.Selection.RowHeight = 35 xlSheet.Range("A27:C27").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Rows("28:28").Select : myExcel.Selection.RowHeight = 90 xlSheet.Range("A28").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("C28").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 8 : xlSheet.Rows("15:15").Select : myExcel.Selection.RowHeight = 8 xlSheet.Rows("18:18").Select : myExcel.Selection.RowHeight = 8 : xlSheet.Rows("21:21").Select : myExcel.Selection.RowHeight = 8 Else xlSheet.Range("A11:C11").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("11:11").Select : myExcel.Selection.RowHeight = 400 xlSheet.Range("A13:C13").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 15.75 xlSheet.Range("A14:C14").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 35 xlSheet.Range("A16:C16").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Rows("17:17").Select : myExcel.Selection.RowHeight = 90 xlSheet.Range("A17").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("C17").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone End If myExcel.ActiveWindow.DisplayGridlines = False xlSheet.Range("D1").Select() End Sub Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(PictureBox1.Image) xlSheet.Range("A1").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Height = 93 myExcel.Selection.ShapeRange.IncrementLeft(0) myExcel.Selection.ShapeRange.IncrementTop(0) End Sub Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(PictureBox2.Image) xlSheet.Range("A1").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Height = 93 myExcel.Selection.ShapeRange.IncrementLeft(0) myExcel.Selection.ShapeRange.IncrementTop(0) End Sub Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet) If Strings.Left(合約編號_rtb.Text, 2) = "HX" Then myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename = Str01 & "\HXBWLOG.png" Else myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename = Str01 & "\PGSBWLOG.png" End If myExcel.Application.PrintCommunication = False : With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" .CenterHeader = "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "&G" .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = "" .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945) .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992) .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126) .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = "" .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = "" End With : myExcel.Application.PrintCommunication = True End Sub Private Sub 風格() If 深色風格 = False Then Me.BackColor = Color.Linen 合約編號1_cb.BackColor = Color.White : 合約編號1_cb.ForeColor = Color.Black : 客戶名稱_tb.BackColor = Color.White : 客戶名稱_tb.ForeColor = Color.Black 其他內容_tb.BackColor = Color.LightCyan : 其他內容_tb.ForeColor = Color.Black : 關鍵字搜尋_rtb.BackColor = Color.Transparent : 關鍵字搜尋_rtb.ForeColor = Color.Black 附錄編號_rtb.BackColor = Color.Transparent : 附錄編號_rtb.ForeColor = Color.Black : 合約編號_rtb.BackColor = Color.Transparent : 合約編號_rtb.ForeColor = Color.Black 工程名稱_中_rtb.BackColor = Color.Transparent : 工程名稱_中_rtb.ForeColor = Color.Black : 工程名稱_英_rtb.BackColor = Color.Transparent : 工程名稱_英_rtb.ForeColor = Color.Black NUD3.BackColor = Color.White : NUD3.ForeColor = Color.Black : NUD_2.BackColor = Color.White : NUD_2.ForeColor = Color.Black NUD1.BackColor = Color.White : NUD1.ForeColor = Color.Black 搜尋_lb.ForeColor = Color.Black : 甲方_lb.ForeColor = Color.Black : 不列印金額_ch.ForeColor = Color.Black : 附錄編號_lb.ForeColor = Color.Black 合約編號_lb.ForeColor = Color.Black : 合約附錄停用_ch.ForeColor = Color.Black : Label8.ForeColor = Color.Black : Label6.ForeColor = Color.Black 其他內容_lb.ForeColor = Color.Black 立約日期_lb.ForeColor = Color.Green : 原合约金额_lb.ForeColor = Color.Green : 總金額_lb.ForeColor = Color.Green : 追加减_lb.ForeColor = Color.Green 工程名稱_中_lb.ForeColor = Color.Firebrick : 工程名稱_英_lb.ForeColor = Color.Firebrick : 客戶名稱_lb.ForeColor = Color.Firebrick 合約_dgv.EnableHeadersVisualStyles = True : 合約_dgv.BackgroundColor = Color.White : 合約_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black 合約_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightBlue ' Silver 合約_dgv.DefaultCellStyle.BackColor = Color.White : 合約_dgv.DefaultCellStyle.ForeColor = Color.Black 合約附錄_dgv.EnableHeadersVisualStyles = True : 合約附錄_dgv.BackgroundColor = Color.White : 合約_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black 合約附錄_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightBlue 合約附錄_dgv.DefaultCellStyle.BackColor = Color.White : 合約附錄_dgv.DefaultCellStyle.ForeColor = Color.Black Else Me.BackColor = Color.Black 合約編號1_cb.BackColor = Color.DimGray : 合約編號1_cb.ForeColor = Color.White : 客戶名稱_tb.BackColor = Color.DimGray : 客戶名稱_tb.ForeColor = Color.White 其他內容_tb.BackColor = Color.DimGray : 其他內容_tb.ForeColor = Color.White : 關鍵字搜尋_rtb.BackColor = Color.DimGray : 關鍵字搜尋_rtb.ForeColor = Color.White 附錄編號_rtb.BackColor = Color.DimGray : 附錄編號_rtb.ForeColor = Color.White : 合約編號_rtb.BackColor = Color.DimGray : 合約編號_rtb.ForeColor = Color.White 工程名稱_中_rtb.BackColor = Color.DimGray : 工程名稱_中_rtb.ForeColor = Color.White : 工程名稱_英_rtb.BackColor = Color.DimGray : 工程名稱_英_rtb.ForeColor = Color.White NUD3.BackColor = Color.DimGray : NUD3.ForeColor = Color.White : NUD_2.BackColor = Color.DimGray : NUD_2.ForeColor = Color.White NUD1.BackColor = Color.DimGray : NUD1.ForeColor = Color.White 搜尋_lb.ForeColor = Color.White : 甲方_lb.ForeColor = Color.White : 不列印金額_ch.ForeColor = Color.White : 附錄編號_lb.ForeColor = Color.White 合約編號_lb.ForeColor = Color.White : 合約附錄停用_ch.ForeColor = Color.White : Label8.ForeColor = Color.White : Label6.ForeColor = Color.White 其他內容_lb.ForeColor = Color.White 立約日期_lb.ForeColor = Color.GreenYellow : 原合约金额_lb.ForeColor = Color.GreenYellow : 總金額_lb.ForeColor = Color.GreenYellow : 追加减_lb.ForeColor = Color.GreenYellow 工程名稱_中_lb.ForeColor = Color.LightCoral : 工程名稱_英_lb.ForeColor = Color.LightCoral : 客戶名稱_lb.ForeColor = Color.LightCoral 合約_dgv.EnableHeadersVisualStyles = False : 合約_dgv.BackgroundColor = Color.DimGray : 合約_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White 合約_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 合約_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray 合約_dgv.DefaultCellStyle.BackColor = Color.DimGray : 合約_dgv.DefaultCellStyle.ForeColor = Color.White 合約附錄_dgv.EnableHeadersVisualStyles = False : 合約附錄_dgv.BackgroundColor = Color.DimGray : 合約附錄_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White 合約附錄_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 合約附錄_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray 合約附錄_dgv.DefaultCellStyle.BackColor = Color.DimGray : 合約附錄_dgv.DefaultCellStyle.ForeColor = Color.White End If End Sub End Class