Support Forums

Full Version: Notepad Plus + v2.5 [Coded by Ace]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10
Keep Updated on this channel as I will release newer versions in later posts throughout this thread! First thread can't be upadted anymore becuase i've maxed out on the character limit for this first post.

[Image: notepad.png]

Part 1

Description: Notepad Plus + is a project that I created originally to have my own notepad application that I could use as an alternative to the original Notepad that comes as a default application on Windows. I created it so that it's fairly customizable for the user, and it looks nice, which is an added bonus. It's really designed to fit the users needs. Later on with this project I plan on making saveable settings for the user so that everything that gets customized with my application will be a set value for future use.

File Information:
  • Filetype: Application
  • Description Notepad Plus +
  • Filesize: 752Kb
  • Original MD5: E992BB7D162FE05039E1F0B4D17B9ED1

GUI Class Theme: (To use: Add a new class to the project, delete all of the text within the class, and replace it with all of this code. After you have done that, save the class, and go to build. You should now see the theme in your toolbox. [Note: This is a custom class that I created myself.])

Code:
Imports System.Drawing.Drawing2D

Class Pigment

    Private _Name As String = "Pigment"
    Property Name() As String
        Get
            Return _Name
        End Get
        Set(ByVal v As String)
            _Name = v
        End Set
    End Property


    Private _Value As Color = Color.Black
    Public Property Value() As Color
        Get
            Return _Value
        End Get
        Set(ByVal value As Color)
            _Value = value
        End Set
    End Property


    Sub New()
    End Sub

    Sub New(ByVal n As String, ByVal v As Color)
        Name = n
        Value = v
    End Sub

    Sub New(ByVal n As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
        Name = n
        Value = Color.FromArgb(a, r, g, b)
    End Sub

    Sub New(ByVal n As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
        Name = n
        Value = Color.FromArgb(r, g, b)
    End Sub
End Class

Class FTheme
    Inherits ContainerControl


    Private _Resizeable As Boolean = True
    Public Property Resizeable() As Boolean
        Get
            Return _Resizeable
        End Get
        Set(ByVal value As Boolean)
            _Resizeable = value
        End Set
    End Property



    Sub New()
        SetStyle(DirectCast(8198, ControlStyles), True)
        C = New Pigment() { _
        New Pigment("Border", Color.Black), _
        New Pigment("Frame", 5, 5, 5), _
        New Pigment("Border Highlight", 15, 200, 255, 255), _
        New Pigment("Side Highlight", 6, 190, 255, 255), _
        New Pigment("Shine", 20, 200, 255, 255), _
        New Pigment("Shadow", 38, 38, 40), _
        New Pigment("Backcolor", 15, 15, 15), _
        New Pigment("Transparency", Color.Fuchsia) _
        }
    End Sub

    Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
        Dock = DockStyle.Fill
        If TypeOf Parent Is Form Then DirectCast(Parent, Form).FormBorderStyle = FormBorderStyle.None
        Colors = C
        MyBase.OnHandleCreated(e)
    End Sub

    Const Count As Byte = 8
    Private C As Pigment()
    Public Property Colors() As Pigment()
        Get
            Return C
        End Get
        Set(ByVal v As Pigment())
            If v.Length <> Count Then Throw New IndexOutOfRangeException

            P1 = New Pen(v(0).Value)
            P2 = New Pen(v(2).Value)

            B1 = New SolidBrush(v(6).Value)
            B2 = New SolidBrush(v(7).Value)

            If Parent IsNot Nothing Then
                Parent.BackColor = v(6).Value
                If TypeOf Parent Is Form Then DirectCast(Parent, Form).TransparencyKey = v(7).Value
            End If

            CB = New ColorBlend
            CB.Colors = New Color() {Color.Transparent, v(4).Value, Color.Transparent}
            CB.Positions = New Single() {0, 0.5, 1}

            C = v

            Invalidate()
        End Set
    End Property

    Private P1, P2, P3 As Pen
    Private B1, B2 As SolidBrush, B3, B4 As LinearGradientBrush
    Private R1, R2 As Rectangle
    Private CB As ColorBlend

    Private G As Graphics, B As Bitmap
    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
        B = New Bitmap(Width, Height)
        G = Graphics.FromImage(B)

        G.Clear(C(1).Value)


        G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))
        G.DrawRectangle(P2, New Rectangle(12, 40, Width - 24, Height - 52))


        R1 = New Rectangle(1, 0, 15, Height)
        B3 = New LinearGradientBrush(R1, C(3).Value, Color.Transparent, 90.0F)
        G.FillRectangle(B3, R1)
        G.FillRectangle(B3, New Rectangle(Width - 16, 0, 15, Height))


        G.FillRectangle(B1, New Rectangle(13, 41, Width - 26, Height - 54))


        R2 = New Rectangle(0, 2, Width, 2)
        B4 = New LinearGradientBrush(R2, Color.Empty, Color.Empty, 0)
        B4.InterpolationColors = CB
        G.FillRectangle(B4, R2)


        G.DrawRectangle(P1, New Rectangle(13, 41, Width - 26, Height - 54))
        G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))


        G.FillRectangle(B2, New Rectangle(0, 0, 2, 2))
        G.FillRectangle(B2, New Rectangle(Width - 2, 0, 2, 2))
        G.FillRectangle(B2, New Rectangle(Width - 2, Height - 2, 2, 2))
        G.FillRectangle(B2, New Rectangle(0, Height - 2, 2, 2))

        B.SetPixel(1, 1, Color.Black)
        B.SetPixel(Width - 2, 1, Color.Black)
        B.SetPixel(Width - 2, Height - 2, Color.Black)
        B.SetPixel(1, Height - 2, Color.Black)


        e.Graphics.DrawImage(B, 0, 0)
        B3.Dispose()
        B4.Dispose()
        G.Dispose()
        B.Dispose()
    End Sub


    Enum Direction As Integer
        NONE = 0
        LEFT = 10
        RIGHT = 11
        TOP = 12
        TOPLEFT = 13
        TOPRIGHT = 14
        BOTTOM = 15
        BOTTOMLEFT = 16
        BOTTOMRIGHT = 17
    End Enum
    Private Current As Direction
    Sub SetCurrent()
        Dim T As Point = PointToClient(MousePosition)
        If T.X < 7 And T.Y < 7 Then
            Current = Direction.TOPLEFT
            Cursor = Cursors.SizeNWSE
        ElseIf T.X < 7 And T.Y > Height - 7 Then
            Current = Direction.BOTTOMLEFT
            Cursor = Cursors.SizeNESW
        ElseIf T.X > Width - 7 And T.Y > Height - 7 Then
            Current = Direction.BOTTOMRIGHT
            Cursor = Cursors.SizeNWSE
        ElseIf T.X > Width - 7 And T.Y < 7 Then
            Current = Direction.TOPRIGHT
            Cursor = Cursors.SizeNESW
        ElseIf T.X < 7 Then
            Current = Direction.LEFT
            Cursor = Cursors.SizeWE
        ElseIf T.X > Width - 7 Then
            Current = Direction.RIGHT
            Cursor = Cursors.SizeWE
        ElseIf T.Y < 7 Then
            Current = Direction.TOP
            Cursor = Cursors.SizeNS
        ElseIf T.Y > Height - 7 Then
            Current = Direction.BOTTOM
            Cursor = Cursors.SizeNS
        Else
            Current = Direction.NONE
            Cursor = Cursors.Default
        End If
    End Sub
    Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
        If e.Button = MouseButtons.Left Then
            If TypeOf Parent Is Form Then
                If DirectCast(Parent, Form).WindowState = FormWindowState.Maximized Then Return
            End If
            If Drag.Contains(e.Location) Then
                Capture = False
                DefWndProc(Message.Create(Parent.Handle, 161, New IntPtr(2), Nothing))
            Else
                If Current <> Direction.NONE And _Resizeable Then
                    Capture = False
                    DefWndProc(Message.Create(Parent.Handle, 161, New IntPtr(Current), Nothing))
                End If
            End If
        End If
        MyBase.OnMouseDown(e)
    End Sub
    Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
        If _Resizeable Then SetCurrent()
        MyBase.OnMouseMove(e)
    End Sub
    Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
        Invalidate()
        MyBase.OnSizeChanged(e)
    End Sub
    Private ReadOnly Property Drag() As Rectangle
        Get
            Return New Rectangle(7, 7, Width - 14, 35)
        End Get
    End Property

End Class
Class FButton
    Inherits Control


    Private Shadow_ As Boolean = True
    Public Property Shadow() As Boolean
        Get
            Return Shadow_
        End Get
        Set(ByVal value As Boolean)
            Shadow_ = value
            Invalidate()
        End Set
    End Property


    Sub New()
        SetStyle(DirectCast(8198, ControlStyles), True)
        Colors = New Pigment() {New Pigment("Border", 150, 150, 150), New Pigment("Backcolor", 10, 10, 10), _
        New Pigment("Highlight", 150, 150, 160), New Pigment("Gradient1", 100, 100, 100), _
        New Pigment("Gradient2", 50, 50, 50), New Pigment("Text Color", Color.White), _
        New Pigment("Text Shadow", 30, 0, 0, 0)}
        Font = New Font("Verdana", 9)
    End Sub

    Const Count As Byte = 7
    Private C As Pigment()
    Public Property Colors() As Pigment()
        Get
            Return C
        End Get
        Set(ByVal v As Pigment())
            If v.Length <> Count Then Throw New IndexOutOfRangeException

            P1 = New Pen(v(0).Value)
            P2 = New Pen(v(2).Value)

            B1 = New SolidBrush(v(6).Value)
            B2 = New SolidBrush(v(5).Value)

            C = v
            Invalidate()
        End Set
    End Property

    Private P1, P2 As Pen
    Private B1, B2 As SolidBrush, B3 As LinearGradientBrush
    Private SZ As Size, PT As Point

    Private G As Graphics, B As Bitmap
    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
        B = New Bitmap(Width, Height)
        G = Graphics.FromImage(B)

        If Down Then
            B3 = New LinearGradientBrush(ClientRectangle, C(4).Value, C(3).Value, 90.0F)
        Else
            B3 = New LinearGradientBrush(ClientRectangle, C(3).Value, C(4).Value, 90.0F)
        End If
        G.FillRectangle(B3, ClientRectangle)

        If Not String.IsNullOrEmpty(Text) Then
            SZ = G.MeasureString(Text, Font).ToSize
            PT = New Point(CInt(Width / 2 - SZ.Width / 2), CInt(Height / 2 - SZ.Height / 2))
            If Shadow_ Then G.DrawString(Text, Font, B1, PT.X + 1, PT.Y + 1)
            G.DrawString(Text, Font, B2, PT)
        End If

        G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))
        G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))

        B.SetPixel(0, 0, C(1).Value)
        B.SetPixel(Width - 1, 0, C(1).Value)
        B.SetPixel(Width - 1, Height - 1, C(1).Value)
        B.SetPixel(0, Height - 1, C(1).Value)

        e.Graphics.DrawImage(B, 0, 0)
        B3.Dispose()
        G.Dispose()
        B.Dispose()
    End Sub

    Private Down As Boolean
    Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
        If e.Button = MouseButtons.Left Then
            Down = True
            Invalidate()
        End If
        MyBase.OnMouseDown(e)
    End Sub
    Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
        Down = False
        Invalidate()
        MyBase.OnMouseUp(e)
    End Sub

End Class
Class FProgressBar
    Inherits Control

    Private _Maximum As Double = 100
    Public Property Maximum() As Double
        Get
            Return _Maximum
        End Get
        Set(ByVal v As Double)
            _Maximum = v
            Progress = _Current / v * 100
        End Set
    End Property
    Private _Current As Double
    Public Property Current() As Double
        Get
            Return _Current
        End Get
        Set(ByVal v As Double)
            Progress = v / _Maximum * 100
        End Set
    End Property
    Private _Progress As Double
    Public Property Progress() As Double
        Get
            Return _Progress
        End Get
        Set(ByVal v As Double)
            If v < 0 Then v = 0 Else If v > 100 Then v = 100
            _Progress = v
            _Current = v * 0.01 * _Maximum
            Invalidate()
        End Set
    End Property

    Sub New()
        SetStyle(DirectCast(8198, ControlStyles), True)
        Colors = New Pigment() { _
        New Pigment("Border", 200, 200, 200), New Pigment("Backcolor1", 30, 30, 30), _
        New Pigment("Backcolor2", 240, 240, 240), New Pigment("Highlight", 240, 240, 255, 255), _
        New Pigment("Forecolor", 175, 175, 175), New Pigment("Gloss", 240, 240, 255, 255)}
    End Sub

    Const Count As Byte = 6
    Private C As Pigment()
    Public Property Colors() As Pigment()
        Get
            Return C
        End Get
        Set(ByVal v As Pigment())
            If v.Length <> Count Then Throw New IndexOutOfRangeException

            P1 = New Pen(v(0).Value)
            P2 = New Pen(v(3).Value)

            B1 = New SolidBrush(v(4).Value)

            CB = New ColorBlend
            CB.Colors = New Color() {v(5).Value, Color.Transparent, Color.Transparent}
            CB.Positions = New Single() {0, 0.3, 1}

            C = v
            Invalidate()
        End Set
    End Property

    Private P1, P2 As Pen
    Private B1 As SolidBrush, B2 As LinearGradientBrush
    Private CB As ColorBlend

    Private G As Graphics, B As Bitmap
    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
        B = New Bitmap(Width, Height)
        G = Graphics.FromImage(B)

        G.Clear(C(2).Value)

        G.FillRectangle(B1, New Rectangle(1, 1, CInt((Width * _Progress * 0.01) - 2), Height - 2))

        B2 = New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 90.0F)
        B2.InterpolationColors = CB
        G.FillRectangle(B2, ClientRectangle)

        G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))
        G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))

        B.SetPixel(0, 0, C(1).Value)
        B.SetPixel(Width - 1, 0, C(1).Value)
        B.SetPixel(Width - 1, Height - 1, C(1).Value)
        B.SetPixel(0, Height - 1, C(1).Value)

        e.Graphics.DrawImage(B, 0, 0)
        B2.Dispose()
        G.Dispose()
        B.Dispose()
    End Sub

    Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
        Invalidate()
        MyBase.OnSizeChanged(e)
    End Sub
End Class

Main Form Source:
Code:
Option Strict On
Imports System.IO
Imports System.Text
Imports System.Text.RegularExpressions

Public Class Form1

    Dim StringForTextFile As String = ""

    Private Sub WriteTextFile()
        Dim f As String = SaveFileDialog1.FileName
        Dim s As String = f.Substring(f.LastIndexOf("\"c) + 1)

        StringForTextFile = RichTextBox1.Text

        If File.Exists(filepath.Text) = True Then
            Try
                My.Computer.FileSystem.DeleteFile(filepath.Text) ' Delete file if it already exists first before you write new file
            Catch ex As Exception
                MessageBox.Show("Unable to replace the file. File may have been currupted or is attributed to prevent being modified. " & ex.ToString, "   Save Failure           ", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub
            End Try
        End If
        Try
            Dim WriteTextFile As TextWriter
            WriteTextFile = New StreamWriter(filepath.Text)

            WriteTextFile.Write(StringForTextFile)
            WriteTextFile.Close()
        Catch ex As Exception
            MessageBox.Show("Unable to write the file. " & ex.ToString, "   File wasn't written          ", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
        RichTextBox1.Clear()

        Dim intFirstChar As Integer = Me.RichTextBox1.GetCharIndexFromPosition(New Point(0, 0))
        Dim intFirstLine As Integer = Me.RichTextBox1.GetLineFromCharIndex(intFirstChar)
        Dim intCharCount As Integer = (Me.RichTextBox1.SelectionStart + Me.RichTextBox1.SelectionLength) - intFirstChar
        Dim strFromStart As String = Me.RichTextBox1.Text.Substring(intFirstChar, intCharCount)
        Dim intLine As Integer = strFromStart.Split(CChar(vbLf)).Length
        ToolStripStatusLabel3.Text = " " & (intCharCount - strFromStart.LastIndexOf(vbLf))
        ToolStripStatusLabel5.Text = " " & intFirstLine + intLine
        SaveToolStripMenuItem.Enabled = False
        AlwaysOnTopToolStripMenuItem.Checked = False

        RichTextBox1.AllowDrop = True

        'This is IMPORTANT for the Save Feature, it gets the directory to replace the existing file.
        'filepath.Visible = False



        'This will automatically make the textbox ready to type in when the form loads !important
        RichTextBox1.Focus()
        TitleFilename.Text = ""

        ToolStripStatusLabel13.Text = " " & (Me.RichTextBox1.SelectionStart + Me.RichTextBox1.SelectionLength)

    End Sub

    Private Sub Form_Close(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If SaveToolStripMenuItem.Enabled = False Then
            Application.Exit()
        ElseIf SaveToolStripMenuItem.Enabled = True Then
            Dim msg = "Do you want to save the current document first?"
            Dim title = "Important"
            Dim style = MsgBoxStyle.YesNoCancel
            Dim response = MsgBox(msg, style, title)

            If response = MsgBoxResult.Yes Then
                If filepath.Text = "filepath" Then
                    SaveFileDialog1.Filter = "Text file (*.txt)|*.txt|All files (*.*)|*.*"
                    SaveFileDialog1.InitialDirectory = "C:\"
                    SaveFileDialog1.ShowDialog()

                    If SaveFileDialog1.FileName <> "" Then

                        FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)

                        PrintLine(1, RichTextBox1.Text)

                        FileClose(1)

                    End If

                Else
                    WriteTextFile()
                End If
            ElseIf response = MsgBoxResult.No Then
                Application.Exit()
            ElseIf response = MsgBoxResult.Cancel Then
                e.Cancel = True
            End If

        End If
    End Sub

    Private PlaceHolder As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseButton.Click
        Application.Exit()
    End Sub

    Private Sub ExitApp_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyDown
        If e.KeyCode = Keys.Escape Then
            Application.Exit()
        End If
    End Sub

    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click 'DONE
        If filepath.Text = "filepath" Then
            If SaveToolStripMenuItem.Enabled = True Then
                Dim msg = "Do you want to save the current document first?"
                Dim title = "Important"
                Dim style = MsgBoxStyle.YesNoCancel
                Dim response = MsgBox(msg, style, title)

                If response = MsgBoxResult.Yes Then

                    SaveFileDialog1.Filter = "Text file (*.txt)|*.txt|All files (*.*)|*.*"

                    SaveFileDialog1.ShowDialog()

                    If SaveFileDialog1.FileName <> "" Then

                        FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)

                        PrintLine(1, RichTextBox1.Text)

                        FileClose(1)



                    End If
                    RichTextBox1.Clear()
                    SaveToolStripMenuItem.Enabled = False
                    filepath.Text = "filepath"
                    TitleFilename.Text = ""
                    Exit Sub
                ElseIf response = MsgBoxResult.No Then
                    RichTextBox1.Text = ""
                    filepath.Text = "filepath"
                    SaveToolStripMenuItem.Enabled = False
                    TitleFilename.Text = ""
                Else
                    Exit Sub
                End If
            End If

        ElseIf SaveToolStripMenuItem.Enabled = False Then
            RichTextBox1.Clear()
            filepath.Text = "filepath"
            TitleFilename.Text = ""
        End If

        If Not filepath.Text = "filepath" Then
            If SaveToolStripMenuItem.Enabled = True Then
                Dim msg = "Do you want to save the current document first?"
                Dim title = "Important"
                Dim style = MsgBoxStyle.YesNoCancel
                Dim response = MsgBox(msg, style, title)

                If response = MsgBoxResult.Yes Then

                    If File.Exists(filepath.Text) = True Then
                        TitleFilename.Text = ""
                        WriteTextFile()

                        RichTextBox1.Clear()
                        filepath.Text = "filepath"
                        SaveToolStripMenuItem.Enabled = False
                    End If


                ElseIf response = MsgBoxResult.No Then
                    RichTextBox1.Clear()
                    filepath.Text = "filepath"
                    SaveToolStripMenuItem.Enabled = False
                    TitleFilename.Text = ""

                Else
                    Exit Sub
                End If
            End If
            End If

    End Sub

    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click 'DONE

        If SaveToolStripMenuItem.Enabled = True Then
            Dim msg = "Do you want to save the current document first?"
            Dim title = "Important"
            Dim style = MsgBoxStyle.YesNoCancel
            Dim response = MsgBox(msg, style, title)

            If response = MsgBoxResult.Yes Then
                If File.Exists(filepath.Text) = True Then
                    TitleFilename.Text = TitleFilename.Text
                    WriteTextFile()
                ElseIf filepath.Text = "filepath" Then
                    SaveToolStripMenuItem.Enabled = False
                    SaveAsToolStripMenuItem.PerformClick()
                End If

            ElseIf response = MsgBoxResult.No Then
                SaveToolStripMenuItem.Enabled = False
            Else
                Exit Sub
            End If
        End If

        Dim AllText As String = "", Lineoftext As String = ""

        OpenFileDialog1.InitialDirectory = "C:\"
        OpenFileDialog1.FileName = ""
        OpenFileDialog1.Filter = "All Files |*.*"
        OpenFileDialog1.ShowDialog()

        With OpenFileDialog1

            If CBool(Windows.Forms.DialogResult.OK) Then
                If OpenFileDialog1.FileName <> "" Then
                    Try

                        FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)

                        Do Until EOF(1)

                            Lineoftext = LineInput(1)

                            AllText = AllText & Lineoftext & vbCrLf

                        Loop

                        RichTextBox1.Text = AllText

                    Catch

                    Finally

                        FileClose(1)

                        Dim f As String = OpenFileDialog1.FileName
                        Dim s As String = f.Substring(f.LastIndexOf("\"c) + 1)
                        TitleFilename.Text = s

                        filepath.Text = OpenFileDialog1.FileName

                        SaveToolStripMenuItem.Enabled = False

                    End Try
                End If

                'Option Strict on disallows implicit conversions from 'system.windows.forms.dialogresult' to 'Boolean'
            ElseIf CBool(Windows.Forms.DialogResult.Cancel) Then
                TitleFilename.Text = TitleFilename.Text
            End If

            'Displays the Length value in status bar at bottom of application when file is opened
            ToolStripStatusLabel13.Text = " " & (Me.RichTextBox1.TextLength)
        End With

    End Sub

    Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click 'DONE
        If filepath.Text = "filepath" Then
            SaveAsToolStripMenuItem.PerformClick()

        ElseIf File.Exists(filepath.Text) = True Then
            TitleFilename.Text = TitleFilename.Text
            WriteTextFile()
        Else
            SaveAsToolStripMenuItem.PerformClick()
        End If
        SaveToolStripMenuItem.Enabled = False

    End Sub

    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAsToolStripMenuItem.Click 'DONE
        With SaveFileDialog1
            SaveFileDialog1.InitialDirectory = "C:\"
            SaveFileDialog1.FileName = ""
            SaveFileDialog1.Filter = "Text file (*.txt)|*.txt|All files (*.*)|*.*"
            SaveFileDialog1.ShowDialog()

            If CBool(Windows.Forms.DialogResult.OK) Then


                If SaveFileDialog1.FileName <> "" Then

                    FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)

                    PrintLine(1, RichTextBox1.Text)

                    FileClose(1)

                    Dim f As String = SaveFileDialog1.FileName
                    Dim s As String = f.Substring(f.LastIndexOf("\"c) + 1)

                    TitleFilename.Text = s

                    filepath.Text = SaveFileDialog1.FileName
                    SaveToolStripMenuItem.Enabled = False
                End If

            ElseIf CBool(Windows.Forms.DialogResult.Cancel) Then
                TitleFilename.Text = TitleFilename.Text

            End If

        End With

    End Sub

    'Drag enter
    Private Sub RichTextBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles RichTextBox1.DragEnter
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            'Shows the copy icon with dragging file over richtextbox
            e.Effect = DragDropEffects.Copy
        Else
            e.Effect = DragDropEffects.None
        End If
    End Sub

    'NEED TO GET THE DROP TO ACTIVATE THE TEXT LENGTH OF THE EDITOR'S CONTROL
    Private Sub RichTextBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles RichTextBox1.DragDrop 'DONE
        Dim MyFiles() As String

        ToolStripStatusLabel13.Text = " " & (RichTextBox1.TextLength)

        If e.Data.GetDataPresent(DataFormats.FileDrop) Then

            If SaveToolStripMenuItem.Enabled = True Then

                Dim msg = "Do you want to save the current document first?"
                Dim title = "Important"
                Dim style = MsgBoxStyle.YesNoCancel
                Dim response = MsgBox(msg, style, title)

                If response = MsgBoxResult.Yes Then

                    MyFiles = CType(e.Data.GetData(DataFormats.FileDrop), String())

                    If filepath.Text = "filepath" Then
                        SaveFileDialog1.Filter = "Text file (*.txt)|*.txt|All files (*.*)|*.*"

                        SaveFileDialog1.ShowDialog()

                        If SaveFileDialog1.FileName <> "" Then

                            FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)

                            PrintLine(1, RichTextBox1.Text)

                            FileClose(1)

                        End If
                    ElseIf File.Exists(filepath.Text) Then
                        WriteTextFile()
                    End If

                    SaveToolStripMenuItem.Enabled = False
                    filepath.Text = MyFiles(0)

                    ' Display the file Name in titlebar
                    Dim f As String = MyFiles(0)
                    Dim s As String = f.Substring(f.LastIndexOf("\"c) + 1)
                    TitleFilename.Text = s

                    ' Display the file contents
                    RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(MyFiles(0))

                ElseIf response = MsgBoxResult.No Then

                    MyFiles = CType(e.Data.GetData(DataFormats.FileDrop), String())
                    filepath.Text = MyFiles(0)
                    SaveToolStripMenuItem.Enabled = False

                    Dim f As String = MyFiles(0)
                    Dim s As String = f.Substring(f.LastIndexOf("\"c) + 1)
                    TitleFilename.Text = s

                    RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(MyFiles(0))

                Else
                    Exit Sub
                End If
            End If


            If SaveToolStripMenuItem.Enabled = False Then
                MyFiles = CType(e.Data.GetData(DataFormats.FileDrop), String())
                RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(MyFiles(0))
                SaveToolStripMenuItem.Enabled = False
                filepath.Text = MyFiles(0)

                Dim f As String = MyFiles(0)
                Dim s As String = f.Substring(f.LastIndexOf("\"c) + 1)
                TitleFilename.Text = s

            End If
        End If

    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Application.Exit()
    End Sub

    Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click
        RichTextBox1.Undo()
    End Sub

    Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click
        RichTextBox1.Redo()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
        RichTextBox1.Cut()
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
        RichTextBox1.Copy()
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
        'This will paste the text unformatted so that it will always be copied into your Richtextbox with your default formatting settings.
        RichTextBox1.Paste(DataFormats.GetFormat(DataFormats.Text))
    End Sub

    Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click
        RichTextBox1.SelectAll()
    End Sub

    Private Sub ClearAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearAllToolStripMenuItem.Click
        RichTextBox1.Text = ""
    End Sub

    Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
        Dim fd As New Windows.Forms.FontDialog
        fd.Font = RichTextBox1.Font
        If fd.ShowDialog <> DialogResult.Cancel Then
            RichTextBox1.Font = fd.Font
        End If
    End Sub

    Private Sub FontToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextColorToolStripMenuItem.Click
        Dim ffc As New Windows.Forms.ColorDialog
        ffc.Color = RichTextBox1.ForeColor
        ffc.Color = TitleFilename.ForeColor
        ffc.Color = Label1.ForeColor
        If ffc.ShowDialog <> DialogResult.Cancel Then
            RichTextBox1.ForeColor = ffc.Color
            TitleFilename.ForeColor = ffc.Color
            Label1.ForeColor = ffc.Color
        End If
    End Sub

    Private Sub BackgroundToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackgroundColorToolStripMenuItem.Click
        Dim ffc As New Windows.Forms.ColorDialog
        ffc.Color = RichTextBox1.BackColor
        If ffc.ShowDialog <> DialogResult.Cancel Then
            RichTextBox1.BackColor = ffc.Color
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MinimizeButton.Click
        Me.WindowState = FormWindowState.Minimized
    End Sub

    'Updates line and column numbers as you type into the control or paste, (textchanged)
    Private Sub RichTextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
        Dim intFirstChar As Integer = Me.RichTextBox1.GetCharIndexFromPosition(New Point(0, 0))
        Dim intFirstLine As Integer = Me.RichTextBox1.GetLineFromCharIndex(intFirstChar)
        Dim intCharCount As Integer = (Me.RichTextBox1.SelectionStart + Me.RichTextBox1.SelectionLength) - intFirstChar
        Dim strFromStart As String = Me.RichTextBox1.Text.Substring(intFirstChar, intCharCount)
        Dim intLine As Integer = strFromStart.Split(CChar(vbLf)).Length
        Me.ToolStripStatusLabel3.Text = " " & intFirstLine + intLine
        Me.ToolStripStatusLabel5.Text = " " & (intCharCount - strFromStart.LastIndexOf(vbLf))

        ToolStripStatusLabel13.Text = " " & (Me.RichTextBox1.TextLength)

        If RichTextBox1.Modified Then
            SaveToolStripMenuItem.Enabled = True
        End If

    End Sub

    Private Sub RichTextBox1_TabKey(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyDown
        'key(value = TAB())
        If e.KeyCode = Keys.Tab Then

            If FormTabs.NumericUpDown1.Text = "2" Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "  "

            ElseIf FormTabs.NumericUpDown1.Text = "3" Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "   "

            ElseIf FormTabs.NumericUpDown1.Text = "4" Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "    "

            ElseIf FormTabs.NumericUpDown1.Text = "5" Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "     "

            ElseIf FormTabs.NumericUpDown1.Text = "6" Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "      "

            ElseIf FormTabs.NumericUpDown1.Text = "7" Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "       "

            ElseIf FormTabs.NumericUpDown1.Text = "8" Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "        "

            ElseIf FormTabs.NumericUpDown1.Text = "9" Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "         "

            Else
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "    "

            End If
        End If
    End Sub

    'When user holds down Ctrl Key and uses the mouse scroll it will zoom in or out by 1.0F
    Private Sub RichTextBox1_MouseWheel(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.MouseWheel
        RichTextBox1.ZoomFactor = 1
    End Sub

    Private Sub DefaultSettingToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DefaultSettingToolStripMenuItem.Click
        'we have to give the default setting a reference zoom level, so we'll use the zoom as this
        RichTextBox1.ZoomFactor = 1.5
        'then from that we'll go back to 1 which should be the original zoom setting
        RichTextBox1.ZoomFactor = 1
    End Sub

    'gets the line and column numbers in the status label when the cursor location is changed upon mouse click
    Private Sub RichTextBox1_ClickCursor(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.MouseClick
        Dim intFirstChar As Integer = Me.RichTextBox1.GetCharIndexFromPosition(New Point(0, 0))
        Dim intFirstLine As Integer = Me.RichTextBox1.GetLineFromCharIndex(intFirstChar)
        Dim intCharCount As Integer = (Me.RichTextBox1.SelectionStart + Me.RichTextBox1.SelectionLength) - intFirstChar
        Dim strFromStart As String = Me.RichTextBox1.Text.Substring(intFirstChar, intCharCount)
        Dim intLine As Integer = strFromStart.Split(CChar(vbLf)).Length
        Me.ToolStripStatusLabel3.Text = " " & intFirstLine + intLine
        Me.ToolStripStatusLabel5.Text = " " & (intCharCount - strFromStart.LastIndexOf(vbLf))
    End Sub

    'gets the line and column numbers in the status label when the cursor location is changed
    Private Sub RichTextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyUp
        Dim intFirstChar As Integer = Me.RichTextBox1.GetCharIndexFromPosition(New Point(0, 0))
        Dim intFirstLine As Integer = Me.RichTextBox1.GetLineFromCharIndex(intFirstChar)
        Dim intCharCount As Integer = (Me.RichTextBox1.SelectionStart + Me.RichTextBox1.SelectionLength) - intFirstChar
        Dim strFromStart As String = Me.RichTextBox1.Text.Substring(intFirstChar, intCharCount)
        Dim intLine As Integer = strFromStart.Split(CChar(vbLf)).Length

        If e.KeyCode = Keys.Left Then
            'This is associated with the line display so up and down arrow keys
            Me.ToolStripStatusLabel3.Text = " " & intFirstLine + intLine
            Me.ToolStripStatusLabel5.Text = " " & (intCharCount - strFromStart.LastIndexOf(vbLf))
        End If
        If e.KeyCode = Keys.Right Then
            'This is associated with the line display so up and down arrow keys
            Me.ToolStripStatusLabel3.Text = " " & intFirstLine + intLine
            Me.ToolStripStatusLabel5.Text = " " & (intCharCount - strFromStart.LastIndexOf(vbLf))
        End If

        If e.KeyCode = Keys.Up Then
            'This is associated with the column display so left and right arrow keys
            Me.ToolStripStatusLabel5.Text = " " & (intCharCount - strFromStart.LastIndexOf(vbLf))
            Me.ToolStripStatusLabel3.Text = " " & intFirstLine + intLine
        End If
        If e.KeyCode = Keys.Down Then
            'This is associated with the column display so left and right arrow keys
            Me.ToolStripStatusLabel5.Text = " " & (intCharCount - strFromStart.LastIndexOf(vbLf))
            Me.ToolStripStatusLabel3.Text = " " & intFirstLine + intLine
        End If

    End Sub

    Private Sub RichTextBox1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.SelectionChanged
        'Get the text length of the selected text in the editor
        ToolStripStatusLabel13.Text = CStr(RichTextBox1.SelectedText.Length)
        'Get the total text length if there is no selection of text
        If RichTextBox1.SelectedText.Length = 0 Then
            ToolStripStatusLabel13.Text = CStr(RichTextBox1.TextLength)
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutButton.Click
        MsgBox("This program was coded by Infinity ©2011" & vbNewLine & vbNewLine & "             http://supportforums.net", MsgBoxStyle.Information, "About")
    End Sub

    Private Sub InfinityHomepageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InfinityHomepageToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http://www.supportforums.net/member.php?action=profile&uid=4546")
    End Sub

    Private Sub VisitSupportForumsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VisitSupportForumsToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http://www.supportforums.net")
    End Sub

    Private Sub UndoToolStripMenuItem1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem1.Click
        UndoToolStripMenuItem.PerformClick()
    End Sub

    Private Sub RedoToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem1.Click
        RedoToolStripMenuItem.PerformClick()
    End Sub

    Private Sub CutToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem1.Click
        CutToolStripMenuItem.PerformClick()
    End Sub

    Private Sub CopyToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem1.Click
        CopyToolStripMenuItem.PerformClick()
    End Sub

    Private Sub PasteToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem1.Click
        PasteToolStripMenuItem.PerformClick()
    End Sub

    Private Sub ContextMenuStrip1_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening

        If Clipboard.ContainsText Then
            PasteToolStripMenuItem1.Enabled = True
        Else
            PasteToolStripMenuItem1.Enabled = False
        End If

    End Sub

    Private Sub WordWrapToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WordWrapToolStripMenuItem.Click
        If WordWrapToolStripMenuItem.Checked Then
            RichTextBox1.WordWrap = False
            WordWrapToolStripMenuItem.Checked = False
            ToolStripStatusLabel7.Text = "Off"
        Else
            RichTextBox1.WordWrap = True
            WordWrapToolStripMenuItem.Checked = True
            ToolStripStatusLabel7.Text = "On"
        End If
    End Sub

    Private Sub FindToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindToolStripMenuItem.Click
        FormFind.Show()
        If Me.RichTextBox1.SelectionLength = 0 Then
            FormFind.txtFind.Text = ""
            FormFind.btnReplaceAll.Enabled = False
        Else
            FormFind.txtFind.Text = Me.RichTextBox1.SelectedText
            FormFind.btnReplaceAll.Enabled = True
        End If
    End Sub

    Private Sub ReplaceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MsgBox("This feature will be available at some point in other versions of this program", MsgBoxStyle.Information, "Not Available")
    End Sub

    Private Sub ToLowercaseToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToLowercaseToolStripMenuItem1.Click
        ToLowerToolStripMenuItem.PerformClick()
    End Sub

    Private Sub ToUppercaseToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToUppercaseToolStripMenuItem1.Click
        ToUpperToolStripMenuItem.PerformClick()
    End Sub

    Private Sub ToUpperToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToUpperToolStripMenuItem.Click
        RichTextBox1.SelectedText = RichTextBox1.SelectedText.ToUpper
    End Sub

    Private Sub ToLowercaseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToLowerToolStripMenuItem.Click
        RichTextBox1.SelectedText = RichTextBox1.SelectedText.ToLower
    End Sub

    Private Sub ReverseTextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReverseTextToolStripMenuItem.Click
        RichTextBox1.SelectedText = StrReverse(RichTextBox1.SelectedText)
    End Sub

    Private Sub AppendCurrentDateTimeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CurrentDateTimeToolStripMenuItem.Click
        RichTextBox1.SelectedText = FormatDateTime(Now)
    End Sub

    Private Sub AlwaysOnTopToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AlwaysOnTopToolStripMenuItem.Click
        If AlwaysOnTopToolStripMenuItem.Checked Then
            Me.TopMost = False
            AlwaysOnTopToolStripMenuItem.Checked = False
        ElseIf AlwaysOnTopToolStripMenuItem.Checked = False Then
            Me.TopMost = True
            AlwaysOnTopToolStripMenuItem.Checked = True
        End If
    End Sub

    Private Sub AddCurrentDatetimeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddCurrentDatetimeToolStripMenuItem.Click
        CurrentDateTimeToolStripMenuItem.PerformClick()
    End Sub

    Private Sub ZoomDefaultToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        RichTextBox1.ZoomFactor = CSng(1)
    End Sub

    Private Sub ZoomInToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        RichTextBox1.ZoomFactor = CSng(1.5)
    End Sub

    Private Sub ZoomOutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        RichTextBox1.ZoomFactor = CSng(0.5)
    End Sub

    Private Sub FindToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindToolStripMenuItem1.Click
        FindToolStripMenuItem.PerformClick()
    End Sub

    Private Sub ReverseTextToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReverseTextToolStripMenuItem3.Click
        ReverseTextToolStripMenuItem.PerformClick()
    End Sub

    Private Sub AllowDragDropToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AllowDragDropToolStripMenuItem.Click
        If AllowDragDropToolStripMenuItem.Checked Then
            AllowDragDropToolStripMenuItem.Checked = False
            RichTextBox1.AllowDrop = False
        ElseIf AllowDragDropToolStripMenuItem.Checked = False Then
            AllowDragDropToolStripMenuItem.Checked = True
            RichTextBox1.AllowDrop = True
        End If
    End Sub

    'Zoom options for the richtextbox
    Private Sub HelpToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem1.Click
        MsgBox("You can zoom in or out by holding down the Ctrl key and using your mouse scroll. If you want to go back to the default zoom setting for the text, just use the Default Settings option above this help button.", MsgBoxStyle.Information, "Zoom Help")
    End Sub

    Private Sub DefaultSettingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
    Private Sub ZoomDefaultToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZoomDefaultToolStripMenuItem.Click
        DefaultSettingToolStripMenuItem.PerformClick()
    End Sub

    Private Sub HelpToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem2.Click
        HelpToolStripMenuItem1.PerformClick()
    End Sub

    'This next bit will go to the current location of the I-beam within the editor (Richtextbox control)
    Private Sub GotoCursorPositionToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GotoCursorPositionToolStripMenuItem.Click
        GotoCursorPositionToolStripMenuItem1.PerformClick()
    End Sub

    Private Sub GotoCursorPositionToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GotoCursorPositionToolStripMenuItem1.Click
        RichTextBox1.ScrollToCaret()
    End Sub

    'This next bit of code just fixes a bug that I had with the class theme that I was using, not a big deal. From here on though is just the fix.
    Private Sub MenuStrip1_MouseMove(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuStrip1.MouseMove
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub FileToolStripMenuItem_MouseMove(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileToolStripMenuItem.MouseMove
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub EditToolStripMenuItem_MouseMove(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditToolStripMenuItem.MouseMove
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub ViewToolStripMenuItem_MouseMove(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewToolStripMenuItem.MouseMove
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub FormatToolStripMenuItem_MouseMove(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FormatToolStripMenuItem.MouseMove
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub HelpToolStripMenuItem_MouseMove(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.MouseMove
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub StatusStrip1_MouseMove(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusStrip1.MouseMove
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub FileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileToolStripMenuItem.MouseUp
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub EditToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditToolStripMenuItem.MouseUp
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub ViewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewToolStripMenuItem.MouseUp
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub FormatToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FormatToolStripMenuItem.MouseUp
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.MouseUp
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub TitleFilename_Over(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles TitleFilename.MouseMove
        Cursor.Current = Cursors.Arrow
        Static lx As Single, ly As Single
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Me.Left = CInt(Me.Left + e.X - lx)
            Me.Top = CInt(Me.Top + e.Y - ly)
        Else
            lx = e.X
            ly = e.Y
        End If
    End Sub

    Private Sub Label1_Over(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles Label1.MouseMove
        Cursor.Current = Cursors.Arrow
        Static lx As Single, ly As Single
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Me.Left = CInt(Me.Left + e.X - lx)
            Me.Top = CInt(Me.Top + e.Y - ly)
        Else
            lx = e.X
            ly = e.Y
        End If
    End Sub

    Private Sub TitleFilename_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TitleFilename.MouseDown
        Cursor.Current = Cursors.Arrow
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.MouseDown
        Cursor.Current = Cursors.Arrow
    End Sub

    'End of cursor settings codes

    Private Sub TabConfigurationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabConfigurationToolStripMenuItem.Click
        FormTabs.ShowDialog()
    End Sub

    Private Sub RichTextBox1_MouseWheel(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseWheel

    End Sub
End Class

Find Form Source:
Code:
Public Class FormFind
    Private PlaceHolder As Integer

    'Only allow numbers in goto line textbox
    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtGotoLine.KeyPress
        txtGotoLine.ForeColor = Color.Black
        If Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso Not IsNumeric(e.KeyChar) Then
            e.Handled = True
            Exit Sub
        End If
    End Sub

    Private Sub frmFind_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtFind.Focus()
        txtGotoLine.ForeColor = Color.Gray
        txtGotoLine.Text = "Enter a line number..."

        PlaceHolder = Form1.RichTextBox1.SelectionStart
        If Form1.RichTextBox1.SelectionLength = 0 Then
            Me.txtFind.Text = ""
            btnReplaceAll.Enabled = False
        Else
            Me.txtFind.Text = Form1.RichTextBox1.SelectedText
            btnReplaceAll.Enabled = True
        End If
    End Sub

    'On form deactivated go to form make form a bit more transparent
    Private Sub frmFind_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Deactivate
        Me.Opacity = 0.75
    End Sub

    'On form activated go to full opacity
    Private Sub frmFind_GotFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Activated
        Me.Opacity = 100
    End Sub

    Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindNext.Click
        Dim x As Integer
        Dim opt As RichTextBoxFinds = 0
        If ckCaseSensitive.Checked Then opt = opt Or RichTextBoxFinds.MatchCase
        If ckWholeWord.Checked Then opt = opt Or RichTextBoxFinds.WholeWord
        x = Form1.RichTextBox1.Find(txtFind.Text, PlaceHolder, opt)

        PlaceHolder = Form1.RichTextBox1.SelectionStart + 1

        'MsgBox("The text you searched for was not found in the document", MsgBoxStyle.Information, "Error")

        If x < 0 Then
            If MessageBox.Show("There are no more occurances of the text " & txtFind.Text & vbCrLf & "or the text does not exist in the document. Would you like to start from the beginning of the document?", "Not found", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.Yes Then
                PlaceHolder = 0
                btnFindNext.PerformClick()
            End If
        End If
    End Sub

    Private Sub btnReplace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReplace.Click
        If Form1.RichTextBox1.SelectionLength = 0 Then
            MsgBox("Please make a selection over the text you wish to replace within the editor itself, then try again.", MsgBoxStyle.Information, "Information")
            Exit Sub
        ElseIf Form1.RichTextBox1.SelectionLength > 0 Then
            Form1.RichTextBox1.SelectedText = txtReplace.Text
        End If
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub

    Private Sub btnFindNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindNext.Click

    End Sub

    Private Sub btnReplaceAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReplaceAll.Click
        Dim x As Integer
        Dim opt As RichTextBoxFinds = 0
        If ckCaseSensitive.Checked Then opt = opt Or RichTextBoxFinds.MatchCase
        If ckWholeWord.Checked Then opt = opt Or RichTextBoxFinds.WholeWord
        PlaceHolder = 0
        Do
            x = Form1.RichTextBox1.Find(txtFind.Text, PlaceHolder, opt)
            If x < 0 Then
                Exit Do
            Else
                Form1.RichTextBox1.SelectedText = txtReplace.Text
            End If
            PlaceHolder = Form1.RichTextBox1.SelectionStart + 0
        Loop

    End Sub

    Private Sub txtFind_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFind.TextChanged
        If txtFind.Text = "" Then
            btnReplaceAll.Enabled = False
        Else
            btnReplaceAll.Enabled = True
        End If
    End Sub

    Private Sub GoToLineAndColumn(ByVal RTB As RichTextBox, ByVal Line As Integer, ByVal Column As Integer)
        Dim offset As Integer = 0
        Dim i As Integer
        For i = 0 To Line - 1
            offset += Form1.RichTextBox1.Lines(i).Length + 1
        Next i

        Form1.RichTextBox1.Focus()
        Form1.RichTextBox1.Select(offset + Column, 0)
    End Sub

    Private Sub GotoLine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GotoLine.Click
        Dim intFirstChar As Integer = Form1.RichTextBox1.GetCharIndexFromPosition(New Point(0, 0))
        Dim intFirstLine As Integer = Form1.RichTextBox1.GetLineFromCharIndex(intFirstChar)
        Dim intCharCount As Integer = (Form1.RichTextBox1.SelectionStart + Form1.RichTextBox1.SelectionLength) - intFirstChar
        Dim strFromStart As String = Form1.RichTextBox1.Text.Substring(intFirstChar, intCharCount)
        Dim intLine As Integer = strFromStart.Split(CChar(vbLf)).Length

        'counts the total number of lines in the textbox
        Dim totallines As Integer = Form1.RichTextBox1.Lines.Length.ToString()
        'If the specified goto line, is greater than the total number of lines in the textbox
        If txtGotoLine.Text > totallines Then
            MsgBox("The line you specified is beyond the amount of lines you have within the editor currently. You will be directed to the end of the document", MsgBoxStyle.Information, "Line not found")
            Me.GoToLineAndColumn(Form1.RichTextBox1, intLine, 0)
            Exit Sub
        Else
            '0 is counted as the first line in integers so we'll minus 1 from the txtbox input to counter that.
            Me.GoToLineAndColumn(Form1.RichTextBox1, (txtGotoLine.Text - 1), 0)
        End If
    End Sub

    Private Sub txtGotoLine_GotFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtGotoLine.GotFocus
        If txtGotoLine.Text = "Enter a line number..." Then
            txtGotoLine.Text = ""
            txtGotoLine.ForeColor = Color.Gray
        ElseIf Not txtGotoLine.Text = "Enter a line number..." Then
            txtGotoLine.ForeColor = Color.Black
        End If
    End Sub
    Private Sub txtGotoLine_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtGotoLine.LostFocus
        If txtGotoLine.Text = "" Then
            txtGotoLine.Text = "Enter a line number..."
            txtGotoLine.ForeColor = Color.Gray
        End If
    End Sub

    Private Sub RemoveDuplicate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveDuplicate.Click
        Dim msg1 = "Are you sure you want to remove duplicate lines in the editor? (Note: This operation cannot be undone, and is Case Sensitive)"
        Dim msg2 = "Are you sure you want to blank lines in the editor? (Note: This operation cannot be undone)"
        Dim title = "Confirm Message"
        Dim style = MsgBoxStyle.YesNoCancel

        If CheckBox1.Checked Then
            Dim response = MsgBox(msg1, style, title)
            If response = MsgBoxResult.Yes Then
                'Form1.RichTextBox1.Lines = Form1.RichTextBox1.Lines.Distinct.ToArray
                Form1.RichTextBox1.Lines = Form1.RichTextBox1.Lines.Distinct.ToArray
            ElseIf response = MsgBoxResult.No Then
                Exit Sub
            End If
        ElseIf CheckBox2.Checked = False Then
            Exit Sub
        End If

        If CheckBox1.Checked Then
            Dim response = MsgBox(msg2, style, title)
            If response = MsgBoxResult.Yes Then
                Form1.RichTextBox1.Lines = Form1.RichTextBox1.Text.Split(New Char() {ControlChars.Lf}, _
                                                       StringSplitOptions.RemoveEmptyEntries)
            ElseIf response = MsgBoxResult.No Then
                Exit Sub
            End If
        ElseIf CheckBox1.Checked = False Then
            Exit Sub
        End If
    End Sub

End Class

Form Tab Spacing Configuration Source:
Code:
Public Class FormTabs

    Dim TabSpacingNumbers As String = "23456789" & vbBack

    Private Sub FormTabs_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label3.Text = "Tab spacing is the number of spaces to use when the" & vbNewLine & "tab key is pressed."
    End Sub

    Private Sub SetValue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetValue.Click
        Me.Close()
    End Sub

    Private Sub DefaultTabSettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DefaultTabSettings.Click
        NumericUpDown1.Text = "4"
        Me.Close()
    End Sub

    Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles NumericUpDown1.KeyPress
        If e.KeyChar = TabSpacingNumbers Then
            e.Handled = True
        End If
        e.Handled = False
    End Sub
End Class

Preview:
[Image: unledta.png]

(See Part 2 for More - Click here)
Post to allow part 2!! (Click to View)
Part 2

Features:
  • Custom GUI
  • Shortcut hotkeys
  • Editor background/foreground color choice
  • Menubar
    • File: A selection of file handling options as well as a menu item to close the application
      • New (Ctrl + N): Starts a new document, if there's any unsaved data in the editor at this point it will prompt you if you want to save or not
      • Open (Ctrl + O): Will open a new file to edit
      • Save (Ctrl + S): Will save over a pre-existing file if you have previously saved a file. (Disabled if there is no existing file)
      • Save As (Ctrl + Alt + S): Saves the text as a new file, even if it has been saved onto a pre-existing version of the same file or not
      • Exit (ESC): Exits the application
    • Edit: A list of editing controls for the editor
      • Undo (Ctrl + Z): Undoes the previous operation for a modification to the content in the editor
      • Redo (Ctrl + X): Redoes an operation that was previously undone
      • Cut: Same as the delete key or the backspace key with a selection of text
      • Copy (Ctrl + C): Copies out a selection of text
      • Paste (Ctrl + V): Pastes the most recent text in the clipboard
      • Select All (Ctrl + A): Selects all of the content/text within the editor
      • Selection: Different selection options for selected text in the editor
        • To Uppercase Changes the selected text to all uppercase
        • To Lowercase: Changes the selected text to all lowercase
        • Reverse Text: Reverses the string of the selected text in the editor's control
      • Find (Ctrl + F): Pulls up a find form for finding or replacing certain text in the editor. (Stays above all windows for easy access)
      • Goto Cursor Position: If you have enough text for the editor to display a vertical scroll bar, and you have your cursor on a set location in the editor, no matter where you the scrollbar is located, it will scroll to the location of your cursor's location (I-beam)
      • Current Date/Time (F5 Function Key): Adds the current date and time within the text editor at the location of your cursor. If any text is selected, this function will replace that selected text with the current system date and time
      • Clear All (Ctrl + Del): This function will delete all of the text within the editor. It's a shortcut to selecting all of the text and using "cut," or by selecting all of the text and pressing the delete key or the backspace key.
    • View: A list of view controls for the editor
      • Always on Top: Makes sure that the editor is displayed above all other windows for easy access to view or modify the file even though another windows form gets focus
      • Word Wrap: Disables the horizontal scrollbar from showing in the editor by making the sides of the editor the margins for the text content. (Default sets this option to on when the application first starts)
      • Zoom Factor: This is a set of options that will tell you how to use the zoom function in the editor, and also reverts the zoom settings back to the default zoom scale
        • Default Settings: Reverts all custom zoom settings back to the defaults
        • Zoom Help: Displays a message box showing you how you can use the mouse wheel to control the zoom scale for the text display in the editor
    • Format: A list of formatting options for the editor itself
      • Font: Displays a font dialog to change the current font and font size and attributes
      • Color Options: A few color options for some extra eye candy
        • Text: Changes or sets the current text/font color for the text in the editor, and also the form title's text color
        • Background: Changes or sets the current background color for the editor itself
      • Allow Drag Drop: Allows files to be opened into the editor by dragging and dropping them onto the editor itself. (Default sets this option to on when the application first starts)
      • Tab Configuration (Ctrl + T): Displays a new form window with settings to change the number of spaces each tab contains when the event of the tab key is pressed within the editor. (Minimum: 2, and Maximum: 9 spaces)
    • Help: A few extra options i've added in for a link to the homepage of SupportForums
      • Visit SupportForums: Opens the SupportForums main page
      • Infinity Homepage: Displays my profile/username page on SupportForums
  • Status bar
    • Word Wrap label: Shows whether word wrap is enabled or disabled
    • Line count for cursor position (I-beam)
    • Column count for cursor position (I-beam)
    • Length:
      • Displays the length of the entire editors contents/text when no selection is available
      • Displays the length of the selected text when a selected portion of text is available
  • Custom Context Menu
    • Undo
    • Redo
    • Cut
    • Copy
    • Paste
    • Find
    • Goto Cursor Position
    • Zoom Factor
      • Default Settings
      • Zoom Help
    • Selection
      • To Uppercase
      • To Lowercase
      • Reverse Text
    • Current Date/Time
  • Zoom functionality (Ctrl + MouseWheel)
  • Custom Tab Spacing Configuration (Ctrl + T)
  • Resizable Form

  • Find (In Detail):
    • Preview:
      [Image: findis.png]
    • Find Next: Looks through all of the text within the editor from the selection and down. Once it reaches the end of the document it will prompt you if you want to look through the document from the top once again
    • Replace: This function will replace the selected text in the editor with the text in the "Replace Text" textbox. Nothing else needs to be filled in to use this option
    • Replace All: This function will replace all of the text it finds within the document matching the text in the textbox of "Find Text" with the text in the textbox of "Replace Text"

      Note: For searching text and replace options, the checkboxes that show "Match Whole word" and "Case Sensitive" may be used to refine the search or the replace option into more detail specific operations.

    • Goto Line: You have to enter in a line number first, and after pressing the button it will move your cursor (I-beam) to the specified line number. If the line number is greater than the highest line number available in the editor it will prompt you with a message and return you to the end of the document instead

    • Remove: Whether the "Empty Line" or the "Duplicate Line" checkboxes are checked will determine what the button removes. These operations cannot be undone and you'll be prompted with a confirmation message box upon pressing the button. Please note that a message box will also be displayed when the "Duplicate Line" option is checked, because this is a case sensitive function. The line must match the exact casing of the previous line in order for it to be identified as a duplicate line. This operation will remove all duplicates and keep only one of the duplicate lines in the editor.

      Note: When the Find form loses it's focus and another window becomes active, it will turn to a transparent state allowing you to see through it to the main editor in case the window is over top of a certain part of the text you want to see.
    • Cancel: Will exit the find form window with no operations executed
  • Tab Settings (In Detail):
    • Preview:
      [Image: tabhx.png]
    • Set Value: This button will set the value of the number of spaces each {TAB} occupies in relation to the number displayed in the numeric listbox to the left. This number may be changed from a range of 2, to 9. If a higher number than 9 is set, it will revert back to a maximum of 9 instead.
    • Use Default: This function will revert the tab spacing back to a default of 4 individual spaces per {TAB} keypress

Virus Scan:
Direct Download: http://download1000.mediafire.com/1a84xk...B+v2.5.exe

If you want it in any other colors until I get a settings.ini associated with my application then I can send you one with your default requests if you PM me.

Thanks

Credits: Infinity (2011)



Since my characters ran out for my previous post my post got cut off. Thanks KoBE though lol Smile I hope others will enjoy this as well after all the work that went into it so far.
That is a good program there. Good job.
(05-20-2011, 09:10 PM)Kyle iZ Abstracts Wrote: [ -> ]That is a good program there. Good job.

Thanks, i'm hoping after all the work that went into this, that someone will find a use for it. I can guarantee that it's more advanced than the default Notepad.exe that comes with windows. It basically does everything that Notepad does, and more.

If ANYONE doesn't understand the code (assuming you're using it to learn), just post a message in this thread here and i'll explain the code for you that you don't understand. I written it all out from scratch basically and re-written it a few times from deleting my progress, and troubleshooting so I know it inside out. I haven't had time to clean up the code, but there's a reason for all of the code in here. I started using functions to perform basic tasks, but I stopped doing that after becoming unmotivational with how much progress i've lost and had to redo on this lol.
Wow! Have you made it so that associating .txt with your notepad is possible? I can help you do that if you want...
Fantastic work mate. You should also add a feature like Notepad++ has, where it can work as a coding language editor.

(05-21-2011, 03:13 AM)thanasis2028 Wrote: [ -> ]Wow! Have you made it so that associating .txt with your notepad is possible? I can help you do that if you want...

That was already added since I started out on the project. It's been a feature since day 1.


(05-21-2011, 03:23 AM)Fragma Wrote: [ -> ]Fantastic work mate. You should also add a feature like Notepad++ has, where it can work as a coding language editor.

That's possible, but it would take a lot of syntax highlighting lol, for changing the colors of brackets for certain languages, which would take a lot of work. I'd have to get help from someone who knows the languages that I don't
All that is actually missing are Line Numbers.... Tongue
I love it and I also use it as my Portable Editor, along with Notepad 2 for some serious stuff...
The version I have is like nothing compared to this, lol 1.6 and this is 2.5 Big Grin

I will post a better feedback once I get aroung using it often. As for now I just love it...
(05-21-2011, 05:45 AM)Gaijin Wrote: [ -> ]All that is actually missing are Line Numbers.... Tongue
I love it and I also use it as my Portable Editor, along with Notepad 2 for some serious stuff...
The version I have is like nothing compared to this, lol 1.6 and this is 2.5 Big Grin

I will post a better feedback once I get aroung using it often. As for now I just love it...

I fixed the tab spacing in this new version btw. I had to use

Code:
If e.KeyCode = Keys.Tab Then
                e.SuppressKeyPress = True
                Me.RichTextBox1.SelectedText = "  "

To get that to work. Line number on the left like in Notepad++ i've been looking into, but there's already a function for goto line, and a line number display in the status bar at the bottom, which will have to do for now until I get that figured out. The form label text at the top changes with the text color settings in this version Smile
Pages: 1 2 3 4 5 6 7 8 9 10