Setting properties of Windows Form object PDF Print E-mail

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.

  1.  
  2. using System;
  3. using System.Windows.Forms;
  4. class TextProp : Form {
  5. public static void Main() {
  6. Application.Run( new TextProp() );
  7. }
  8. TextProp() {
  9. Text = "Hello World";
  10. }
  11. }
 

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.




Bookmark it...
Digg!Reddit!Del.icio.us!Google!Facebook!Slashdot!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!
 
< Prev   Next >
Joomla Template by Joomlashack
Joomla Templates by JoomlaShack Joomla Templates by Compass Design