Ejemplo n.º 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);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 5
0
 public void Draw(PrintEngine engine, float yPos, Graphics graphics, Rectangle elementBounds)
 {
     graphics.DrawImage(i, elementBounds.X, elementBounds.Y);
 }
Ejemplo n.º 6
0
 public float CalculateHeight(PrintEngine engine, Graphics graphics)
 {
     return (i.Height / i.HorizontalResolution) * 100;
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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);
 }