home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Estructuras básicas / FormSize / FormSize.cs next >
Encoding:
Text File  |  2002-05-02  |  1.7 KB  |  46 lines

  1. //---------------------------------------
  2. // FormSize.cs ⌐ 2001 by Charles Petzold
  3. //---------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class FormSize: Form
  9. {
  10.      public static void Main()
  11.      {
  12.           Application.Run(new FormSize());
  13.      }
  14.      public FormSize()
  15.      {
  16.           Text = "Tama±o del formulario";
  17.           BackColor = Color.White;
  18.      }
  19.      protected override void OnMove(EventArgs ea)
  20.      {
  21.           Invalidate();
  22.      }
  23.      protected override void OnResize(EventArgs ea)
  24.      {
  25.           Invalidate();
  26.      }
  27.      protected override void OnPaint(PaintEventArgs pea)
  28.      {
  29.           Graphics grfx = pea.Graphics;
  30.           string   str  = "Location: "        + Location        + "\n"   +
  31.                           "Size: "            + Size            + "\n"   +
  32.                           "Bounds: "          + Bounds          + "\n"   +
  33.                           "Width: "           + Width           + "\n"   +
  34.                           "Height: "          + Height          + "\n"   +
  35.                           "Left: "            + Left            + "\n"   +
  36.                           "Top: "             + Top             + "\n"   +
  37.                           "Right: "           + Right           + "\n"   +
  38.                           "Bottom: "          + Bottom          + "\n\n" +
  39.                           "DesktopLocation: " + DesktopLocation + "\n"   +
  40.                           "DesktopBounds: "   + DesktopBounds   + "\n\n" +
  41.                           "ClientSize: "      + ClientSize      + "\n"   +
  42.                           "ClientRectangle: " + ClientRectangle;
  43.  
  44.           grfx.DrawString(str, Font, Brushes.Black, 0, 0);
  45.     }
  46. }