iTextSharp.text.pdf.TextField.GetComboField C# (CSharp) Метод

GetComboField() публичный Метод

public GetComboField ( ) : PdfFormField
Результат PdfFormField
        public PdfFormField GetComboField() {
            return GetChoiceField(false);
        }
        

Usage Example

Пример #1
0
// ---------------------------------------------------------------------------
    public void CellLayout(PdfPCell cell, Rectangle rectangle, 
        PdfContentByte[] canvases) 
    {
      PdfWriter writer = canvases[0].PdfWriter;
      TextField text = new TextField(
        writer, rectangle, string.Format("choice_{0}", cf)
      );
      text.BackgroundColor = new GrayColor(0.75f);
      switch(cf) {
        case 1:
          text.Choices = LANGUAGES;
          text.ChoiceExports = EXPORTVALUES;
          text.ChoiceSelection = 2;
          writer.AddAnnotation(text.GetListField());
          break;
        case 2:
          text.Choices = LANGUAGES;
          text.BorderColor = BaseColor.GREEN;
          text.BorderStyle = PdfBorderDictionary.STYLE_DASHED;
          text.Options = TextField.MULTISELECT;
          List<int> selections = new List<int>();
          selections.Add(0);
          selections.Add(2);
          text.ChoiceSelections = selections;
          PdfFormField field = text.GetListField();
          writer.AddAnnotation(field);
          break;
        case 3:
          text.BorderColor = BaseColor.RED;
          text.BackgroundColor = BaseColor.GRAY;
          text.Choices = LANGUAGES;
          text.ChoiceExports = EXPORTVALUES;
          text.ChoiceSelection = 4;
          writer.AddAnnotation(text.GetComboField());
          break;
        case 4:
          text.Choices = LANGUAGES;
          text.Options = TextField.EDIT;
          writer.AddAnnotation(text.GetComboField());
          break;
      }
    }