Csharp/CSharp Tutorial/2D/Rectangle

Материал из .Net Framework эксперт
Версия от 15:18, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Rectangle contains a point

<source lang="csharp">using System; using System.Drawing; class MainClass {

 public static int Main(string[] args)
 {
   Rectangle r1 = new Rectangle(0, 0, 100, 100);
   Point pt3 = new Point(101, 101);
   if(r1.Contains(pt3))
     Console.WriteLine("Point is within the rect!");
   else
     Console.WriteLine("Point is not within the rect!");
 
   return 0;
 }

}</source>

Point is not within the rect!