插入复选框的代码:
TextControl1.Selection.FontName = "Arial Unicode MS"
'UNCHECKED = UnicodeHexToString("\\u2610")
'CHECKED = UnicodeHexToString("\\u2714")
' 通过特殊的适配器类型创建一个复选框
Dim clsCheckBox As TXTextControl.DocumentServer.Fields.FormCheckBox = New TXTextControl.DocumentServer.Fields.FormCheckBox()
clsCheckBox.Text = UNCHECKED
'clsCheckBox.Text = "clsCheckBox.Text = UNCHECKED;";
clsCheckBox.Enabled = True
clsCheckBox.ApplicationField.Editable = True
clsCheckBox.ApplicationField.DoubledInputPosition = True
' 将 ApplicationField 添加到文档中
TextControl1.ApplicationFields.Add(clsCheckBox.ApplicationField)单击事件:
Private Sub TextControl1_TextFieldClicked(ByVal sender As System.Object, ByVal e As TXTextControl.TextFieldEventArgs) Handles TextControl1.TextFieldClicked
Dim field As TXTextControl.ApplicationField = CType(e.TextField, TXTextControl.ApplicationField)
If Not field Is Nothing Then
If field.TypeName = "FORMCHECKBOX" Then
Dim chkb As TXTextControl.DocumentServer.Fields.FormCheckBox = New TXTextControl.DocumentServer.Fields.FormCheckBox(field)
If chkb.Enabled = False Then Exit Sub
If field.Text = UNCHECKED Then
chkb.Checked = True
chkb.Text = CHECKED
ElseIf (field.Text = CHECKED) Then
chkb.Checked = False
chkb.Text = UNCHECKED
End If
End If
End If
End Sub
保存到数据库:
Dim strData As Byte()
Me.TextControl1.Save(strData, TXTextControl.BinaryStreamType.InternalFormat)
Dim newRow As DataRow
newRow = dt.Rows.Add
newRow.Item("templetID") = Me.TextBox1.Text
newRow.Item("templetclass") = ComboBox1.Text
newRow.Item("templetname") = TextBox3.Text
newRow.Item("templetText") = sData
....
从数据库调入:
sData=dt.rows(0).Item("templettext")
Me.TextControl1.Load(sData, TXTextControl.BinaryStreamType.InternalFormat)
|