/// <summary> /// Draws the candidate on a PDF page. Includes box border, /// candidate name, arrow. Finally it updates [bottomY] and [rightX] /// that are internal variables to determine the extent of the /// candidates' area. /// </summary> /// <param name="cand">The candidate.</param> /// <externalUnit cref="Candidate"/> /// <externalUnit cref="PDFxFont"/> /// <externalUnit cref="RectangleF"/> /// <externalUnit cref="TargetLayout"/> /// <revision revisor="dev11" date="4/8/2009" version="1.0.10.0501"> /// Comments added /// </revision> protected override void DrawCandidate(Candidate cand) { RectangleF bounds = cand.Bounds; this.pdfPage.drawRect( bounds.Left, bounds.Top, bounds.Width, bounds.Height, false, true); PDFxFont font = this.GetFont(this.fntCand); this.pdfContext.setFont(font, this.fntCandSize); double cx = bounds.Left + bounds.Width / 2f, cy = bounds.Top + CellPadding + font.getYMax(this.fntCandSize); this.pdfPage.drawText( cx, cy, cand.Name, PDFxPanel.__Fields.ALIGN_CENTER); DrawTarget(cand); }
/// <summary> /// Positions the texts of a contest using a supplied coordinates /// for the top left corner of the contest header. /// </summary> /// <param name="contest">The contest.</param> /// <param name="x"> /// The left side of the contest header (in points) /// </param> /// <param name="y"> /// The top side of the contest header (in points) /// </param> /// <externalUnit cref="OfficeText"/> /// <externalUnit cref="PDFxFont"/> /// <externalUnit cref="PointF"/> /// <externalUnit cref="RectangleF"/> /// <revision revisor="dev11" date="3/10/2009" version="1.0."> /// Member Created /// </revision> protected override void PositionTexts(Contest contest, float x, float y) { List <OfficeText> texts = contest.Texts; float curY = y + CellPadding, cx = x + ColWidthContest / 2f; for (int i = 0; i < texts.Count; i = i + 1) { OfficeText text = texts[i]; PDFxFont font = GetFont(text.Font); double yMax = font.getYMax(text.FontSize), yMin = font.getYMin(text.FontSize); // negative value PointF point = new PointF(); point.X = cx; // relative to the page point.Y = Convert.ToSingle(curY + yMax); // relative to the page text.XYText = point; curY = curY + Convert.ToSingle(yMax - yMin); } }