GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / GetFormFieldBorderStyle Method / GetFormFieldBorderStyle(Int32,Int32,Single,PdfAnnotationBorderStyle,Single,Single) Method
A unique form field identifier specifying a required form field object. You can obtain this identifier using these methods: GdPicturePDF.AddRadioButtonFormField, GdPicturePDF.GetFormFieldId or GdPicturePDF.GetFormFieldChildID.
The index of the required child radio button in a group. It must be a value from 0 to GdPicturePDF.GetFormFieldChildCount-1.

It is simply a sequence index of a radio button in a group, it does not correspond to the unique form field's identifier.

Output parameter. The width of the line used to draw the form field's border, expressed in the current units specified by the SetMeasurementUnit method.
Output parameter. A member of the PdfAnnotationBorderStyle enumeration. The style of the line used to draw the form field's border.
Output parameter. If the style of the border's line (the BorderStyle parameter) is dashed, this value defines the width of the dashes in the dash pattern used to draw the border's line. Otherwise, this parameter is ignored. The value is expressed in the current units specified by the SetMeasurementUnit method.
Output parameter. If the style of the border's line (the BorderStyle parameter) is dashed, this value defines the width of the gaps in the dash pattern used to draw the border's line. Otherwise, this parameter is ignored. The value is expressed in the current units specified by the SetMeasurementUnit method.
Example





In This Topic
GetFormFieldBorderStyle(Int32,Int32,Single,PdfAnnotationBorderStyle,Single,Single) Method
In This Topic
Returns the style of the line used to draw the border of a required form field, here a child radio button in a group. The radio button group is specified by its unique form field's identifier and it is related to the currently loaded PDF document. As said, this method is only applicable to radio buttons.

The border's line dimensions are expressed in the current units defined in the PDF document. You can use the GdPicturePDF.GetMeasurementUnit method to determine the currently defined units and you can use the GdPicturePDF.SetMeasurementUnit method to reset the units according to your preference. Please note that every single child radio button in a group of radio buttons within a radio button field can have its own border's line style defined.

Syntax
'Declaration
 
Public Overloads Function GetFormFieldBorderStyle( _
   ByVal FieldId As Integer, _
   ByVal ChildIdx As Integer, _
   ByRef BorderWidth As Single, _
   ByRef BorderStyle As PdfAnnotationBorderStyle, _
   ByRef DashOn As Single, _
   ByRef DashOff As Single _
) As GdPictureStatus
public GdPictureStatus GetFormFieldBorderStyle( 
   int FieldId,
   int ChildIdx,
   ref float BorderWidth,
   ref PdfAnnotationBorderStyle BorderStyle,
   ref float DashOn,
   ref float DashOff
)
public function GetFormFieldBorderStyle( 
    FieldId: Integer;
    ChildIdx: Integer;
   var  BorderWidth: Single;
   var  BorderStyle: PdfAnnotationBorderStyle;
   var  DashOn: Single;
   var  DashOff: Single
): GdPictureStatus; 
public function GetFormFieldBorderStyle( 
   FieldId : int,
   ChildIdx : int,
   BorderWidth : float,
   BorderStyle : PdfAnnotationBorderStyle,
   DashOn : float,
   DashOff : float
) : GdPictureStatus;
public: GdPictureStatus GetFormFieldBorderStyle( 
   int FieldId,
   int ChildIdx,
   ref float BorderWidth,
   ref PdfAnnotationBorderStyle BorderStyle,
   ref float DashOn,
   ref float DashOff
) 
public:
GdPictureStatus GetFormFieldBorderStyle( 
   int FieldId,
   int ChildIdx,
   float% BorderWidth,
   PdfAnnotationBorderStyle% BorderStyle,
   float% DashOn,
   float% DashOff
) 

Parameters

FieldId
A unique form field identifier specifying a required form field object. You can obtain this identifier using these methods: GdPicturePDF.AddRadioButtonFormField, GdPicturePDF.GetFormFieldId or GdPicturePDF.GetFormFieldChildID.
ChildIdx
The index of the required child radio button in a group. It must be a value from 0 to GdPicturePDF.GetFormFieldChildCount-1.

It is simply a sequence index of a radio button in a group, it does not correspond to the unique form field's identifier.

BorderWidth
Output parameter. The width of the line used to draw the form field's border, expressed in the current units specified by the SetMeasurementUnit method.
BorderStyle
Output parameter. A member of the PdfAnnotationBorderStyle enumeration. The style of the line used to draw the form field's border.
DashOn
Output parameter. If the style of the border's line (the BorderStyle parameter) is dashed, this value defines the width of the dashes in the dash pattern used to draw the border's line. Otherwise, this parameter is ignored. The value is expressed in the current units specified by the SetMeasurementUnit method.
DashOff
Output parameter. If the style of the border's line (the BorderStyle parameter) is dashed, this value defines the width of the gaps in the dash pattern used to draw the border's line. Otherwise, this parameter is ignored. The value is expressed in the current units specified by the SetMeasurementUnit method.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents. At the same, this method is only meaningful for radio buttons, otherwise it will fail.

Likewise, be aware that both DashOn and DashOff parameters are valid only if the returned value of the BorderStyle parameter is PdfAnnotationBorderStyle.PdfAnnotationBorderStyleDashed, otherwise they are ignored.

Just to remind you that the values of dimensions are expressed in the current units defined by the GdPicturePDF.SetMeasurementUnit method.

Example
How to properly determine border's properties for radio button form fields in the current document.
Dim caption As String = "Example: GetFormFieldBorderStyle"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.LoadFromFile("forms.pdf", False) = GdPictureStatus.OK Then
    Dim count As Integer = gdpicturePDF.GetFormFieldsCount()
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim status As GdPictureStatus = GdPictureStatus.OK
        Dim message As String = ""
        Dim formID As Integer = 0
        Dim hasRB As Boolean = False
        Dim type As PdfFormFieldType = PdfFormFieldType.PdfFormFieldTypeUnknown
        Dim width As Single = 0, dOn As Single = 0, dOff As Single = 0
        Dim style As PdfAnnotationBorderStyle = PdfAnnotationBorderStyle.PdfAnnotationBorderStyleSolid
        For i As Integer = 0 To count - 1
            formID = gdpicturePDF.GetFormFieldId(i)
            If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                type = gdpicturePDF.GetFormFieldType(formID)
                If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                    If type = PdfFormFieldType.PdfFormFieldTypeRadioButton Then
                        hasRB = True
                        message = message + "RB " + gdpicturePDF.GetFormFieldTitle(formID)
                        status = gdpicturePDF.GetFormFieldBorderStyle(formID, width, style, dOn, dOff)
                        If status = GdPictureStatus.OK Then
                            'The border style is the same for all child radio buttons in this group.
                            message = message + " - style: " + style.ToString() + "  width: " + width.ToString("N2")
                            If style = PdfAnnotationBorderStyle.PdfAnnotationBorderStyleDashed Then
                                message = message + "; dash(" + dOn.ToString("N2") + "," + dOff.ToString("N2") + ")"
                            End If
                        Else
                            If gdpicturePDF.GetStat() = GdPictureStatus.Aborted Then
                                'The border style is different for the individual child radio buttons in this group.
                                message = message + " has a different border style for its child radio buttons."
                                Dim kids As Integer = gdpicturePDF.GetFormFieldChildCount(formID)
                                If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                                    For j As Integer = 0 To kids - 1
                                        message = message + vbCrLf + "  " + j.ToString() + ".child - style: "
                                        status = gdpicturePDF.GetFormFieldBorderStyle(formID, j, width, style, dOn, dOff)
                                        If status = GdPictureStatus.OK Then
                                            message = message + style.ToString() + "  width: " + width.ToString("N2")
                                            If style = PdfAnnotationBorderStyle.PdfAnnotationBorderStyleDashed Then
                                                message = message + "; dash(" + dOn.ToString("N2") + "," & dOff.ToString("N2") + ")"
                                            End If
                                        Else
                                            message = message + status.ToString()
                                        End If
                                    Next
                                Else
                                    message = message + vbCrLf + "  The GetFormFieldChildCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
                                End If
                            Else
                                message = message + vbCrLf + "  The GetFormFieldBorderStyle() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
                            End If
                        End If
                    End If
                Else
                    MessageBox.Show("The GetFormFieldType() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
                    Exit For
                End If
            Else
                MessageBox.Show("The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
                Exit For
            End If
            message += vbCrLf
        Next
        If count = 0 Then
            message = "This file doesn't include forms."
        ElseIf Not hasRB Then
            message = "This file doesn't include radio button form fields."
        End If
        MessageBox.Show(message, caption)
    Else
        MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetFormFieldBorderStyle";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms.pdf", false) == GdPictureStatus.OK)
{
    int count = gdpicturePDF.GetFormFieldsCount();
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        GdPictureStatus status = GdPictureStatus.OK;
        string message = "";
        int formID = 0;
        bool hasRB = false;
        PdfFormFieldType type = PdfFormFieldType.PdfFormFieldTypeUnknown;
        float width = 0, dOn = 0, dOff = 0;
        PdfAnnotationBorderStyle style = PdfAnnotationBorderStyle.PdfAnnotationBorderStyleSolid;
        for (int i = 0; i < count; i++)
        {
            formID = gdpicturePDF.GetFormFieldId(i);
            if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            {
                type = gdpicturePDF.GetFormFieldType(formID);
                if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
                {
                    if (type == PdfFormFieldType.PdfFormFieldTypeRadioButton)
                    {
                        hasRB = true;
                        message = message + "RB " + gdpicturePDF.GetFormFieldTitle(formID);
                        status = gdpicturePDF.GetFormFieldBorderStyle(formID, ref width, ref style, ref dOn, ref dOff);
                        if (status == GdPictureStatus.OK)
                        {
                            //The border style is the same for all child radio buttons in this group.
                            message = message + " - style: " + style.ToString() + "  width: " + width.ToString("N2");
                            if (style == PdfAnnotationBorderStyle.PdfAnnotationBorderStyleDashed)
                                message = message + "; dash(" + dOn.ToString("N2") + "," + dOff.ToString("N2") + ")";
                        }
                        else
                        {
                            if (gdpicturePDF.GetStat() == GdPictureStatus.Aborted)
                            {
                                //The border style is different for the individual child radio buttons in this group.
                                message = message + " has a different border style for its child radio buttons.";
                                int kids = gdpicturePDF.GetFormFieldChildCount(formID);
                                if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
                                {
                                    for (int j = 0; j < kids; j++)
                                    {
                                        message = message + "\n  " + j.ToString() + ".child - style: ";
                                        status = gdpicturePDF.GetFormFieldBorderStyle(formID, j, ref width, ref style, ref dOn, ref dOff);
                                        if (status == GdPictureStatus.OK)
                                        {
                                            message = message + style.ToString() + "  width: " + width.ToString("N2");
                                            if (style == PdfAnnotationBorderStyle.PdfAnnotationBorderStyleDashed)
                                                message = message + "; dash(" + dOn.ToString("N2") + "," + dOff.ToString("N2") + ")";
                                        }
                                        else
                                            message = message + status.ToString();
                                    }
                                }
                                else message = message + "\n  The GetFormFieldChildCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
                            }
                            else message = message + "\n  The GetFormFieldBorderStyle() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("The GetFormFieldType() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
                    break;
                }
            }
            else
            {
                MessageBox.Show("The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
                break;
            }
            message += "\n";
        }
        if (count == 0) message = "This file doesn't include forms.";
        else if (!hasRB) message = "This file doesn't include radio button form fields.";
        MessageBox.Show(message, caption);
    }
    else
        MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
    MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();
See Also