|
Setting properties of Windows Form object |
|
|
|
|
An object of type System.Windows.Forms has many properties
(look in the documentation for a complete list). We can illustrate the use of
one of these properties by setting the Text property of the form which will
appear in the caption bar at the top of the form.
using System; using System.Windows.Forms; class TextProp : Form { public static void Main() { Application. Run( new TextProp () ); } TextProp() { Text = "Hello World"; } } -
We start as before but now, we write a constructor for our class and we assign
the string "Hello world" to the Text property of the class Form. Manipulating
other properties of the class Form can often be as simple as this example.
|