Hour 5. Building FormsPart I

   

Hour 5. Building Forms ”Part I

With few exceptions, forms are the cornerstone of every Windows application's interface. Forms are essentially windows and the two terms are often used interchangeably. More accurately, "window" refers to what's seen by the user and what the user interacts with, whereas "form" refers to what you see when you design. Forms let users view and enter information in a program (such as the form you built in your Picture Viewer program in Hour 1, "A C# Programming Tour"). Such information may be text, pictures, graphs ”almost anything that can be viewed onscreen. Understanding how to design forms correctly will enable you to begin creating solid interface foundations for your programs.

graphics/bookpencil.gif

C# uses a new forms engine called Windows Forms.

Think of a form as a canvas on which you build your program's interface. On this canvas, you can print text, draw shapes , and place controls with which users can interact. The wonderful thing about C# forms is that they behave like a dynamic canvas; not only can you adjust the appearance of a form by manipulating what's on it, you can also manipulate specific properties of the form itself.

In previous hours, you manipulated the following form appearance properties:

  • Text

  • Height

  • Left

  • Top

  • Width

The capability to tailor your forms, however, goes far beyond these simple manipulations.

There is so much to cover about Windows Forms that I've broken the material into two hours. In this hour, you'll learn the very basics of forms ”adding them to a project, manipulating their properties, and showing and hiding them using C# code. Although you've done some of these things in previous hours, here you'll learn the nuts and bolts of the tasks you've performed. In the following hour, you'll learn more advanced form techniques.

The highlights of this hour include the following:

  • Changing the name of a form

  • Changing the appearance of a form

  • Displaying text on a form's title bar

  • Adding an image to a form's background

  • Giving a form an icon

  • Preventing a form from appearing in the taskbar

  • Specifying the initial display position of a form

  • Displaying a form in a normal, maximized, or minimized state

  • Changing the mouse pointer

  • Showing and hiding forms


   
Top


Sams Teach Yourself C# in 24 Hours
Sams Teach Yourself Visual Basic 2010 in 24 Hours Complete Starter Kit (Sams Teach Yourself -- Hours)
ISBN: 0672331136
EAN: 2147483647
Year: 2002
Pages: 253
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net