Click here to Skip to main content
15,897,371 members
Articles / Multimedia / GDI+

Line Numbering of RichTextBox in .NET 2.0

Rate me:
Please Sign up or sign in to vote.
4.07/5 (17 votes)
26 Jan 2007CPOL2 min read 132.5K   2.6K   52  
Line numbering of a RichTextBox control using PictureBox control painting.
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        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.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
      Me.MyRichTextBox = New System.Windows.Forms.RichTextBox
      Me.MyPictureBox = New System.Windows.Forms.PictureBox
      CType(Me.MyPictureBox, System.ComponentModel.ISupportInitialize).BeginInit()
      Me.SuspendLayout()
      '
      'MyRichTextBox
      '
      Me.MyRichTextBox.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                  Or System.Windows.Forms.AnchorStyles.Left) _
                  Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
      Me.MyRichTextBox.Font = New System.Drawing.Font("Courier New", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
      Me.MyRichTextBox.Location = New System.Drawing.Point(49, 7)
      Me.MyRichTextBox.Name = "MyRichTextBox"
      Me.MyRichTextBox.Size = New System.Drawing.Size(230, 247)
      Me.MyRichTextBox.TabIndex = 0
      Me.MyRichTextBox.Text = "" & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10)
      Me.MyRichTextBox.WordWrap = False
      '
      'MyPictureBox
      '
      Me.MyPictureBox.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                  Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
      Me.MyPictureBox.Location = New System.Drawing.Point(2, 7)
      Me.MyPictureBox.Name = "MyPictureBox"
      Me.MyPictureBox.Size = New System.Drawing.Size(41, 247)
      Me.MyPictureBox.TabIndex = 2
      Me.MyPictureBox.TabStop = False
      '
      'Form1
      '
      Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
      Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
      Me.ClientSize = New System.Drawing.Size(291, 261)
      Me.Controls.Add(Me.MyPictureBox)
      Me.Controls.Add(Me.MyRichTextBox)
      Me.Name = "Form1"
      Me.Text = "Form1"
      CType(Me.MyPictureBox, System.ComponentModel.ISupportInitialize).EndInit()
      Me.ResumeLayout(False)

   End Sub
   Friend WithEvents MyRichTextBox As System.Windows.Forms.RichTextBox
   Friend WithEvents MyPictureBox As System.Windows.Forms.PictureBox

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions