1. Trang chủ
  2. » Công Nghệ Thông Tin

Addison Wesley Windows Forms Programming In Visual Basic Dot NET Nov 2003 ISBN 0321125193

11 76 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 11
Dung lượng 259,51 KB

Nội dung

Where Are We? If Chapters 4, 5, and 6 haven't convinced you of NET's very rich support for drawing, then Chapter 7, on drawing to the printer, should do the trick Chapter 4 Drawing Basics As handy as forms are, especially when laden with controls, sometimes the built-in controls[1] aren't sufficient to render the state of your application In that case, you need to draw the state yourself The drawing may be to the screen, to a file, or to a printer, but wherever you're drawing to, you'll be dealing with the same primitivescolors, brushes, pens, and fontsand the same kinds of things to draw: shapes, images, and strings This chapter starts by examining the basics of drawing to the screen and the basic building blocks of drawing [1] The standard controls that come with WinForms are listed in Appendix D: Standard WinForms Components and Controls Note that all the drawing techniques discussed in this chapter and in the next two chapters relate equally as well to controls as they do to forms For information about building custom controls, see Chapter 8: Controls One more thing worth noting before we begin is that the System.Drawing namespace is implemented on top of GDI+ (Graphics Device Interface+), the successor to GDI The original GDI has been a mainstay in Windows since there was a Windows, providing an abstraction over screens and printers to make writing GUI-style applications easy.[2] GDI+ is a Win32 DLL (gdiplus.dll) that ships with Windows XP and is available for older versions of Windows GDI+ is also an unmanaged C++ class library that wraps gdiplus.dll Because the System.Drawing classes share many of the same names with the GDI+ C++ classes, you may very well stumble onto the unmanaged classes when looking for the NET classes in the online documentation The concepts are the same, but the coding details are very different between unmanaged C++ and managed anything else, so keep an eye out [2] GDI programming certainly isn't easy when compared with System.Drawing programming, but it's orders of magnitude easier than supporting printers and video display adapters by hand, which was what DOS programmers had to do to put bread on the table Chapter 5 Drawing Text Probably the most useful thing to draw in any application is text Sometimes you'll draw text yourself, and sometimes it will be drawn for you by the controls you're using No matter who does the drawing, you often can specify the font used to draw the text, and that's what the first part of this chapter is about The second part deals with drawing text yourself into a Graphics object or a GraphicsPath Chapter 6 Advanced Drawing Chapters 4 and 5 cover the basics of drawing, including colors, pens, brushes, shapes, paths, images, fonts, and string drawing This chapter takes a look at advanced topics such as page units, world transforms, regions, and optimization techniques And as if that weren't enough, Chapter 7 wraps up the tour of the System.Drawing namespace with a look at printing Chapter 7 Printing Usually, drawing to the screen is pretty easy because screen settings are generally constant during the run of the application Drawing to a printer, on the other hand, is more complicated because users may change the printer or the printer settings many times, even for a single document Similarly, paper costs money and can't be sent through the printer twice (unless you don't care what's on the back), so before users print their documents they want to see what they will look like The actual drawing is largely the same for a printer as it is for the screen, but the printer settings are the interesting part, and the settings are covered in this chapter Appendix D Standard WinForms Components and Controls Winforms provides several classes meant to be composed to build applications How (and whether) instances of these classes need to interact with the user determines whether they are components or controls The technical distinction isn't important unless you're building one (as covered in Chapter 8: Controls and Chapter 9: Design-Time Integration) What is important is knowing what's available out of the box for your use, as listed in Table D.1 This appendix briefly covers all these except for the print-related components, which are discussed in Chapter 7: Printing Table D.1 Standard WinForms Components and Controls Components Controls ColorDialog (page 286) Button (page 234) ContextMenu (page 286) CheckBox (page 236) ErrorProvider (page 286) CheckedListBox (page 237) FontDialog (page 286) ComboBox (page 237) HelpProvider (page 286) DataGrid (page 237) ImageList (page 286) DateTimePicker (page 236) MainMenu (page 286) DomainUpDown (page 237) OpenFileDialog (page 286) GroupBox (page 242) PageSetupDialog (Chapter 7: Printing) HScrollBox (page 236) PrintDialog (Chapter 7: Printing) Label (page 236) PrintDocument (Chapter 7: Printing) LinkLabel (page 236) PrintPreviewDialog (Chapter 7: Printing) ListBox (page 237) SaveFileDialog (page 286) ListView (page 237) Timer (page 286) MonthCalendar (page 236) ToolTip (page 286) NumericUpDown (page 236) Panel (page 242) PictureBox (page 236) PrintPreviewControl (page 236) ProgressBar (page 236) RadioButton (page 236) RichTextBox (page 236) Splitter (page 236) TextBox (page 236) StatusBar (page 236) TabControl (page 242) ToolBar (page 234) TrackBar (page 236) TreeView (page 237) VScrollBar (page 236) The WinForms documentation does a really good job of providing the details of each standard component and control This appendix is a quick look at each of them to give you an idea of what you have to choose from Chapter 8 Controls The basic unit of the ui in WinForms is the control Everything that interacts directly with the user in a region defined by a container is a control This includes controls that do everything themselves, as well as standard controls such as the TextBox, user controls (controls that contain other controls), and even the Form class itself This chapter covers the broad categories of the standard controls provided by WinForms It explains how to build custom and user controls and how to provide support for drag and drop, the most popular kind of intercontrol communication If you'd like a survey of the standard controls, refer to Appendix D: Standard WinForms Components and Controls Chapter 9 Design-Time Integration A component is a nonvisual class designed specifically to integrate with a design-time environment such as Visual Studio NET (VS.NET) WinForms provides several standard components, and NET lets you build your own, gaining a great deal of design-time integration with very little work On the other hand, with a bit more effort, you can integrate nonvisual components and controls very tightly into the designtime environment, providing a rich development experience for the programmer using your custom components and controls ... The original GDI has been a mainstay in Windows since there was a Windows, providing an abstraction over screens and printers to make writing GUI-style applications easy.[2] GDI+ is a Win32 DLL (gdiplus.dll) that ships with Windows XP and is available for... same kinds of things to draw: shapes, images, and strings This chapter starts by examining the basics of drawing to the screen and the basic building blocks of drawing [1] The standard controls that come with WinForms are listed in Appendix D: Standard WinForms... The basic unit of the ui in WinForms is the control Everything that interacts directly with the user in a region defined by a container is a control This includes controls that do everything

Ngày đăng: 26/03/2019, 17:13