 |
|
รบกวนสอบถามเรื่อง code VB.NET เกี่ยวกับคำสั่ง print ค่ะ |
|
 |
|
|
 |
 |
|
ขอรบกวนด้วยค่ะ คือต้องการทราบว่าจะต้องเขียนคำสั่งยังไงเพื่อให้โปรแกรมปริ๊นเอกสาร เป็นสองสำเนาอ่ะค่ะ ขอบคุณมากค่ะ
Code (VB.NET)
Private Sub StringToPrint_Print(ByVal sender As Object, ByVal e As PrintPageEventArgs)
Dim Today As Date
Today = Date.Now
AnyString(e.Graphics, txtSearchCustomer.Text, 145, 149)
AnyString(e.Graphics, txtFullName.Text, 145, 199)
AnyString(e.Graphics, txtAddress.Text, 145, 220)
AnyString(e.Graphics, Today.ToLongDateString(), 578, 74)
AnyString(e.Graphics, lblCashInThai.Text, 187, 977)
AnyString(e.Graphics, cboProduct.Text, 146, 168)
AnyString(e.Graphics, cboTel.Text, 550, 168)
Dim i As Integer = 0
Dim CurrentYPosition As Integer = 322
Dim strColumn1 As String = ""
Dim strColumn2 As String = ""
Dim strColumn3 As Integer = 0
Dim strColumn4 As Integer = 0
Dim strColumn7 As Integer = 0
For i = 0 To lsvProductList.Items.Count - 1
strColumn1 = lsvProductList.Items(i).SubItems(0).Text
strColumn2 = lsvProductList.Items(i).SubItems(1).Text
strColumn3 = CInt(lsvProductList.Items(i).SubItems(2).Text)
strColumn4 = CInt(lsvProductList.Items(i).SubItems(3).Text)
strColumn7 = CInt(lsvProductList.Items(i).SubItems(6).Text)
AnyString(e.Graphics, strColumn1, 75, CurrentYPosition)
AnyString(e.Graphics, strColumn2, 145, CurrentYPosition)
AnyString(e.Graphics, strColumn3.ToString("#,##0"), 564, CurrentYPosition)
AnyString(e.Graphics, strColumn4.ToString("#,##0"), 618, CurrentYPosition)
AnyString(e.Graphics, strColumn7.ToString("#,##0"), 672, CurrentYPosition)
CurrentYPosition = CurrentYPosition + 20
Next
AnyString(e.Graphics, lblNet.Text, 675, 977)
End Sub
Private Sub AnyString(ByVal g As Graphics, ByVal printString As String, ByVal xPos As Integer, ByVal yPos As Integer)
Dim anyPoint As New PointF(xPos, yPos)
g.DrawString(printString, UseFont, Brushes.Black, anyPoint)
End Sub
Tag : .NET, VB.NET, VS 2008 (.NET 3.x)
|
|
 |
 |
 |
 |
Date :
2010-09-15 12:40:56 |
By :
create |
View :
8391 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ปกติงานฟอร์มหรือพิมพ์เอกสารจะใช้ report writer ทำเอาค่ะ จะ crystal report ,active report ,telerik report
หรือ report service ไม่เคยเขียนผ่าน GDI แบบนี้ค่ะ ดูแล้ว report writer จะง่ายกว่ามั้งคะ
หรือ อาจารย์กำหนดมาแบบนี้ ถ้างั้นคุณก้อเขียนสองครั้ง ครั้งที่ สอง ก้อเติมคำว่าสำเนาตามลงได้ดิคะ
|
 |
 |
 |
 |
Date :
2010-09-16 03:05:18 |
By :
blurEyes |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณค่ะ คุณ Stupid gurl ได้เรียบร้อยแล้วค่ะ
|
 |
 |
 |
 |
Date :
2010-09-16 12:51:05 |
By :
create |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Stupid gurl อธิบายโค็ด ข้างบนที่ครับ พอดีจะทำปริ๊นออก มาแบบนี่ ช่วยที่นะคำไม่รู้โค็ดปริ๊น ว่าจำทำหน้าเดียว
|
 |
 |
 |
 |
Date :
2016-04-20 15:02:34 |
By :
toppkkub |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้ามันฟ้อง AnyString สีแดงๆมันเป็นอะไรหรอค้าบ ดูๆแล้วเลงง ฮ่าๆ
Code (VB.NET)
|
 |
 |
 |
 |
Date :
2017-12-05 15:58:02 |
By :
มารุต |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|