DrawInBoundingBox() public méthode

public DrawInBoundingBox ( int top, int left, int bottom, int right ) : void
top int
left int
bottom int
right int
Résultat void
        static void Main(string[] args)
        {
            Console.WriteLine("***** Simple Interface Hierarchy *****");

            // Call from object level.
            Console.WriteLine("Using bitmap uses IAdvancedDrawable implements IDrawable");
            BitmapImage bitmap = new BitmapImage();

            bitmap.Draw();
            bitmap.DrawInBoundingBox(10, 10, 100, 150);
            bitmap.DrawUpsideDown();

            // Call as IDrawable
            Console.WriteLine("Using drawableItem = bitmap as IDrawable");
            IDrawable drawableItem = bitmap as IDrawable;

            drawableItem.Draw();

            // Call as IAdvancedDrawable
            Console.WriteLine("Using advancedDrawableItem = bitmap as IAdvancedDrawable");
            IAdvancedDrawable advancedDrawableItem = bitmap as IAdvancedDrawable;

            advancedDrawableItem.DrawUpsideDown();

            Console.ReadLine();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Simple Interface Hierarchy *****");

            // Call from object level.
            BitmapImage myBitmap = new BitmapImage();

            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            // Get IAdvancedDraw explicitly.
            if (myBitmap is IAdvancedDraw iAdvDraw)
            {
                iAdvDraw.DrawUpsideDown();
                Console.WriteLine($"Time to draw: {iAdvDraw.TimeToDraw()}");
            }

            //Always calls method on instance:
            Console.WriteLine("***** Calling Implemented TimeToDraw *****");
            Console.WriteLine($"Time to draw: {myBitmap.TimeToDraw()}");
            Console.WriteLine($"Time to draw: {((IDrawable) myBitmap).TimeToDraw()}");
            Console.WriteLine($"Time to draw: {((IAdvancedDraw) myBitmap).TimeToDraw()}");
            Console.ReadLine();
        }
Exemple #3
0
 static void Main(string[] args)
 {
     BitmapImage bi = new BitmapImage();
     bi.Draw();
     bi.DrawInBoundingBox(10, 10, 100, 150);
     bi.DrawUpsideDown();
     ReadLine();
 }
Exemple #4
0
        static void Main(string[] args)
        {
            BitmapImage bmp = new BitmapImage();

            bmp.Draw();
            bmp.DrawInBoundingBox(1, 1, 1, 1);
            bmp.DrawUpsideDown();

            Console.ReadLine();
        }
        static void Main(string[] args) {
            BitmapImage myBitmap = new BitmapImage();
            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw;
            if (iAdvDraw != null) {
                iAdvDraw.DrawUpsideDown();
            }

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("***** Simple Interface Hierarchy *****\n");

            BitmapImage myImage = new BitmapImage();
            myImage.Draw();
            myImage.DrawInBoundingBox(10, 10, 50, 100);
            myImage.DrawUpsideDown();

            IAdvancedDraw iAdvDraw;
            iAdvDraw = (IAdvancedDraw) myImage;
            iAdvDraw.DrawUpsideDown();

            Console.ReadLine();
        }
Exemple #7
0
        static void Main(string[] args)
        {
            BitmapImage bitmap = new BitmapImage();

            bitmap.Draw();
            bitmap.DrawInBoundingBox(1, 2, 3, 4);
            bitmap.DrawUpsideDown();

            IAdvanceDraw iAdvrDraw = bitmap as IAdvanceDraw;

            if (iAdvrDraw != null)
            {
                iAdvrDraw.DrawUpsideDown();
            }
            Console.Read();
        }
Exemple #8
0
        //Signed by Jelier
        static void Main(string[] args)
        {
            BitmapImage myBitmap = new BitmapImage();

            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw;

            if (iAdvDraw != null)
            {
                iAdvDraw.DrawUpsideDown();
            }
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("***** Simple Interface Hierarchy *****");

            // Call from object level
            BitmapImage myBitmap = new BitmapImage();
            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            // Get IAdvancedDraw explicitly
            IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw;
            if (iAdvDraw != null)
                iAdvDraw.DrawUpsideDown();

            Console.ReadKey();
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Console.WriteLine("****** Simple Interface Hierarchy ******");
            BitmapImage myBitmap = new BitmapImage();

            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw;

            if (iAdvDraw != null)
            {
                iAdvDraw.DrawUpsideDown();
            }

            Console.ReadLine();
        }
Exemple #11
0
        static void Main(string[] args)
        {
            Console.WriteLine("**** Interface hierarchy ****");
            BitmapImage myBitmap = new BitmapImage();

            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(100, 58, 39, 78);
            myBitmap.DrawUpsideDown();

            IAdvancedDraw iAdvanced = myBitmap as IAdvancedDraw;

            if (iAdvanced != null)
            {
                iAdvanced.DrawUpsideDown();
            }

            Console.ReadLine();
        }
Exemple #12
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Simple Interface Hierarchy *****");
            // Call from object level.
            BitmapImage myBitmap = new BitmapImage();

            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            // Get IAdvancedDraw explicitly.
            IAdvancedDraw iAdvDraw;

            iAdvDraw = (IAdvancedDraw)myBitmap;
            iAdvDraw.DrawUpsideDown();

            Console.ReadLine();
        }
Exemple #13
0
        static void Main(string[] args)
        {
            // Call from object level.
            BitmapImage myBitmap = new BitmapImage();

            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            // Get IAdvancedDraw explicitly.
            IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw;

            if (iAdvDraw != null)
            {
                iAdvDraw.DrawUpsideDown();
            }
            Console.ReadLine();
        }
Exemple #14
0
        static void Simples()
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("=> simple hierarchy");

            BitmapImage bitmap = new BitmapImage();

            bitmap.Draw();
            bitmap.DrawInBoundingBox(10, 10, 100, 150);
            bitmap.DrawUpsideDown();

            IAdvancedDraw ia = bitmap as IAdvancedDraw;

            if (ia != null)
            {
                ia.DrawUpsideDown();
            }
        }
        static void Main(string[] args)
        {
            // Вызвать на уровне объекта
            BitmapImage bitmap = new BitmapImage();

            bitmap.Draw();
            bitmap.DrawInBoundingBox(10, 10, 100, 150);
            bitmap.DrawUpsideDown();

            // Получить IAdvancedDraw явным образом
            IAdvancedDraw advancedDraw = bitmap as IAdvancedDraw;

            if (advancedDraw != null)
            {
                advancedDraw.DrawUpsideDown();
            }

            Console.ReadLine();
        }
Exemple #16
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Simple Interface Hierarchy *****\n");

            //make a call from the object level
            BitmapImage myBitmap = new BitmapImage();
            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            //get IAdvancedDraw explicitly
            IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw;//myBitmap qualifies
            //as an IAdvancedDraw bc it implements all its inherited members
            if (iAdvDraw != null)
            {
                iAdvDraw.DrawUpsideDown();
            }

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("***** Simple Interface Hierarchy *****");
            //Вызывть на уровне объекта
            BitmapImage myBitmap = new BitmapImage();

            myBitmap.Draw();
            myBitmap.DrawInBoundingBox(10, 10, 100, 150);
            myBitmap.DrawUpsideDown();

            //Получить IAdvancedDraw явным образом
            IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw;

            if (iAdvDraw != null)
            {
                iAdvDraw.DrawUpsideDown();
            }

            Console.ReadLine();
        }
Exemple #18
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Simple interface hierarchy *****\n");


            // Call from object level!
            BitmapImage myBitMap = new BitmapImage();

            myBitMap.Draw();
            myBitMap.DrawInBoundingBox(10, 10, 100, 150);
            myBitMap.DrawUpsideDown();

            // Get IAdvancedDraw explicitly.
            IAdvancedDraw iAdvDraw = myBitMap as IAdvancedDraw;

            if (iAdvDraw != null)
            {
                iAdvDraw.DrawUpsideDown();
            }

            Console.ReadLine();
        }