Imports System.IO
Imports System
Imports System.Threading
Imports System.Timers


Public Class FastReader
  Inherits System.Windows.Forms.Form

  Public txtFileContents As String
  Public temptext As Array
  Public word As String
  Public numwords As Int64
  Public textpointer As Int64
  Public aTimer As System.Timers.Timer

#Region " Windows Form Designer generated code "

  Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

  End Sub

  'Form overrides dispose to clean up the component list.
  Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
      If Not (components Is Nothing) Then
        components.Dispose()
      End If
    End If
    MyBase.Dispose(disposing)
  End Sub

  'Required by the Windows Form Designer
  Private components As System.ComponentModel.IContainer

  'NOTE: The following procedure is required by the Windows Form Designer
  'It can be modified using the Windows Form Designer.  
  'Do not modify it using the code editor.
  Friend WithEvents rtbText As System.Windows.Forms.RichTextBox
  Friend WithEvents cmdGo As System.Windows.Forms.Button
  Friend WithEvents lblSpeed As System.Windows.Forms.Label
  Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
  Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
  Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
  Friend WithEvents mnuFileOpen As System.Windows.Forms.MenuItem
  Friend WithEvents mnuFileExit As System.Windows.Forms.MenuItem
  Friend WithEvents mnuEditFont As System.Windows.Forms.MenuItem
  Friend WithEvents lblRSpeed As System.Windows.Forms.Label
  Friend WithEvents cmdStop As System.Windows.Forms.Button
  Friend WithEvents cmdPause As System.Windows.Forms.Button
  Friend WithEvents rtbFastText As System.Windows.Forms.RichTextBox
  Friend WithEvents mnuFileOpenClip As System.Windows.Forms.MenuItem
  Friend WithEvents FontDialog1 As System.Windows.Forms.FontDialog
  Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
  Friend WithEvents mnuEditFontColor As System.Windows.Forms.MenuItem
  Friend WithEvents mnuEditBackColor As System.Windows.Forms.MenuItem
  Friend WithEvents cmdSlower As System.Windows.Forms.Button
  Friend WithEvents cmdFaster As System.Windows.Forms.Button
  Friend WithEvents lblSpeedRating As System.Windows.Forms.Label
  Friend WithEvents grpSpeed As System.Windows.Forms.GroupBox
  Friend WithEvents trkProgress As System.Windows.Forms.TrackBar
  Friend WithEvents cmdPrev As System.Windows.Forms.Button
  Friend WithEvents cmdNext As System.Windows.Forms.Button
  Friend WithEvents lblPercent As System.Windows.Forms.Label
  Friend WithEvents lblSpeed1 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed2 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed3 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed4 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed5 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed6 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed7 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed8 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed9 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed11 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed12 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed13 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed14 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed15 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed18 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed16 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed17 As System.Windows.Forms.Label
  Friend WithEvents lblSpeed10 As System.Windows.Forms.Label
  Friend WithEvents StatusBar As System.Windows.Forms.StatusBar
  Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
  Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FastReader))
    Me.rtbText = New System.Windows.Forms.RichTextBox()
    Me.cmdGo = New System.Windows.Forms.Button()
    Me.lblSpeed = New System.Windows.Forms.Label()
    Me.MainMenu1 = New System.Windows.Forms.MainMenu()
    Me.MenuItem1 = New System.Windows.Forms.MenuItem()
    Me.mnuFileOpen = New System.Windows.Forms.MenuItem()
    Me.mnuFileOpenClip = New System.Windows.Forms.MenuItem()
    Me.mnuFileExit = New System.Windows.Forms.MenuItem()
    Me.MenuItem4 = New System.Windows.Forms.MenuItem()
    Me.mnuEditFont = New System.Windows.Forms.MenuItem()
    Me.mnuEditFontColor = New System.Windows.Forms.MenuItem()
    Me.mnuEditBackColor = New System.Windows.Forms.MenuItem()
    Me.MenuItem2 = New System.Windows.Forms.MenuItem()
    Me.MenuItem3 = New System.Windows.Forms.MenuItem()
    Me.lblRSpeed = New System.Windows.Forms.Label()
    Me.cmdStop = New System.Windows.Forms.Button()
    Me.cmdPause = New System.Windows.Forms.Button()
    Me.rtbFastText = New System.Windows.Forms.RichTextBox()
    Me.FontDialog1 = New System.Windows.Forms.FontDialog()
    Me.ColorDialog1 = New System.Windows.Forms.ColorDialog()
    Me.cmdSlower = New System.Windows.Forms.Button()
    Me.cmdFaster = New System.Windows.Forms.Button()
    Me.lblSpeedRating = New System.Windows.Forms.Label()
    Me.grpSpeed = New System.Windows.Forms.GroupBox()
    Me.lblSpeed10 = New System.Windows.Forms.Label()
    Me.lblSpeed17 = New System.Windows.Forms.Label()
    Me.lblSpeed16 = New System.Windows.Forms.Label()
    Me.lblSpeed18 = New System.Windows.Forms.Label()
    Me.lblSpeed15 = New System.Windows.Forms.Label()
    Me.lblSpeed14 = New System.Windows.Forms.Label()
    Me.lblSpeed13 = New System.Windows.Forms.Label()
    Me.lblSpeed12 = New System.Windows.Forms.Label()
    Me.lblSpeed11 = New System.Windows.Forms.Label()
    Me.lblSpeed9 = New System.Windows.Forms.Label()
    Me.lblSpeed8 = New System.Windows.Forms.Label()
    Me.lblSpeed7 = New System.Windows.Forms.Label()
    Me.lblSpeed6 = New System.Windows.Forms.Label()
    Me.lblSpeed5 = New System.Windows.Forms.Label()
    Me.lblSpeed4 = New System.Windows.Forms.Label()
    Me.lblSpeed3 = New System.Windows.Forms.Label()
    Me.lblSpeed2 = New System.Windows.Forms.Label()
    Me.lblSpeed1 = New System.Windows.Forms.Label()
    Me.trkProgress = New System.Windows.Forms.TrackBar()
    Me.cmdPrev = New System.Windows.Forms.Button()
    Me.cmdNext = New System.Windows.Forms.Button()
    Me.lblPercent = New System.Windows.Forms.Label()
    Me.StatusBar = New System.Windows.Forms.StatusBar()
    Me.grpSpeed.SuspendLayout()
    CType(Me.trkProgress, System.ComponentModel.ISupportInitialize).BeginInit()
    Me.SuspendLayout()
    '
    'rtbText
    '
    Me.rtbText.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.rtbText.Location = New System.Drawing.Point(8, 124)
    Me.rtbText.Name = "rtbText"
    Me.rtbText.Size = New System.Drawing.Size(144, 224)
    Me.rtbText.TabIndex = 0
    Me.rtbText.Text = "rtbText"
    '
    'cmdGo
    '
    Me.cmdGo.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.cmdGo.Location = New System.Drawing.Point(160, 300)
    Me.cmdGo.Name = "cmdGo"
    Me.cmdGo.Size = New System.Drawing.Size(48, 40)
    Me.cmdGo.TabIndex = 1
    Me.cmdGo.Text = "Go"
    '
    'lblSpeed
    '
    Me.lblSpeed.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.lblSpeed.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed.Location = New System.Drawing.Point(160, 204)
    Me.lblSpeed.Name = "lblSpeed"
    Me.lblSpeed.Size = New System.Drawing.Size(176, 16)
    Me.lblSpeed.TabIndex = 3
    Me.lblSpeed.Text = "lblSpeed"
    '
    'MainMenu1
    '
    Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem4, Me.MenuItem2})
    '
    'MenuItem1
    '
    Me.MenuItem1.Index = 0
    Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFileOpen, Me.mnuFileOpenClip, Me.mnuFileExit})
    Me.MenuItem1.Text = "File"
    '
    'mnuFileOpen
    '
    Me.mnuFileOpen.Index = 0
    Me.mnuFileOpen.Text = "Open"
    '
    'mnuFileOpenClip
    '
    Me.mnuFileOpenClip.Index = 1
    Me.mnuFileOpenClip.Text = "Open from Clipboard"
    '
    'mnuFileExit
    '
    Me.mnuFileExit.Index = 2
    Me.mnuFileExit.Text = "Exit"
    '
    'MenuItem4
    '
    Me.MenuItem4.Index = 1
    Me.MenuItem4.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuEditFont, Me.mnuEditFontColor, Me.mnuEditBackColor})
    Me.MenuItem4.Text = "Edit"
    '
    'mnuEditFont
    '
    Me.mnuEditFont.Index = 0
    Me.mnuEditFont.Text = "Font"
    '
    'mnuEditFontColor
    '
    Me.mnuEditFontColor.Index = 1
    Me.mnuEditFontColor.Text = "Font Color"
    '
    'mnuEditBackColor
    '
    Me.mnuEditBackColor.Index = 2
    Me.mnuEditBackColor.Text = "Back Color"
    '
    'MenuItem2
    '
    Me.MenuItem2.Index = 2
    Me.MenuItem2.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem3})
    Me.MenuItem2.Text = "Help"
    '
    'MenuItem3
    '
    Me.MenuItem3.Index = 0
    Me.MenuItem3.Text = "About"
    '
    'lblRSpeed
    '
    Me.lblRSpeed.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.lblRSpeed.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblRSpeed.Location = New System.Drawing.Point(160, 228)
    Me.lblRSpeed.Name = "lblRSpeed"
    Me.lblRSpeed.Size = New System.Drawing.Size(176, 16)
    Me.lblRSpeed.TabIndex = 5
    Me.lblRSpeed.Text = "lblRSpeed"
    '
    'cmdStop
    '
    Me.cmdStop.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.cmdStop.Location = New System.Drawing.Point(288, 300)
    Me.cmdStop.Name = "cmdStop"
    Me.cmdStop.Size = New System.Drawing.Size(48, 40)
    Me.cmdStop.TabIndex = 6
    Me.cmdStop.Text = "Stop"
    '
    'cmdPause
    '
    Me.cmdPause.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.cmdPause.Location = New System.Drawing.Point(224, 300)
    Me.cmdPause.Name = "cmdPause"
    Me.cmdPause.Size = New System.Drawing.Size(48, 40)
    Me.cmdPause.TabIndex = 7
    Me.cmdPause.Text = "Pause"
    '
    'rtbFastText
    '
    Me.rtbFastText.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                Or System.Windows.Forms.AnchorStyles.Left) _
                Or System.Windows.Forms.AnchorStyles.Right)
    Me.rtbFastText.BackColor = System.Drawing.Color.Black
    Me.rtbFastText.Font = New System.Drawing.Font("Arial", 48.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.rtbFastText.ForeColor = System.Drawing.Color.Yellow
    Me.rtbFastText.Location = New System.Drawing.Point(8, 8)
    Me.rtbFastText.Name = "rtbFastText"
    Me.rtbFastText.Size = New System.Drawing.Size(608, 100)
    Me.rtbFastText.TabIndex = 8
    Me.rtbFastText.Text = "rtbFastText"
    '
    'cmdSlower
    '
    Me.cmdSlower.BackColor = System.Drawing.SystemColors.Control
    Me.cmdSlower.Location = New System.Drawing.Point(8, 120)
    Me.cmdSlower.Name = "cmdSlower"
    Me.cmdSlower.Size = New System.Drawing.Size(48, 24)
    Me.cmdSlower.TabIndex = 27
    Me.cmdSlower.Text = "Slower"
    '
    'cmdFaster
    '
    Me.cmdFaster.BackColor = System.Drawing.SystemColors.Control
    Me.cmdFaster.Location = New System.Drawing.Point(104, 120)
    Me.cmdFaster.Name = "cmdFaster"
    Me.cmdFaster.Size = New System.Drawing.Size(48, 24)
    Me.cmdFaster.TabIndex = 28
    Me.cmdFaster.Text = "Faster"
    '
    'lblSpeedRating
    '
    Me.lblSpeedRating.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.lblSpeedRating.ForeColor = System.Drawing.Color.Lime
    Me.lblSpeedRating.Location = New System.Drawing.Point(64, 120)
    Me.lblSpeedRating.Name = "lblSpeedRating"
    Me.lblSpeedRating.Size = New System.Drawing.Size(32, 24)
    Me.lblSpeedRating.TabIndex = 29
    Me.lblSpeedRating.Text = "3"
    Me.lblSpeedRating.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
    '
    'grpSpeed
    '
    Me.grpSpeed.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.grpSpeed.BackColor = System.Drawing.Color.Teal
    Me.grpSpeed.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblSpeed10, Me.lblSpeed17, Me.lblSpeed16, Me.lblSpeed18, Me.lblSpeed15, Me.lblSpeed14, Me.lblSpeed13, Me.lblSpeed12, Me.lblSpeed11, Me.lblSpeed9, Me.lblSpeed8, Me.lblSpeed7, Me.lblSpeed6, Me.lblSpeed5, Me.lblSpeed4, Me.lblSpeed3, Me.lblSpeed2, Me.lblSpeed1, Me.cmdSlower, Me.lblSpeedRating, Me.cmdFaster})
    Me.grpSpeed.Location = New System.Drawing.Point(360, 196)
    Me.grpSpeed.Name = "grpSpeed"
    Me.grpSpeed.Size = New System.Drawing.Size(160, 152)
    Me.grpSpeed.TabIndex = 30
    Me.grpSpeed.TabStop = False
    '
    'lblSpeed10
    '
    Me.lblSpeed10.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed10.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed10.Location = New System.Drawing.Point(80, 72)
    Me.lblSpeed10.Name = "lblSpeed10"
    Me.lblSpeed10.Size = New System.Drawing.Size(7, 42)
    Me.lblSpeed10.TabIndex = 48
    '
    'lblSpeed17
    '
    Me.lblSpeed17.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed17.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed17.Location = New System.Drawing.Point(136, 51)
    Me.lblSpeed17.Name = "lblSpeed17"
    Me.lblSpeed17.Size = New System.Drawing.Size(7, 63)
    Me.lblSpeed17.TabIndex = 47
    '
    'lblSpeed16
    '
    Me.lblSpeed16.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed16.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed16.Location = New System.Drawing.Point(128, 54)
    Me.lblSpeed16.Name = "lblSpeed16"
    Me.lblSpeed16.Size = New System.Drawing.Size(7, 60)
    Me.lblSpeed16.TabIndex = 46
    '
    'lblSpeed18
    '
    Me.lblSpeed18.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed18.Location = New System.Drawing.Point(144, 48)
    Me.lblSpeed18.Name = "lblSpeed18"
    Me.lblSpeed18.Size = New System.Drawing.Size(7, 66)
    Me.lblSpeed18.TabIndex = 45
    '
    'lblSpeed15
    '
    Me.lblSpeed15.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed15.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed15.Location = New System.Drawing.Point(120, 57)
    Me.lblSpeed15.Name = "lblSpeed15"
    Me.lblSpeed15.Size = New System.Drawing.Size(7, 57)
    Me.lblSpeed15.TabIndex = 44
    '
    'lblSpeed14
    '
    Me.lblSpeed14.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed14.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed14.Location = New System.Drawing.Point(112, 60)
    Me.lblSpeed14.Name = "lblSpeed14"
    Me.lblSpeed14.Size = New System.Drawing.Size(7, 54)
    Me.lblSpeed14.TabIndex = 43
    '
    'lblSpeed13
    '
    Me.lblSpeed13.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed13.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed13.Location = New System.Drawing.Point(104, 63)
    Me.lblSpeed13.Name = "lblSpeed13"
    Me.lblSpeed13.Size = New System.Drawing.Size(7, 51)
    Me.lblSpeed13.TabIndex = 41
    '
    'lblSpeed12
    '
    Me.lblSpeed12.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed12.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed12.Location = New System.Drawing.Point(96, 66)
    Me.lblSpeed12.Name = "lblSpeed12"
    Me.lblSpeed12.Size = New System.Drawing.Size(7, 48)
    Me.lblSpeed12.TabIndex = 40
    '
    'lblSpeed11
    '
    Me.lblSpeed11.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed11.Location = New System.Drawing.Point(88, 69)
    Me.lblSpeed11.Name = "lblSpeed11"
    Me.lblSpeed11.Size = New System.Drawing.Size(7, 45)
    Me.lblSpeed11.TabIndex = 39
    '
    'lblSpeed9
    '
    Me.lblSpeed9.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed9.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed9.Location = New System.Drawing.Point(72, 75)
    Me.lblSpeed9.Name = "lblSpeed9"
    Me.lblSpeed9.Size = New System.Drawing.Size(7, 39)
    Me.lblSpeed9.TabIndex = 38
    '
    'lblSpeed8
    '
    Me.lblSpeed8.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed8.Location = New System.Drawing.Point(64, 78)
    Me.lblSpeed8.Name = "lblSpeed8"
    Me.lblSpeed8.Size = New System.Drawing.Size(7, 36)
    Me.lblSpeed8.TabIndex = 37
    '
    'lblSpeed7
    '
    Me.lblSpeed7.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed7.Location = New System.Drawing.Point(56, 81)
    Me.lblSpeed7.Name = "lblSpeed7"
    Me.lblSpeed7.Size = New System.Drawing.Size(7, 33)
    Me.lblSpeed7.TabIndex = 36
    '
    'lblSpeed6
    '
    Me.lblSpeed6.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed6.Location = New System.Drawing.Point(48, 84)
    Me.lblSpeed6.Name = "lblSpeed6"
    Me.lblSpeed6.Size = New System.Drawing.Size(7, 30)
    Me.lblSpeed6.TabIndex = 35
    '
    'lblSpeed5
    '
    Me.lblSpeed5.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed5.Location = New System.Drawing.Point(40, 87)
    Me.lblSpeed5.Name = "lblSpeed5"
    Me.lblSpeed5.Size = New System.Drawing.Size(7, 27)
    Me.lblSpeed5.TabIndex = 34
    '
    'lblSpeed4
    '
    Me.lblSpeed4.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed4.Location = New System.Drawing.Point(32, 90)
    Me.lblSpeed4.Name = "lblSpeed4"
    Me.lblSpeed4.Size = New System.Drawing.Size(7, 24)
    Me.lblSpeed4.TabIndex = 33
    '
    'lblSpeed3
    '
    Me.lblSpeed3.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed3.Location = New System.Drawing.Point(24, 93)
    Me.lblSpeed3.Name = "lblSpeed3"
    Me.lblSpeed3.Size = New System.Drawing.Size(7, 21)
    Me.lblSpeed3.TabIndex = 32
    '
    'lblSpeed2
    '
    Me.lblSpeed2.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed2.Location = New System.Drawing.Point(16, 96)
    Me.lblSpeed2.Name = "lblSpeed2"
    Me.lblSpeed2.Size = New System.Drawing.Size(7, 18)
    Me.lblSpeed2.TabIndex = 31
    '
    'lblSpeed1
    '
    Me.lblSpeed1.BackColor = System.Drawing.Color.Gray
    Me.lblSpeed1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.lblSpeed1.Location = New System.Drawing.Point(8, 99)
    Me.lblSpeed1.Name = "lblSpeed1"
    Me.lblSpeed1.Size = New System.Drawing.Size(7, 15)
    Me.lblSpeed1.TabIndex = 30
    '
    'trkProgress
    '
    Me.trkProgress.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.trkProgress.Location = New System.Drawing.Point(160, 132)
    Me.trkProgress.Name = "trkProgress"
    Me.trkProgress.Size = New System.Drawing.Size(360, 45)
    Me.trkProgress.TabIndex = 31
    Me.trkProgress.TickStyle = System.Windows.Forms.TickStyle.None
    '
    'cmdPrev
    '
    Me.cmdPrev.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.cmdPrev.Image = CType(resources.GetObject("cmdPrev.Image"), System.Drawing.Bitmap)
    Me.cmdPrev.Location = New System.Drawing.Point(528, 140)
    Me.cmdPrev.Name = "cmdPrev"
    Me.cmdPrev.Size = New System.Drawing.Size(32, 32)
    Me.cmdPrev.TabIndex = 32
    '
    'cmdNext
    '
    Me.cmdNext.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.cmdNext.Image = CType(resources.GetObject("cmdNext.Image"), System.Drawing.Bitmap)
    Me.cmdNext.Location = New System.Drawing.Point(560, 140)
    Me.cmdNext.Name = "cmdNext"
    Me.cmdNext.Size = New System.Drawing.Size(32, 32)
    Me.cmdNext.TabIndex = 33
    '
    'lblPercent
    '
    Me.lblPercent.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left)
    Me.lblPercent.Location = New System.Drawing.Point(528, 196)
    Me.lblPercent.Name = "lblPercent"
    Me.lblPercent.Size = New System.Drawing.Size(88, 32)
    Me.lblPercent.TabIndex = 34
    Me.lblPercent.Text = "lblPercent"
    '
    'StatusBar
    '
    Me.StatusBar.Location = New System.Drawing.Point(0, 364)
    Me.StatusBar.Name = "StatusBar"
    Me.StatusBar.Size = New System.Drawing.Size(624, 22)
    Me.StatusBar.TabIndex = 35
    '
    'FastReader
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(624, 386)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.StatusBar, Me.lblPercent, Me.cmdNext, Me.cmdPrev, Me.trkProgress, Me.grpSpeed, Me.rtbFastText, Me.cmdPause, Me.cmdStop, Me.lblRSpeed, Me.lblSpeed, Me.cmdGo, Me.rtbText})
    Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
    Me.Menu = Me.MainMenu1
    Me.MinimumSize = New System.Drawing.Size(632, 420)
    Me.Name = "FastReader"
    Me.Text = "FastReader"
    Me.grpSpeed.ResumeLayout(False)
    CType(Me.trkProgress, System.ComponentModel.ISupportInitialize).EndInit()
    Me.ResumeLayout(False)

  End Sub

#End Region

  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    loaddoc("Rahman_N_Muter_Optimizing_Reading.txt")
    aTimer = New System.Timers.Timer()
    AddHandler aTimer.Elapsed, AddressOf OnTimer
    SetSpeed(3)
  End Sub
  Private Sub Form1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Leave
    aTimer.Enabled = False
    rtbFastText.Text = Nothing
    rtbText.Text = Nothing
  End Sub
  Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click
    aTimer.Enabled = True
    If textpointer >= UBound(temptext) Then textpointer = 0

  End Sub
  Public Sub OnTimer(ByVal source As Object, ByVal e As ElapsedEventArgs)
    'rtbText.SelectionAlignment = HorizontalAlignment.Center
    rtbFastText.Text = temptext(textpointer)
    'rtbText.SelectionAlignment = HorizontalAlignment.Center

    textpointer = textpointer + 1
    trkProgress.Value = textpointer
  End Sub
  Public Sub loaddoc(ByVal DocName As String)
    Dim objStreamReader As StreamReader
    Dim strLine As String
    Cursor = System.Windows.Forms.Cursors.WaitCursor
    If System.IO.File.Exists(DocName) Then
      StatusBar.Text = DocName
      'Pass the file path and the file name to the StreamReader constructor.
      objStreamReader = New StreamReader(DocName)

      'Read the first line of text.
      txtFileContents = objStreamReader.ReadToEnd
      'Close the file.
      objStreamReader.Close()
    Else
      MsgBox("Error, file not found (" & DocName & ")", MsgBoxStyle.OKOnly, "Error")
      StatusBar.Text = "Error"
      txtFileContents = Nothing
    End If
    textpointer = 0
    'import the file to side text box
    rtbText.Text = txtFileContents
    'format data, then import to fast text box
    txtFileContents = Replace(txtFileContents, vbCrLf, " ")
    txtFileContents = Replace(txtFileContents, "-", "- ")
    temptext = Split(txtFileContents, " ")
    rtbFastText.Text = temptext(textpointer)
    trkProgress.Minimum = 0
    trkProgress.Maximum = UBound(temptext)
    trkProgress.Value = textpointer
    Cursor = System.Windows.Forms.Cursors.Default
    lblPercent.Text = FormatNumber(100 * (textpointer / UBound(temptext)), 0) & " percent"
  End Sub
  Private Sub mnuFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click
    End
  End Sub
  Private Sub mnuFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOpen.Click
    Dim OFD As FileDialog
    Dim Names As String()
    Dim Reader As StreamReader
    Dim Filename

    '' Create an Open File dialog box	
    OFD = New OpenFileDialog()
    '' Set up filters and options
    OFD.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
    OFD.DefaultExt = "txt"
    '' Run the Open File dialog box
    '' Check result of dialog box after it closes
    If (OFD.ShowDialog() = DialogResult.OK) Then
      '' Retrieve the filename entered 
      Names = OFD.FileNames
      Filename = Names(0)
      aTimer.Enabled = False
      loaddoc(Filename)
    End If

  End Sub
  Private Sub mnuFileOpenClip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOpenClip.Click
    StatusBar.Text = "Clipboard"
    txtFileContents = Clipboard.GetDataObject.GetData(DataFormats.Text)
    'import the file to side text box
    rtbText.Text = txtFileContents
    'format data, then import to fast text box
    txtFileContents = Replace(txtFileContents, vbCrLf, " ")
    txtFileContents = Replace(txtFileContents, "-", "- ")
    aTimer.Enabled = False
    textpointer = 0
    temptext = Split(txtFileContents, " ")
    rtbFastText.Text = temptext(textpointer)
    trkProgress.Minimum = 0
    trkProgress.Maximum = UBound(temptext)
    trkProgress.Value = textpointer
  End Sub
  Private Sub mnuEditFont_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditFont.Click
    FontDialog1.Font = rtbFastText.Font
    If FontDialog1.ShowDialog = DialogResult.OK Then
      rtbFastText.Font = FontDialog1.Font

    End If
  End Sub
  Private Sub mnuEditFontColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditFontColor.Click
    ColorDialog1.Color = rtbFastText.ForeColor
    If ColorDialog1.ShowDialog = DialogResult.OK Then
      rtbFastText.ForeColor = ColorDialog1.Color
    End If
  End Sub
  Private Sub mnuEditBackColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditBackColor.Click
    ColorDialog1.Color = rtbFastText.BackColor
    If ColorDialog1.ShowDialog = DialogResult.OK Then
      rtbFastText.BackColor = ColorDialog1.Color
    End If
  End Sub
  Private Sub rtbFastText_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtbFastText.TextChanged
    rtbFastText.SelectionAlignment = HorizontalAlignment.Center
  End Sub
  Private Sub cmdStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStop.Click
    aTimer.Enabled = False
    textpointer = 0
    trkProgress.Value = textpointer
  End Sub
  Private Sub cmdPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPause.Click
    aTimer.Enabled = False
  End Sub
  Private Sub cmdSlower_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSlower.Click
    If lblSpeedRating.Text = "1" Then
    Else
      SetSpeed(lblSpeedRating.Text - 1)
    End If

  End Sub
  Private Sub cmdFaster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFaster.Click
    If lblSpeedRating.Text = "18" Then
    Else
      SetSpeed(lblSpeedRating.Text + 1)
    End If

  End Sub
  Public Sub SetSpeed(ByVal Speed As Int16)
    Dim refWPM As Int16 = 98
    Dim refTime As Int16 = 612
    Dim newWPM As Int16
    Dim newTime As Int16

    lblSpeedRating.Text = Speed
    newWPM = refWPM * Speed
    newTime = 1000 * (60 / newWPM)

    aTimer.Interval = newTime
    lblSpeed.Text = FormatNumber(60 / (0.001 * newTime), 2) & " WPM"
    lblRSpeed.Text = FormatNumber(245 / newTime, 2) & " * reading speed"
    lblSpeedRating.Text = Speed

    If Speed >= 1 Then
      lblSpeed1.BackColor = System.Drawing.Color.Green
    Else
      lblSpeed1.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 2 Then
      lblSpeed2.BackColor = System.Drawing.Color.Green
    Else
      lblSpeed2.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 3 Then
      lblSpeed3.BackColor = System.Drawing.Color.Green
    Else
      lblSpeed3.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 4 Then
      lblSpeed4.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed4.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 5 Then
      lblSpeed5.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed5.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 6 Then
      lblSpeed6.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed6.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 7 Then
      lblSpeed7.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed7.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 8 Then
      lblSpeed8.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed8.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 9 Then
      lblSpeed9.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed9.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 10 Then
      lblSpeed10.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed10.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 11 Then
      lblSpeed11.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed11.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 12 Then
      lblSpeed12.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed12.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 13 Then
      lblSpeed13.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed13.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 14 Then
      lblSpeed14.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed14.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 15 Then
      lblSpeed15.BackColor = System.Drawing.Color.Lime
    Else
      lblSpeed15.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 16 Then
      lblSpeed16.BackColor = System.Drawing.Color.Red
    Else
      lblSpeed16.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 17 Then
      lblSpeed17.BackColor = System.Drawing.Color.Red
    Else
      lblSpeed17.BackColor = System.Drawing.Color.Gray
    End If
    If Speed >= 18 Then
      lblSpeed18.BackColor = System.Drawing.Color.Red
    Else
      lblSpeed18.BackColor = System.Drawing.Color.Gray
    End If
  End Sub
  Private Sub trkProgress_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trkProgress.ValueChanged
    textpointer = trkProgress.Value
    rtbFastText.Text = temptext(textpointer)
    lblPercent.Text = FormatNumber(100 * (textpointer / UBound(temptext)), 0) & " percent"
  End Sub

  ''''''''''''''''''''
  ' button commands
  ''''''''''''''''''''
  Private Sub lblSpeed1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed1.Click
    SetSpeed(1)
  End Sub
  Private Sub lblSpeed2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed2.Click
    SetSpeed(2)
  End Sub
  Private Sub lblSpeed3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed3.Click
    SetSpeed(3)
  End Sub
  Private Sub lblSpeed4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed4.Click
    SetSpeed(4)
  End Sub
  Private Sub lblSpeed5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed5.Click
    SetSpeed(5)
  End Sub
  Private Sub lblSpeed6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed6.Click
    SetSpeed(6)
  End Sub
  Private Sub lblSpeed7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed7.Click
    SetSpeed(7)
  End Sub
  Private Sub lblSpeed8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed8.Click
    SetSpeed(8)
  End Sub
  Private Sub lblSpeed9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed9.Click
    SetSpeed(9)
  End Sub
  Private Sub lblSpeed10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed10.Click
    SetSpeed(10)
  End Sub
  Private Sub lblSpeed11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed11.Click
    SetSpeed(11)
  End Sub
  Private Sub lblSpeed12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed12.Click
    SetSpeed(12)
  End Sub
  Private Sub lblSpeed13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed13.Click
    SetSpeed(13)
  End Sub
  Private Sub lblSpeed14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed14.Click
    SetSpeed(14)
  End Sub
  Private Sub lblSpeed15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed15.Click
    SetSpeed(15)
  End Sub
  Private Sub lblSpeed16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed16.Click
    SetSpeed(16)
  End Sub
  Private Sub lblSpeed17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed17.Click
    SetSpeed(17)
  End Sub
  Private Sub lblSpeed18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSpeed18.Click
    SetSpeed(18)
  End Sub

  Private Sub cmdPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrev.Click
    If trkProgress.Value <> 0 Then
      trkProgress.Value = trkProgress.Value - 1
    End If
  End Sub
  Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
    If trkProgress.Value <> UBound(temptext) Then
      trkProgress.Value = trkProgress.Value + 1
    End If
  End Sub

  Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
    MsgBox("FastReader designed and made by Ed Goad (ed@goad.us)." & vbCrLf & "Share and enjoy.", MsgBoxStyle.OKOnly, "About: FastReader")
  End Sub
End Class
