diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs
index 273dc43..195c16e 100644
--- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs
+++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
+using System.Drawing.Printing;
using System.Linq;
using System.Windows.Forms;
@@ -167,10 +168,18 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
private void metroButton_Certificate_Click(object sender, EventArgs e)
{
- var allCount = dataGridView_List.SelectedRows.Count;
- if (allCount == 0) return;
+ //var allCount = dataGridView_List.SelectedRows.Count;
+ //if (allCount == 0) return;
// TODO: 증명서 인쇄
// PRINT
+
+ Print print = new Print();
+ PrintDocument printDocument = new PrintDocument();
+ printDocument.PrintPage += new PrintPageEventHandler(print.PrintPage);
+
+ PrintPreviewDialog printPreviewDialog = new PrintPreviewDialog();
+ printPreviewDialog.Document = printDocument;
+ printPreviewDialog.ShowDialog();
}
}
}
\ No newline at end of file
diff --git a/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj b/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj
index 6a50906..821a24e 100644
--- a/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj
+++ b/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj
@@ -162,6 +162,7 @@
Master.cs
+
diff --git a/HSUCO_Cargo_Garage_Operation_Program/Print.cs b/HSUCO_Cargo_Garage_Operation_Program/Print.cs
new file mode 100644
index 0000000..6e07a77
--- /dev/null
+++ b/HSUCO_Cargo_Garage_Operation_Program/Print.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HSUCO_Cargo_Garage_Operation_Program
+{
+ internal class Print
+ {
+ public void PrintPage(object sender, PrintPageEventArgs e)
+ {
+ // 테두리?
+ e.Graphics.DrawRectangle(new Pen(Brushes.Black, 3), e.MarginBounds.Top, e.MarginBounds.Left, e.MarginBounds.Width, e.MarginBounds.Height);
+
+ string text = "화물차고지 사용신고확인서";
+ Font font = new Font("맑은 고딕", 30, FontStyle.Bold);
+
+ int totalWidth = (int)e.PageBounds.Width;
+ int totalHeight = (int)e.PageBounds.Height;
+
+
+ e.Graphics.DrawString("제 2023-01호", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 10, e.MarginBounds.Top + 10);
+
+ SizeF textSize = e.Graphics.MeasureString(text, font);
+ float textX = (totalWidth - textSize.Width) / 2;
+
+ e.Graphics.DrawString(text, font, Brushes.Black, textX, e.MarginBounds.Top + 150);
+
+ e.Graphics.DrawString("사용자 성명 : ", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 300);
+ e.Graphics.DrawString("주소 : ", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 350);
+ e.Graphics.DrawString("차량번호 : ", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 400);
+ e.Graphics.DrawString("사용기한 : 2023-01-01 ~ 2023-12-31", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 450);
+
+ e.Graphics.DrawString("내용", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 500);
+
+ text = "2023년 01월 01일";
+ font = new Font("맑은 고딕", 15);
+ textSize = e.Graphics.MeasureString(text, font);
+ textX = (totalWidth - textSize.Width) / 2;
+ e.Graphics.DrawString(text, font, Brushes.Black, textX, e.MarginBounds.Top + 700);
+
+ text = "화성도시공사 화물차주차장 담당자";
+ font = new Font("맑은 고딕", 20);
+ textSize = e.Graphics.MeasureString(text, font);
+ textX = (totalWidth - textSize.Width) / 2;
+ e.Graphics.DrawString("화성도시공사 화물차주차장 담당자", font, Brushes.Black, textX, e.MarginBounds.Top + 800);
+ }
+ }
+}