你看下面的代码是否满足你的需求:- Dim fieldNo Dim noPages Private Sub Form_Load()
- TXTextControl1.HeaderFooter = txHeader
- TXTextControl1.HeaderFooterSelect txHeader
- TXTextControl1.Text = "Page: of"
- TXTextControl1.SelStart = Len("Page: ")
- TXTextControl1.FieldInsert ("")
- TXTextControl1.FieldType(TXTextControl1.FieldCurrent) = txFieldPageNumber
- TXTextControl1.SelStart = Len("Page: x of ")
- TXTextControl1.FieldInsert ""
- fieldNo = TXTextControl1.FieldCurrent
- noPages = TXTextControl1.CurrentPages
- TXTextControl1.FieldText = Str(noPages)
- TXTextControl1.HeaderFooterSelect 0
- End Sub
复制代码- Private Sub TXTextControl1_Change()
- If (noPages <> -1) And (TXTextControl1.CurrentPages <> noPages) Then
- noPages = TXTextControl1.CurrentPages
- TXTextControl1.HeaderFooterSelect txHeader
- TXTextControl1.FieldCurrent = fieldNo
- TXTextControl1.FieldText = Str(noPages)
- TXTextControl1.HeaderFooterSelect 0
- TXTextControl1.Refresh
- End If End Sub
复制代码 |