示例#1
0
        static void Main(string[] args)
        {
            BitMapImage btmi = new BitMapImage();

            //从对象级别调用
            btmi.Draw();
            btmi.DrawInBoundingBox(10, 10, 20, 120);
            btmi.DrawUpSideDown();

            //显示获取IAdvancedDraw
            IAdvancedDraw iAdvDraw = btmi as IAdvancedDraw;

            if (iAdvDraw != null)
            {
                iAdvDraw.DrawUpSideDown();
            }
            Console.ReadLine();
        }
示例#2
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, 10, 10);
            myBitmap.DrawUpSideDown();

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

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

            Console.ReadLine();
        }