/** * Gets the special field appearance for the radio circle. * @param on <CODE>true</CODE> for the checked state, <CODE>false</CODE> * otherwise * @return the appearance */ public PdfAppearance GetAppearanceRadioCircle(bool on) { PdfAppearance app = PdfAppearance.CreateAppearance(writer, box.Width, box.Height); switch (rotation) { case 90: app.SetMatrix(0, 1, -1, 0, box.Height, 0); break; case 180: app.SetMatrix(-1, 0, 0, -1, box.Width, box.Height); break; case 270: app.SetMatrix(0, -1, 1, 0, 0, box.Width); break; } Rectangle boxc = new Rectangle(app.BoundingBox); float cx = boxc.Width / 2; float cy = boxc.Height / 2; float r = (Math.Min(boxc.Width, boxc.Height) - borderWidth) / 2; if (r <= 0) { return(app); } if (backgroundColor != null) { app.SetColorFill(backgroundColor); app.Circle(cx, cy, r + borderWidth / 2); app.Fill(); } if (borderWidth > 0 && borderColor != null) { app.SetLineWidth(borderWidth); app.SetColorStroke(borderColor); app.Circle(cx, cy, r); app.Stroke(); } if (on) { if (textColor == null) { app.ResetGrayFill(); } else { app.SetColorFill(textColor); } app.Circle(cx, cy, r / 2); app.Fill(); } return(app); }