Articles in this section
Category / Section

How to add the different check mark style in checkbox field in WinForms PDF ?

2 mins read

Check Box Field

We can create the check box field using PdfCheckBoxField Class.

Please refer the below code snippet for adding the check box field in new Pdf document.

C#

//Create a new PDF document.
PdfDocument document = new PdfDocument();
 
//Add a new page to PDF document.
PdfPage page = document.Pages.Add();
 
//Create Check Box field.
PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox");
 
//Set check box properties.
checkBoxField.ToolTip = "Check Box";
checkBoxField.Bounds = new RectangleF(0, 20, 10, 10);
 
//Add the form field to the document.
document.Form.Fields.Add(checkBoxField);

 

Checkmark Style

We can add different checkmark styles using PdfCheckBoxStyle enum. Checkmark size is depending on the check box field. Please refer the following code snippet.

C#

//Create Check Box field.
PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox");
 
//Set Check box properties
checkBoxField.Bounds = new RectangleF (50, 230, 8, 8);checkBoxField.Style = PdfCheckBoxStyle.Cross;

 

Please find the different checkmark styles for the check box field from PdfCheckBoxStyle enum.

C#

//Create Check Box field.
PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox");
 
//Set Check box field style
checkBoxField.Style = PdfCheckBoxStyle.Check;
checkBoxField.Style = PdfCheckBoxStyle.Circle;
checkBoxField.Style = PdfCheckBoxStyle.Cross;
checkBoxField.Style = PdfCheckBoxStyle.Diamond;
checkBoxField.Style = PdfCheckBoxStyle.Square;
checkBoxField.Style = PdfCheckBoxStyle.Star;

 

For example, one check mark style is added to Check Box field can be shown in below code snippet.

C#

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
 
//Add a page.
PdfPage page = doc.Pages.Add();
 
PdfForm form = doc.Form;
 
page.Graphics.DrawString("Qualification:", new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Bold), PdfBrushes.Black, new PointF(50, 100));
 
//Create Check box field
PdfCheckBoxField checkField = new PdfCheckBoxField(page, "UG");
 
//Set Check box properties
checkField.Bounds = new RectangleF(50, 130, 8, 8);
checkField.Style = PdfCheckBoxStyle.Cross;
 
page.Graphics.DrawString("UG", new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Italic), PdfBrushes.Black, new PointF(80, 130));
 
//Create Check box field
PdfCheckBoxField checkField1 = new PdfCheckBoxField(page, "PG");
 
//Set Check box properties
checkField1.Bounds = new RectangleF(50, 170, 8, 8);
checkField1.Style = PdfCheckBoxStyle.Cross;
 
page.Graphics.DrawString("PG", new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Italic), PdfBrushes.Black, new PointF(80, 170));
 
//Add the form field to the document
form.Fields.Add(checkField);
form.Fields.Add(checkField1);

 

Conclusion

I hope you enjoyed learning about how  add the different check mark style in checkbox field in WinForms PDF.

You can refer to our WinForms PDF feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms PDF example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied