|
 |
|
คือผมมี Datagridview แล้วผมก็แทรก CheckBox เข้าไปในคอลั่มแรกของDatagridview ครับ คือผมอยากจะให้เวลาผมติ๊กถูกที่ Datagridview เลือกแล้วพอกดสั่ง Print ก็จะทำการปริ๊น |
|
 |
|
|
 |
 |
|
คือผมมี 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 :
1082 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แค่ความคิดผมเท่านั้นนะครับ ไม่รู้ว่าจะเป็นวิธีการแก้ที่ดีหรือเปล่า
เพิ่ม ตัวแปรซักตัวครับ เอาไว้เก็บ status ว่าต้องการปริ็นหรือไม่
ให้ 1 row แทน data 1 ตัวนะครับ
Code (C#)
class Data
{
public string RFINumber;
public Datetime Date_;
public string Time;
public bool PrintStatus; // สิ่งที่เพิ่มขึ้นมาใหม่
}
หลังจากนั้น เมื่อมีการกด checkbox ก็ให้มันมาเปลี่ยนค่าที่ PrintStatus ครับ
ถึงเวลาปริ๊น ก็มาไล่เชคค่าแต่ละตัวว่าตัวไหนต้องปริ๊นบ้าง
|
 |
 |
 |
 |
Date :
2013-05-07 18:30:49 |
By :
batiboy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|