사용자가 단추를 클릭하면 내 VB.Net Windows.Form
의 이미지를 인쇄해야합니다. 이 작업을 수행하는 좋은 방법이 있습니까?양식을 어떻게 인쇄합니까?
-1
A
답변
6
PrintForm
구성 요소를 사용해야합니다. How to: Print a Form by Using the PrintForm Component를 참조하십시오
을 PrintForm 구성 요소는 빨리가하는 PrintDocument 구성 요소를 사용하지 않고 화면 에 표시된대로 정확하게 형태 의 이미지를 인쇄 할 수 있습니다. 다음 절차 은 양식을 프린터로 인쇄하는 방법, 을 인쇄 미리보기 창, 캡슐화 된 포스트 스크립트 파일로 보여줍니다.
0
양식의 스냅 샷을 원한다면 화면 캡처를 시뮬레이트해야합니다. 도움이 될 sample입니다. 꽤 못 생겨서 PDF 또는 보고서 빌더를 사용하여 보고서를 작성하는 것이 좋습니다.
0
3
당신이
Imports System.Drawing.Printing
Public Class Form1
Dim WithEvents mPrintDocument As New PrintDocument
Dim mPrintBitMap As Bitmap
Private Sub m_PrintDocument_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles mPrintDocument.PrintPage
' Draw the image centered.
Dim lWidth As Integer = e.MarginBounds.X + (e.MarginBounds.Width - mPrintBitMap.Width) \ 2
Dim lHeight As Integer = e.MarginBounds.Y + (e.MarginBounds.Height - mPrintBitMap.Height) \ 2
e.Graphics.DrawImage(mPrintBitMap, lWidth, lheight)
' There's only one page.
e.HasMorePages = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Copy the form's image into a bitmap.
mPrintBitMap = New Bitmap(Me.Width, Me.Width)
Dim lRect As System.Drawing.Rectangle
lRect.Width = Me.Width
lRect.Height = Me.Width
Me.DrawToBitmap(mPrintBitMap, lRect)
' Make a PrintDocument and print.
mPrintDocument = New PrintDocument
mPrintDocument.Print()
End Sub
End Class
+0
이것은 좋지만 용지 크기를 고려하지 않았습니다. – jcaruso
관련 문제
- 1. R의 stderr에 어떻게 인쇄합니까?
- 2. DTrace 액션에서 CFStringRef를 어떻게 인쇄합니까?
- 3. WPF : 가로 모드에서 어떻게 인쇄합니까?
- 4. 'printf'와 함께 '%'문자를 어떻게 인쇄합니까?
- 5. GDB에서 #define 상수를 어떻게 인쇄합니까?
- 6. 제한된 수의 문자는 어떻게 인쇄합니까?
- 7. dtrace에서 연관 배열을 어떻게 인쇄합니까?
- 8. 어떻게 CIF에서 itf 바코드를 인쇄합니까?
- 9. drupal에서 하나의 주석을 어떻게 인쇄합니까?
- 10. Magento에서 모든 검색어를 어떻게 인쇄합니까?
- 11. 재생할 음표 수를 어떻게 인쇄합니까?
- 12. JAMA 행렬의 열을 어떻게 인쇄합니까?
- 13. TreeMap의 모든 값을 어떻게 인쇄합니까?
- 14. 응용 프로그램의 경로는 어떻게 인쇄합니까?
- 15. Xcode의 디버거 콘솔에 개체의 속성을 어떻게 인쇄합니까?
- 16. preg_match에서 단어를 포함하는 행을 어떻게 인쇄합니까?
- 17. 창문 제목에 초당 프레임 수를 어떻게 인쇄합니까?
- 18. 모든 Java 컴파일러 출력을 어떻게 인쇄합니까?
- 19. string 유형의 typedef 항목을 어떻게 인쇄합니까?
- 20. UChar * var를 gdb 내부의 문자열로 어떻게 인쇄합니까?
- 21. 대체 작업에서 대체 된 내용은 어떻게 인쇄합니까?
- 22. Mechanized가 저장 한 쿠키를 어떻게 인쇄합니까?
- 23. mongdb ruby 드라이버에서 JSON을 어떻게 인쇄합니까?
- 24. CGContextShowTextAtpoint()에서 NSArray 객체의 값을 어떻게 인쇄합니까?
- 25. SML로 case 문 내부에서 어떻게 인쇄합니까?
- 26. 값이 제공되면 범위의 배열 값을 어떻게 인쇄합니까?
- 27. 포스트 스크립트에서는 여러 페이지에 어떻게 인쇄합니까? 어떻게해야합니까?
- 28. 어떻게 C#으로 프린터에 문자열을 인쇄합니까?
- 29. UTF-8 문자를 어떻게 인쇄합니까? C++?
- 30. 어떻게 텍스트를 검색 한 다음 결과를 인쇄합니까?
가 새 구성 요소를 Theres는합니다 (Button1을 클릭에) 다음 코드는 비트 맵을 캡처하고 프린터로 전송합니다 이미지를 수정하십시오. –
허, 잘 몰라. 멋지다, tnx. :) – jvenema