123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- Option Strict Off
- Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
- Imports Microsoft.Office.Interop.Excel.Constants
- 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 ds6 As New DataSet
- Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
- Dim 放大, 簽回檔 As Boolean : Dim 選擇項 As Integer
- Private Sub Set_合約清單()
- 合約_dgv.DataSource = Nothing : ds6.Clear()
- 合約_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 合約_dgv.ColumnHeadersHeight = 40 : 合約_dgv.AllowUserToAddRows = False
- PA46 = 合約編號1_cb.Text : PA47 = 工程期1_ch.Text : PA = 關鍵字搜尋_tb.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).Visible = False : 合約_dgv.Columns(25).Visible = False : 合約_dgv.Columns(26).Visible = False : 合約_dgv.Columns(27).Visible = False
- 合約_dgv.Columns(28).Visible = False : 合約_dgv.Columns(29).FillWeight = 50 : 合約_dgv.Columns(30).Visible = False : 合約_dgv.Columns(31).Visible = False
- 合約_dgv.Columns(32).FillWeight = 100 : 合約_dgv.Columns(33).FillWeight = 50 : 合約_dgv.Columns(34).Visible = False : 合約_dgv.Columns("工程名稱_中").FillWeight = 300
- 合約_dgv.Columns("簽回").FillWeight = 40 : 合約_dgv.Columns("簽回檔圖庫").Visible = False
- 合約_dgv.Columns(29).DefaultCellStyle.Format = "#,##0" : 合約_dgv.Columns(29).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- 合約_dgv.Columns(33).DefaultCellStyle.Format = "#,##0" : 合約_dgv.Columns(33).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- For i As Integer = 0 To 合約_dgv.Rows.Count - 1
- If IsDBNull(合約_dgv("簽回", i).Value) = True Then : 合約_dgv("簽回", i).Value = False : End If
- Next
- If 放大 = True Then
- 合約_dgv.Columns("工程名稱_中").Visible = True
- Else
- 合約_dgv.Columns("工程名稱_中").Visible = False
- End If
- 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-122-" & 語言) : ToolTip1.ToolTipTitle = 系統語言字典("G000-108-" & 語言)
- Label7.Text = 系統語言字典("H104-106-" & 語言) : Label11.Text = 系統語言字典("H110-118-" & 語言) : Label2.Text = 系統語言字典("H501-144-" & 語言)
- Label372.Text = 系統語言字典("H112-100-" & 語言) : Label375.Text = 系統語言字典("G000-215-" & 語言) : Label378.Text = 系統語言字典("G000-216-" & 語言)
- 表頭(1) = 系統語言字典("G000-156-" & 語言) : 表頭(2) = 系統語言字典("G000-237-" & 語言) : 表頭(3) = 系統語言字典("H114-123-" & 語言)
- 表頭(4) = 系統語言字典("H110-130-" & 語言) : 表頭(5) = 系統語言字典("H110-132-" & 語言) : 表頭(6) = 系統語言字典("H112-118-" & 語言)
- End Sub
- Private Sub 合約保固書_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- 風格() : H(111) = True : 介面 = "H111" : 語言轉換讀取() : 顯示說明(999, False)
- 甲方條件下拉清單讀取() : Set_合約清單() : 合約報價單_Siz()
- End Sub
- Private Sub 合約保固書_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
- If 待辦進入 <> "" Then : lastFoundRowIndex = -1 : lastFoundColIndex = -1
- 關鍵字搜尋_tb.Text = 待辦進入 : 查詢DGV中的關鍵字_自動(合約_dgv, 關鍵字搜尋_tb) : 選擇項 = lastFoundRowIndex : 合約資料讀取()
- lastFoundRowIndex = -1 : lastFoundColIndex = -1 : 關鍵字搜尋_tb.Text = "" : 待辦進入 = ""
- End If
- 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 合約報價單_Siz()
- MyMod.清單字體大小調整()
- 合約_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
- End Sub
- Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
- 介面 = "H111" : 語言轉換讀取()
- End Sub
- Private Sub 合約_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約_dgv.CellClick
- If e.RowIndex = -1 Then : Else : 選擇項 = e.RowIndex : 合約資料讀取() : End If
- End Sub
- Private Sub 合約資料讀取()
- If 選擇項 <> -1 Then
- If 放大 = True Then : 縮放2_bt.PerformClick() : End If
- 圖片庫 = 合約_dgv("簽回檔圖庫", 選擇項).Value.ToString : 簽回檔 = 合約_dgv("簽回", 選擇項).Value
- 客戶名稱_tb.Text = 合約_dgv("客戶名稱", 選擇項).Value.ToString : 合約編號_tb.Text = 合約_dgv("合約編號", 選擇項).Value.ToString
- 工程名稱_中_tb.Text = 合約_dgv("工程名稱_中", 選擇項).Value.ToString : 工程名稱_英_tb.Text = 合約_dgv("工程名稱_英", 選擇項).Value.ToString
- 保固_cb.Text = 合約_dgv("保固期限", 選擇項).Value.ToString : 驗收完成_dtp.Value = 合約_dgv("驗收完成日期", 選擇項).Value.ToString
- If 合約_dgv("保固地址", 選擇項).Value.ToString <> "" Then : 保固地址_tb.Text = 合約_dgv("保固地址", 選擇項).Value.ToString : Else
- 保固地址_tb.Text = "Jl . kawasan Industri Terpadu Indonesia China (KITIC) Kav . 42 , Nagasari , Serang Baru , Kabupaten Bekasi 17330( I )"
- End If
- End If
- End Sub
- Private Sub 合約編號1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 合約編號1_cb.SelectedIndexChanged
- PA = 關鍵字搜尋_tb.Text : Set_合約清單()
- End Sub
- Private Sub 工程期1_ch_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程期1_ch.SelectedIndexChanged
- PA = 關鍵字搜尋_tb.Text : Set_合約清單()
- End Sub
- Private Sub 查閱文件_bt_Click(sender As Object, e As EventArgs) Handles 查閱文件_bt.Click
- If 合約編號_tb.Text = "" Then : MGB(系統語言字典("H110-111-" & 語言), 1) : Else
- If 簽回檔 = False Then
- MGB(系統語言字典("H106-111-" & 語言), 1)
- Else
- PA1 = 合約編號_tb.Text : PA2 = "保固" : 文件查閱視窗.ShowDialog()
- End If
- End If
- End Sub
- Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
- PA = 關鍵字搜尋_tb.Text : Set_合約清單()
- End Sub
- Private Sub 保固_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 保固_cb.SelectedIndexChanged
- 保固1_cb.SelectedIndex = 保固_cb.SelectedIndex
- If 保固_cb.Text <> "" Then : 保固完成_dtp.Value = 驗收完成_dtp.Value.AddMonths(CInt(保固_cb.Text)) : End If
- End Sub
- Private Sub 驗收完成_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 驗收完成_dtp.ValueChanged
- 保固完成_dtp.Value = 驗收完成_dtp.Value.AddMonths(CInt(保固_cb.Text))
- End Sub
- Private Sub 縮放2_bt_Click(sender As Object, e As EventArgs) Handles 縮放2_bt.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 : 合約_dgv.Columns("工程名稱_中").Visible = False
- Else
- 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True : 合約_dgv.Columns("工程名稱_中").Visible = True
- End If
- End Sub
- Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
- PA = 合約編號_tb.Text : PA1 = 保固_cb.Text : PA2 = 保固地址_tb.Text : SQL_控制表_保固修改()
- MGB(系統語言字典("G000-119-" & 語言), 1) : PA = "" : Set_合約清單()
- End Sub
- Private Sub 列印_bt_MouseEnter(sender As Object, e As EventArgs) Handles 列印_bt.MouseEnter
- ToolTip1.SetToolTip(Me.列印_bt, 系統語言字典("G000-114-" & 語言))
- End Sub
- Private Sub 查閱文件_bt_MouseEnter(sender As Object, e As EventArgs) Handles 查閱文件_bt.MouseEnter
- ToolTip1.SetToolTip(Me.查閱文件_bt, 系統語言字典("H110-113-" & 語言))
- End Sub
- Private Sub 存檔_bt_MouseEnter(sender As Object, e As EventArgs) Handles 存檔_bt.MouseEnter
- ToolTip1.SetToolTip(Me.存檔_bt, 系統語言字典("G000-110-" & 語言))
- End Sub
- Private Sub 查詢_bt_MouseEnter(sender As Object, e As EventArgs) Handles 查詢_bt.MouseEnter
- ToolTip1.SetToolTip(Me.查詢_bt, 系統語言字典("G000-113-" & 語言))
- End Sub
- Private Sub 縮放2_bt_MouseEnter(sender As Object, e As EventArgs) Handles 縮放2_bt.MouseEnter
- ToolTip1.SetToolTip(Me.縮放2_bt, 系統語言字典("G000-198-" & 語言))
- End Sub
- Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
- If 合約編號_tb.Text = "" Then : MGB(系統語言字典("H104-112-" & 語言), 1) : Else
- PA = 合約編號_tb.Text : PA1 = 保固_cb.Text : PA2 = 保固地址_tb.Text : SQL_控制表_保固修改()
- '----------------------------------------------------------------------------------------------------------------------
- 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()
-
- Dim BF As String
- If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : BF = "PT HONG XHE INDUSTRIAL" : Else : BF = "PT PUNCAK GEMILANG SEMESTA" : End If
- xlSheet.Cells(2, 1) = "保 固 證 書" : xlSheet.Cells(3, 1) = "Warranty Certificate" : xlSheet.Cells(5, 1) = "工程名稱 : " & 工程名稱_中_tb.Text
- xlSheet.Cells(6, 1) = "Project Name : " & 工程名稱_英_tb.Text : xlSheet.Cells(8, 1) = "合約編號 :" & 合約編號_tb.Text
- xlSheet.Cells(9, 1) = "Contract Number : " & 合約編號_tb.Text : xlSheet.Cells(11, 1) = "保固期間 :自驗收合格日起保固 " & 保固_cb.Text & " 個月。"
- xlSheet.Cells(12, 1) = "Maintenance Period : Warranty for " & 保固1_cb.Text & " months from the date of acceptance."
- xlSheet.Cells(13, 2) = "(從 " & Strings.Format(驗收完成_dtp.Value, "yyyy/MM/dd") & " 到 " & Strings.Format(保固完成_dtp.Value, "yyyy/MM/dd") & ")"
- xlSheet.Cells(14, 2) = "(From " & Strings.Format(驗收完成_dtp.Value, "yyyy/MM/dd") & " To " & Strings.Format(保固完成_dtp.Value, "yyyy/MM/dd") & ")"
- xlSheet.Cells(16, 1) = "本公司保證於保固期間內,產品若有故障或狀況不良之情形,願負免費檢查並維修至完好狀態之責.惟屬天災,不可抗力或人為操作不當所造成之損壞,不在本公司保固範圍。"
- 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."
- xlSheet.Cells(19, 1) = "此致" : xlSheet.Cells(20, 1) = "Yours sincerely," : xlSheet.Cells(22, 1) = 客戶名稱_tb.Text : xlSheet.Cells(22, 3) = BF
- xlSheet.Cells(24, 1) = "負責人姓名: (蓋章)" : xlSheet.Cells(24, 3) = "負責人姓名: (蓋章)" : xlSheet.Cells(26, 1) = "Address :" & 保固地址_tb.Text
-
- AA(xlApp, xlSheet)
- If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet)
- '-------------轉換成PDF---------------------------------------------------------------------
- Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
- xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & 合約編號_tb.Text & "保固證書.pdf", XlFixedFormatQuality.xlQualityStandard, True)
- '-------------關閉EXCEL---------------------------------------------------------------------
- xlSheet.PageSetup.PrintArea = "" : 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 & "\" & 合約編號_tb.Text & "保固證書.pdf"
- If IsChromeInstalled() Then
- Try
- Dim chromeProcess As New Process()
- chromeProcess.StartInfo.FileName = "chrome"
- chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """"
- chromeProcess.Start() : MGB(系統語言字典("H508-121-" & 語言), 1)
- Catch ex As Exception
- MGB(系統語言字典("H508-121-" & 語言), 1)
- End Try
- Else
- Try
- System.Diagnostics.Process.Start("""" & pdfFilePath & """") : MGB(系統語言字典("H508-121-" & 語言), 1)
- Catch ex As Exception
- MGB(系統語言字典("H508-121-" & 語言), 1)
- End Try
- 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.Columns("A:C").Select : myExcel.Selection.ColumnWidth = 43
- xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95
- xlSheet.Rows("2:3").Select
- 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.Rows("2:3").Select : myExcel.Selection.RowHeight = 35
- xlSheet.Range("A2:C2").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("A3:C3").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- myExcel.Selection.Font.Underline = xlUnderlineStyleSingle
- xlSheet.Rows("4:15").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("16:16").Select : myExcel.Selection.RowHeight = 50
- 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 : myExcel.Selection.Merge
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- 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 = 60
- xlSheet.Range("A17:C17").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .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 = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- 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("18:20").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("21:21").Select : myExcel.Selection.RowHeight = 50
- xlSheet.Rows("23:23").Select : myExcel.Selection.RowHeight = 140 : xlSheet.Rows("26:26").Select : myExcel.Selection.RowHeight = 35
- xlSheet.Range("A26:C26").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .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 = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Range("E6").Select() : myExcel.ActiveWindow.DisplayGridlines = False
- 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(合約編號_tb.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 = SystemColors.Control : Label2.BackColor = SystemColors.Control : Label11.BackColor = SystemColors.Control
- Label16.BackColor = SystemColors.Control
-
- Label7.ForeColor = Color.Black : Label11.ForeColor = Color.Black : Label2.ForeColor = Color.Black : Label16.ForeColor = Color.Black
- Label372.ForeColor = Color.FromArgb(192, 0, 0) : Label375.ForeColor = Color.FromArgb(192, 0, 0) : Label378.ForeColor = Color.FromArgb(192, 0, 0)
- Label13.ForeColor = Color.Blue : Label14.ForeColor = Color.Blue : Label9.ForeColor = Color.Blue : Label12.ForeColor = Color.Blue
- Label1.ForeColor = Color.Blue : Label3.ForeColor = Color.Blue : Label17.ForeColor = Color.Blue : Label18.ForeColor = Color.Blue
- Label4.ForeColor = Color.Blue : Label5.ForeColor = Color.Blue : Label6.ForeColor = Color.Blue : Label8.ForeColor = Color.Blue
- Label15.ForeColor = Color.Blue
-
- 關鍵字搜尋_tb.BackColor = Color.White : 關鍵字搜尋_tb.ForeColor = Color.Black : 合約編號_tb.BackColor = Color.White : 合約編號_tb.ForeColor = Color.Black
- 客戶名稱_tb.BackColor = Color.White : 客戶名稱_tb.ForeColor = Color.Black : 工程名稱_中_tb.BackColor = Color.White : 工程名稱_中_tb.ForeColor = Color.Black
- 工程名稱_英_tb.BackColor = Color.White : 工程名稱_英_tb.ForeColor = Color.Black
- 合約編號1_cb.BackColor = Color.White : 合約編號1_cb.ForeColor = Color.Blue : 保固_cb.BackColor = Color.White : 保固_cb.ForeColor = Color.Blue
- 保固1_cb.BackColor = Color.White : 保固1_cb.ForeColor = Color.Blue : 保固地址_tb.BackColor = Color.White : 保固地址_tb.ForeColor = Color.Blue
-
- 語轉扭_bt.BackColor = Color.White : 語轉扭_bt.ForeColor = Color.Black : 查詢_bt.BackColor = Color.White : 查詢_bt.ForeColor = Color.Black
- 縮放2_bt.BackColor = Color.White : 縮放2_bt.ForeColor = Color.Black : 存檔_bt.BackColor = Color.White : 存檔_bt.ForeColor = Color.Black
- 查閱文件_bt.BackColor = Color.White : 查閱文件_bt.ForeColor = Color.Black : 列印_bt.BackColor = Color.White : 列印_bt.ForeColor = Color.Black
-
- 合約_dgv.EnableHeadersVisualStyles = True : 合約_dgv.BackgroundColor = Color.White : 合約_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
- 合約_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
- 合約_dgv.DefaultCellStyle.BackColor = Color.White : 合約_dgv.DefaultCellStyle.ForeColor = Color.Black
- Else
- Me.BackColor = Color.Black : Label2.BackColor = Color.Black : Label11.BackColor = Color.Black : Label16.BackColor = Color.Black
-
- Label7.ForeColor = Color.White : Label11.ForeColor = Color.White : Label2.ForeColor = Color.White : Label16.ForeColor = Color.White
- Label372.ForeColor = Color.LightPink : Label375.ForeColor = Color.LightPink : Label378.ForeColor = Color.LightPink
- Label13.ForeColor = Color.LightBlue : Label14.ForeColor = Color.LightBlue : Label9.ForeColor = Color.LightBlue : Label12.ForeColor = Color.LightBlue
- Label1.ForeColor = Color.LightBlue : Label3.ForeColor = Color.LightBlue : Label17.ForeColor = Color.LightBlue : Label18.ForeColor = Color.LightBlue
- Label4.ForeColor = Color.LightBlue : Label5.ForeColor = Color.LightBlue : Label6.ForeColor = Color.LightBlue : Label8.ForeColor = Color.LightBlue
- Label15.ForeColor = Color.LightBlue
-
- 關鍵字搜尋_tb.BackColor = Color.DimGray : 關鍵字搜尋_tb.ForeColor = Color.White : 合約編號_tb.BackColor = Color.DimGray : 合約編號_tb.ForeColor = Color.White
- 客戶名稱_tb.BackColor = Color.DimGray : 客戶名稱_tb.ForeColor = Color.White : 工程名稱_中_tb.BackColor = Color.DimGray : 工程名稱_中_tb.ForeColor = Color.White
- 工程名稱_英_tb.BackColor = Color.DimGray : 工程名稱_英_tb.ForeColor = Color.White
- 合約編號1_cb.BackColor = Color.DimGray : 合約編號1_cb.ForeColor = Color.LightBlue : 保固_cb.BackColor = Color.DimGray : 保固_cb.ForeColor = Color.LightBlue
- 保固1_cb.BackColor = Color.DimGray : 保固1_cb.ForeColor = Color.LightBlue : 保固地址_tb.BackColor = Color.DimGray : 保固地址_tb.ForeColor = Color.LightBlue
-
- 語轉扭_bt.BackColor = Color.DimGray : 語轉扭_bt.ForeColor = Color.White : 查詢_bt.BackColor = Color.DimGray : 查詢_bt.ForeColor = Color.White
- 縮放2_bt.BackColor = Color.DimGray : 縮放2_bt.ForeColor = Color.White : 存檔_bt.BackColor = Color.DimGray : 存檔_bt.ForeColor = Color.White
- 查閱文件_bt.BackColor = Color.DimGray : 查閱文件_bt.ForeColor = Color.White : 列印_bt.BackColor = Color.DimGray : 列印_bt.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.Black : 合約_dgv.DefaultCellStyle.ForeColor = Color.White
- End If
- End Sub
- End Class
|