Example #1
0
 // Print - draw the rule...
 public void Draw(PrintEngine engine, float yPos, Graphics graphics, Rectangle elementBounds)
 {
     // draw a line...
     Pen pen = new Pen(engine.PrintBrush, 1);
     graphics.DrawLine(pen, elementBounds.Left, yPos + 2,
                   elementBounds.Right, yPos + 2);
 }
Example #2
0
        public float CalculateHeight(PrintEngine engine, Graphics graphics)
        {
            // loop through the print height...
            float height = 0;
            foreach (IPrintPrimitive primitive in _printPrimitives)
            {
                // get the height...
                height += primitive.CalculateHeight(engine, graphics);
            }

            // return the height...
            return height;
        }
Example #3
0
        // Draw - draw the element on a graphics object...
        public void Draw(PrintEngine engine, float yPos, Graphics graphics, Rectangle pageBounds)
        {
            // where...
            float height = CalculateHeight(engine, graphics);
            Rectangle elementBounds = new Rectangle(pageBounds.Left, (int)yPos, pageBounds.Right - pageBounds.Left, (int)height);

            // now, tell the primitives to print themselves...
            foreach (IPrintPrimitive primitive in _printPrimitives)
            {
                // render it...
                primitive.Draw(engine, yPos, graphics, elementBounds);

                // move to the next line...
                yPos += primitive.CalculateHeight(engine, graphics);
            }
        }
Example #4
0
 // CalculateHeight - work out how tall the primitive is...
 public float CalculateHeight(PrintEngine engine, Graphics graphics)
 {
     // we're always five units tall...
     return 5;
 }
Example #5
0
 public void Draw(PrintEngine engine, float yPos, Graphics graphics, Rectangle elementBounds)
 {
     graphics.DrawImage(i, elementBounds.X, elementBounds.Y);
 }
Example #6
0
 public float CalculateHeight(PrintEngine engine, Graphics graphics)
 {
     return (i.Height / i.HorizontalResolution) * 100;
 }
Example #7
0
 // Print - draw the text...
 public void Draw(PrintEngine engine, float yPos, Graphics graphics, Rectangle elementBounds)
 {
     // draw it...
     graphics.DrawString(engine.ReplaceTokens(Text), engine.PrintFont,
     engine.PrintBrush, elementBounds.Left, yPos, new StringFormat());
 }
Example #8
0
 // CalculateHeight - work out how tall the primitive is...
 public float CalculateHeight(PrintEngine engine, Graphics graphics)
 {
     // return the height...
     return engine.PrintFont.GetHeight(graphics);
 }