1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim m_lngTotalLigne As Long
Dim m_lngNumLigne As Long
Dim m_lngOldLigne As Long
Dim iCount As Integer
Dim iLastPos As Integer
RichTextBoxFR1.Visible = True
WebBrowser1.Visible = False
ToolStripStatusLabel1.Text = DateTime.Now.ToLongDateString
ToolStripStatusLabel5.Text = DateTime.Now.ToLongTimeString
'nombre de caractères
ToolStripStatusLabel2.Text = "lettres : " & _
Len(Replace(Replace(Replace(RichTextBoxFR1.Text, vbCrLf, ""), _
vbTab, ""), " ", ""))
'nombre total de lignes
m_lngTotalLigne = RichTextBoxFR1.GetLineFromCharIndex(Len(RichTextBoxFR1.Text)) + 1
'ligne en cours
m_lngNumLigne = RichTextBoxFR1.GetLineFromCharIndex(RichTextBoxFR1.SelectionStart) + 1
'ligne en cours/nombre total de lignes
ToolStripStatusLabel3.Text = "Lignes : " & m_lngNumLigne & _
" / " & m_lngTotalLigne
'----
'affichage sur ligne 1
If m_lngNumLigne = 1 Then
iCount = RichTextBoxFR1.SelectionStart
ElseIf m_lngNumLigne > 1 Then
'récupère la position du curseur / la ligne en cours
iLastPos = InStrRev(RichTextBoxFR1.Text, vbCrLf, RichTextBoxFR1.SelectionStart)
iCount = RichTextBoxFR1.SelectionStart - iLastPos - 1
End If
'----
m_lngOldLigne = m_lngNumLigne
'----
ToolStripStatusLabel4.Text = "Colonnes : " & iCount
End Sub |
Partager