Imports System.IO Public Class 簽名檔管理 Dim EDR As Integer = 0 : Dim ESTR As String Private Sub Set_清單() Dim ds As New DataSet DataGridView1.DataSource = Nothing : ds.Clear() DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing DataGridView1.ColumnHeadersHeight = 25 DataGridView1.AllowUserToAddRows = False SQL_簽名檔管理_簽名檔清單() da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close() DataGridView1.Columns(0).FillWeight = 221 : DataGridView1.Columns(1).FillWeight = 220 End Sub Private Sub ComboBox1下拉表單資料載入() SQL_簽名檔管理_取得職稱() : 簽名檔持有人_cb.Items.Clear() : While (dr.Read()) : 簽名檔持有人_cb.Items.Add(dr("姓名")) : End While End Sub Private Sub 載入系統語言() If 系統語言 = "繁體中文" Then 表頭(87) = "圖檔編碼" : 表頭(162) = "簽名檔人名" : 檔案名稱_lb.Text = "檔案名稱" : 簽名檔持有人_lb.Text = "簽名檔持有人" : 圖檔編號_lb.Text = "圖檔編號" Me.Text = "簽名檔管理" Else 表頭(87) = "Pengkodean gambar" : 表頭(162) = "Nama file tanda tangan" 檔案名稱_lb.Text = "Nama file" : 簽名檔持有人_lb.Text = "Pemegang file tanda tangan" : 圖檔編號_lb.Text = "Pengkodean gambar" Me.Text = "Manajemen file tanda tangan" End If End Sub Private Sub 簽名檔管理_Load(sender As Object, e As EventArgs) Handles MyBase.Load 介面 = "H711" : 載入系統語言() : Set_清單() End Sub Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick If e.RowIndex = -1 Then : Else 圖檔編號_tb.Text = DataGridView1(0, e.RowIndex).Value.ToString : 簽名檔持有人_cb.Text = DataGridView1(1, e.RowIndex).Value.ToString SQL_簽名檔管理_取得簽名檔圖檔() While dr.Read() = True Dim unused As Byte() = New Byte(-1) {} Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte()) Dim oStream As New MemoryStream(bytes) PictureBox1.Image = Bitmap.FromStream(oStream) End While PictureBox1.SizeMode = 4 End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles 簽名檔入系統_bt.Click SQL_簽名檔管理_取得圖表編號() If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("圖片流水號").ToString, 8)) : Else : EDR = 0 : End If conn.Close() : EDR += 1 : ESTR = "PG" & CStr(EDR).PadLeft(8, "0") 'If EDR < 10 Then : ESTR = "PG" & "0000000" & EDR 'ElseIf EDR > 9 And EDR < 100 Then : ESTR = "PG" & "000000" & EDR 'ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "PG" & "00000" & EDR 'ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "PG" & "0000" & EDR 'ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "PG" & "000" & EDR 'ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "PG" & "00" & EDR 'ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "PG" & "0" & EDR 'ElseIf EDR > 9999999 Then : ESTR = "PG" & EDR 'End If 圖檔編號_tb.Text = ESTR If TextBox4.Text = "" Or 簽名檔持有人_cb.Text = "" Then If 系統語言 = "繁體中文" Then : MsgBox("請先確定圖片資料已準備完畢!!") : Else : MsgBox("Pastikan data gambar sudah siap!!") : End If Else PA49 = TextBox4.Text : SQL_簽名檔管理_簽名檔入系統() SQL_簽名檔管理_取得簽名檔圖檔() While dr.Read() = True Dim unused As Byte() = New Byte(-1) {} Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte()) Dim oStream As New MemoryStream(bytes) PictureBox1.Image = Bitmap.FromStream(oStream) End While PictureBox1.SizeMode = 4 : Set_清單() : 圖檔編號_tb.Text = "" : TextBox4.Text = "" End If End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles 刪除簽名檔_bt.Click If 圖檔編號_tb.Text = "" Then : Else Dim SS As String If 系統語言 = "繁體中文" Then : SS = "確定要刪除該筆資料?" : Else : SS = "Anda yakin ingin menghapus data ini?" : End If Dim aa As MsgBoxResult = MsgBox(SS, MsgBoxStyle.OkCancel) If aa = MsgBoxResult.Ok Then : SQL_簽名檔管理_刪除簽名檔() : Set_清單() : 圖檔編號_tb.Text = "" : End If End If End Sub Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click If 系統語言 = "繁體中文" Then : 系統語言 = "Ind" : Else : 系統語言 = "繁體中文" : End If : 介面 = "H711" : 載入系統語言() : Set_清單() End Sub Private Sub 選擇檔案_bt_Click(sender As Object, e As EventArgs) Handles 選擇檔案_bt.Click Dim fileDialog As New OpenFileDialog With { .Filter = "Image Files|*.jpg;*.png|All Files|*.*", .FilterIndex = 0, .RestoreDirectory = True } If 系統語言 = "繁體中文" Then : fileDialog.Title = "選擇檔案" : Else : fileDialog.Title = "Pilih file" : End If If fileDialog.ShowDialog = DialogResult.OK Then : TextBox4.Text = fileDialog.FileName : End If End Sub Private Sub 選擇檔案_bt_MouseEnter(sender As Object, e As EventArgs) Handles 選擇檔案_bt.MouseEnter ToolTip1.SetToolTip(Me.選擇檔案_bt, "選擇檔案") End Sub Private Sub 簽名檔入系統_bt_MouseEnter(sender As Object, e As EventArgs) Handles 簽名檔入系統_bt.MouseEnter ToolTip1.SetToolTip(Me.簽名檔入系統_bt, "簽名檔入系統") End Sub Private Sub 刪除簽名檔_bt_MouseEnter(sender As Object, e As EventArgs) Handles 刪除簽名檔_bt.MouseEnter ToolTip1.SetToolTip(Me.刪除簽名檔_bt, "刪除簽名檔") End Sub End Class