Partager via


LineNumber Property

LineNumber Property

Returns the line number of the ink that makes up the alternate.

Declaration

[C++]

[C++][propget] HRESULT get_LineNumber ([out, retval] long* LineNumber);

[Microsoft® Visual Basic® 6.0]

[Visual Basic]Public Property Get LineNumber() As Long

Property Value

long The line number of the ink that makes up the alternate.

This property is read-only.

Return Value

This property returns a signed 32-bit integer that indicates the line number of the ink that represented the alternate. An exception is thrown if the alternate occupies more than one line.

HRESULT value Description
S_OK Success.
E_POINTER The LineNumber parameter is an invalid pointer.
E_INK_EXCEPTION An exception occurred while processing.
E_FAIL An unspecified error occurred.

Remarks

Line numbers begin with 1.

Note: The Recognizer object automatically determines the metrics for how lines are spaced.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example shows a way to display alternates text along with their line numbers in a multi-line text box.

[Visual Basic]
Private Sub DisplayAlternates( _
ByVal theRecognitionResult As IInkRecognitionResult)
    'Get alternates for the entire result
    Dim theRecognitionAlternates As IInkRecognitionAlternates
    Set theRecognitionAlternates = _
        theRecognitionResult.AlternatesFromSelection(0, -1)
    'Fill the text box with the alternates and their
    'line number, if any.
    Dim theRecognitionAlternate As IInkRecognitionAlternate
    For Each theRecognitionAlternate In theRecognitionAlternates
        Dim lineNo As Long
        lineNo = -1
        On Error Resume Next
        lineNo = theRecognitionAlternate.LineNumber
        If lineNo <> -1 Then
            Text1.Text = Text1.Text & _
                theRecognitionAlternate.String & "   line: " & lineNo & vbCrLf
        Else
            Text1.Text = Text1.Text & _
                theRecognitionAlternate.String & "   multiple lines" & vbCrLf
        End If
    Next
End Sub

Applies To