Using TimerCallback

   
 

using System;
using System.Threading;

class TimePrinter {
    static void PrintTime(object state) {
        Console.WriteLine("Time is: {0}, Param is: {1}", DateTime.Now.ToLongTimeString(), state.ToString());
    }
    static void Main(string[] args) {
        TimerCallback timeCB = new TimerCallback(PrintTime);

        Timer t = new Timer(
            timeCB,   // The TimerCallback delegate type.
            "Hi",     // Any info to pass into the called method.
            0,        // Amount of time to wait before starting.
            1000);    // Interval of time between calls. 
    }
}

    


Print all System Information

   
 


using System;
using System.Drawing;
using System.Windows.Forms;

class SysInfoStrings
{
     public static string[] Values
     {
          get 
          { 
              return new string[] 
              {
              SystemInformation.ArrangeDirection.ToString(),
              SystemInformation.ArrangeStartingPosition.ToString(),
              SystemInformation.BootMode.ToString(),
              SystemInformation.Border3DSize.ToString(),
              SystemInformation.BorderSize.ToString(),
              SystemInformation.CaptionButtonSize.ToString(),
              SystemInformation.CaptionHeight.ToString(),
              SystemInformation.ComputerName,
              SystemInformation.CursorSize.ToString(),
              SystemInformation.DbcsEnabled.ToString(),
              SystemInformation.DebugOS.ToString(),
              SystemInformation.DoubleClickSize.ToString(),
              SystemInformation.DoubleClickTime.ToString(),
              SystemInformation.DragFullWindows.ToString(),
              SystemInformation.DragSize.ToString(),
              SystemInformation.FixedFrameBorderSize.ToString(),
              SystemInformation.FrameBorderSize.ToString(),
              SystemInformation.HighContrast.ToString(),
              SystemInformation.HorizontalScrollBarArrowWidth.ToString(),
              SystemInformation.HorizontalScrollBarHeight.ToString(),
              SystemInformation.HorizontalScrollBarThumbWidth.ToString(),
              SystemInformation.IconSize.ToString(),
              SystemInformation.IconSpacingSize.ToString(),
              SystemInformation.KanjiWindowHeight.ToString(),
              SystemInformation.MaxWindowTrackSize.ToString(),
              SystemInformation.MenuButtonSize.ToString(),
              SystemInformation.MenuCheckSize.ToString(),
              SystemInformation.MenuFont.ToString(),
              SystemInformation.MenuHeight.ToString(),
              SystemInformation.MidEastEnabled.ToString(),
              SystemInformation.MinimizedWindowSize.ToString(),
              SystemInformation.MinimizedWindowSpacingSize.ToString(),
              SystemInformation.MinimumWindowSize.ToString(),
              SystemInformation.MinWindowTrackSize.ToString(),
              SystemInformation.MonitorCount.ToString(),
              SystemInformation.MonitorsSameDisplayFormat.ToString(),
              SystemInformation.MouseButtons.ToString(),
              SystemInformation.MouseButtonsSwapped.ToString(),
              SystemInformation.MousePresent.ToString(),
              SystemInformation.MouseWheelPresent.ToString(),
              SystemInformation.MouseWheelScrollLines.ToString(),
              SystemInformation.NativeMouseWheelSupport.ToString(),
              SystemInformation.Network.ToString(),
              SystemInformation.PenWindows.ToString(),
              SystemInformation.PrimaryMonitorMaximizedWindowSize.ToString(),
              SystemInformation.PrimaryMonitorSize.ToString(),
              SystemInformation.RightAlignedMenus.ToString(),
              SystemInformation.Secure.ToString(),
              SystemInformation.ShowSounds.ToString(),
              SystemInformation.SmallIconSize.ToString(),
              SystemInformation.ToolWindowCaptionButtonSize.ToString(),
              SystemInformation.ToolWindowCaptionHeight.ToString(),
              SystemInformation.UserDomainName,
              SystemInformation.UserInteractive.ToString(),
              SystemInformation.UserName,
              SystemInformation.VerticalScrollBarArrowHeight.ToString(),
              SystemInformation.VerticalScrollBarThumbHeight.ToString(),
              SystemInformation.VerticalScrollBarWidth.ToString(),
              SystemInformation.VirtualScreen.ToString(),
              SystemInformation.WorkingArea.ToString(),
              };
          }    
     }
}

    


SystemInformation.PrimaryMonitor

   
 

using System;
using System.Drawing;
using System.Windows.Forms;
   
class ScribbleWithBitmap: Form
{
     bool     bTracking;
     Point    ptLast;
     Bitmap   bitmap;
     Graphics grfxBm;
   
     public static void Main()
     {
          Application.Run(new ScribbleWithBitmap());
     }
     public ScribbleWithBitmap()
     {
          Text = "Scribble with Bitmap";
          Size size = SystemInformation.PrimaryMonitorMaximizedWindowSize;
          bitmap = new Bitmap(size.Width, size.Height);
   
          grfxBm = Graphics.FromImage(bitmap);
          grfxBm.Clear(BackColor);
     }
     protected override void OnMouseDown(MouseEventArgs mea)
     {
          if (mea.Button != MouseButtons.Left)
               return;
   
          ptLast = new Point(mea.X, mea.Y);
          bTracking = true;
     }
     protected override void OnMouseMove(MouseEventArgs mea)
     {
          if (!bTracking)
               return;
   
          Point ptNew = new Point(mea.X, mea.Y);
          
          Pen pen = new Pen(ForeColor);
          Graphics grfx = CreateGraphics();
          grfx.DrawLine(pen, ptLast, ptNew);
          grfx.Dispose();
   
          grfxBm.DrawLine(pen, ptLast, ptNew);
   
          ptLast = ptNew;
     }
     protected override void OnMouseUp(MouseEventArgs mea)
     {
          bTracking = false;
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          Graphics grfx = pea.Graphics;
          grfx.DrawImage(bitmap, 0, 0, bitmap.Width, bitmap.Height);
     }
}