// Print - draw the text... public void Draw(TouchPrintEngine engine, float yPos, Graphics graphics, Rectangle elementBounds) { // draw it...HeaderFont // graphics.DrawString(engine.ReplaceTokens(Text), engine.PrintFont, // engine.PrintBrush, elementBounds.Left, yPos, new StringFormat()); graphics.DrawString(engine.ReplaceTokens(Text), engine.BlackFont, engine.PrintBrush, 5, yPos, new StringFormat()); }
// Print - draw the rule... public void Draw(TouchPrintEngine engine, float yPos, Graphics graphics, Rectangle elementBounds) { // draw a line... // Pen pen = new Pen(engine.PrintBrush, 2); // pen.DashStyle = DashStyle.Dot; //Pen pen = new Pen() // graphics.DrawLine(pen, elementBounds.Left, yPos + 2, // elementBounds.Right, yPos + 2); // graphics.DrawLine(pen, 0, yPos + 2, // 300, yPos + 2); graphics.DrawString("***************************************************", engine.PrintFont, engine.PrintBrush, 0, yPos + 2); }
public float CalculateHeight(TouchPrintEngine engine, Graphics graphics) { // loop through the print height... float height = 0; foreach (ITouchPrintPrimitive primitive in _printPrimitives) { // get the height... height += primitive.CalculateHeight(engine, graphics); } // return the height... return(height); }
// Draw - draw the element on a graphics object... public void Draw(TouchPrintEngine 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 (ITouchPrintPrimitive primitive in _printPrimitives) { // render it... primitive.Draw(engine, yPos, graphics, elementBounds); // move to the next line... yPos += primitive.CalculateHeight(engine, graphics); } }
// CalculateHeight - work out how tall the primitive is... public float CalculateHeight(TouchPrintEngine engine, Graphics graphics) { // return the height... return(engine.InfoFont.GetHeight(graphics)); }
// CalculateHeight - work out how tall the primitive is... public float CalculateHeight(TouchPrintEngine engine, Graphics graphics) { // we're always five units tall... return(5); }