 |
|
คือผมมี Datagridview แล้วผมก็แทรก CheckBox เข้าไปในคอลั่มแรกของDatagridview ครับ คือผมอยากจะให้เวลาผมติ๊กถูกที่ Datagridview บรรทัดที่ผมเลือกแล้วพอกดสั่ง Print ก็จะทำการปริ๊นบรรทัดนั้นออกมาอะครับ ที่ผมทำได้มันเป็นการ Capture ส่วนของ Datagridview ทีมองเห็นเท่านั้นอะครับ รบกวนผู้รู้แนะนำทีนะครับ^^
อันนี้เป็นโค้ดปริ๊นครับ
Code (C#)
private void printDocument1_PrintPage_1(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Bitmap bm = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
dataGridView1.DrawToBitmap(bm, new Rectangle(0, 0, this.dataGridView1.Width, this.dataGridView1.Height));
e.Graphics.DrawImage(bm, 0, 0);
}
อันนี้เป็นรูปผลของโค้ดสั่งปริ๊นครับ

Tag : .NET, Ms SQL Server 2008, C#, VS 2010 (.NET 4.x)
|
|
 |
 |
 |
 |
Date :
2013-05-02 21:26:16 |
By :
watasin03 |
View :
1093 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |