home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Images and Bitmaps / PartialImageStretch / PartialImageStretch.cs next >
Encoding:
Text File  |  2001-01-15  |  865 b   |  30 lines

  1. //--------------------------------------------------
  2. // PartialImageStretch.cs ⌐ 2001 by Charles Petzold
  3. //--------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class PartialImageStretch: PrintableForm
  9. {
  10.      Image image;
  11.  
  12.      public new static void Main()
  13.      {
  14.           Application.Run(new PartialImageStretch());
  15.      }
  16.      public PartialImageStretch()
  17.      {
  18.           Text = "Partial Image Stretch";
  19.  
  20.           image = Image.FromFile("..\\..\\..\\Apollo11FullColor.jpg");
  21.      }
  22.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  23.      {
  24.           Rectangle rectSrc = new Rectangle(95, 5, 50, 55);
  25.           Rectangle rectDst = new Rectangle( 0, 0, cx, cy);
  26.  
  27.           grfx.DrawImage(image, rectDst, rectSrc, GraphicsUnit.Pixel);
  28.      }
  29. }
  30.