TAILIEUCHUNG - Visual Basic 2005 Design and Development - Chapter 20

Printing Mặc dù nhiều người cố gắng làm cho các văn phòng của họ là không cần giấy tờ nhất có thể, in ấn một số là không thể tránh khỏi. Cho dù bạn in tài liệu để đọc trong khi bạn đang đi từ máy tính của bạn, để đưa vào báo cáo in, hoặc để gửi cho khách hàng, cuối cùng có thể bạn sẽ cần in một cái gì đó. Trong vài năm qua, in ấn đã đi từ một quá trình tẻ nhạt (nhưng trực quan) trong Visual Basic 6 để một quá trình tẻ nhạt. | 9n Printing Although many people try to make their offices as paperless as possible some printing is inevitable. Whether you print documents to read while you are away from your computer to put in printed reports or to mail to customers eventually you will probably need to print something. Over the past few years printing has gone from a tedious but intuitive process in Visual Basic 6 to a tedious and non-intuitive process in Visual Basic .NET. Visual Basic 6 used a procedural model for printing. You used the Printer object s properties and methods to generate output. You would call methods to write text draw graphics and generate new pages. Visual Basic .NET takes an event-driven approach. Here you start the printing process and then wait for events. A PrintDocument object raises events and asks you to generate the document s pages. The event handler includes a Graphics object and you use its properties and methods to draw whatever output you want to print. I find this approach rather unnatural so I also devised a technique that uses metafiles to implement a more intuitive procedural approach. This method lets you draw the entire printout all at once rather than responding to events. It even lets you go back and modify earlier pages after you have drawn those that come later. For example it lets you add page numbers of the form Page 1 of 10 even if you don t know how many pages there are until after you have generated them. This chapter describes Visual Basic .NET s basic event-driven model. It then explains the metafilebased more intuitive procedural approach. Part IV Specific Techniques Event-Driven Printing The basic idea behind event-driven printing is to create a PrintDocument object and tell it to start printing. Then you respond to the object s events to generate the pages of printout as the object needs them. The following list describes the object s key events BeginPrint This event occurs when the PrintDocument object is about to start printing the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.