Пример #1
0
        public override void Draw(PdfDisplayBox box)
        {
            //base.Draw (box);


            CGRect sourceRect = new CGRect(0, 0, 0, 0);
            CGRect topHalf;
            CGRect destRect;

            // Drag image.
            // ...........
            // Source rectangle.
            sourceRect.Size = PdfImage.Size;

            // Represent the top half of the page.
            topHalf = GetBoundsForBox(box);

            Utility.ColorWithHexColorValue("#ffffff", 1.0f).Set();
            NSGraphics.RectFill(topHalf);

            // Scale and center image within top half of page.
            destRect         = sourceRect;
            destRect.Height -= 120;
            destRect.Y      += 60;

            // Draw.
            //Console.WriteLine("left:{0},top:{1},width:{2},height:{3}",destRect.X,destRect.Y,destRect.Width,destRect.Height);
            PdfImage.DrawInRect(destRect, new CGRect(0, 0, 0, 0), NSCompositingOperation.SourceOver, 1.0f);


            // Draw name.
            // ...........
            destRect        = GetBoundsForBox(box);
            destRect.Y      = destRect.Height - 44.0f;
            destRect.Height = 34.0f;
            destRect.X      = 30.0f;
            destRect.Width -= 60.0f;

            // Draw label.
            NSStringAttributes attributes = new NSStringAttributes();

            attributes.Font = NSFont.SystemFontOfSize(11);
            Label.DrawInRect(destRect, attributes);

            // Draw name.
            // ...........
            destRect        = GetBoundsForBox(box);
            destRect.Y      = 10.0f;
            destRect.Height = 17.0f;
            destRect.X      = 30.0f;
            destRect.Width -= 60.0f;

            PageFooter.DrawInRect(destRect, attributes);
        }