Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. RichTextBox- :((

RichTextBox- :((

Scheduled Pinned Locked Moved C#
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RongNK
    wrote on last edited by
    #1

    In window Form : I ­­­­­­­­­­­­want to identify the ro­­­­­­­­­­w and colum ­­­­­­­­­of edit cursor .when I use movement key or mouse click ,i still kno­­w position of cursor (row and colum) .So ­­what to do that . Sorry for my english !

    M L 2 Replies Last reply
    0
    • R RongNK

      In window Form : I ­­­­­­­­­­­­want to identify the ro­­­­­­­­­­w and colum ­­­­­­­­­of edit cursor .when I use movement key or mouse click ,i still kno­­w position of cursor (row and colum) .So ­­what to do that . Sorry for my english !

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      Well, before even going into the details, can you tell us why do you whant to do that? May be a alternative/simpler approach can help you.

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      R 1 Reply Last reply
      0
      • M Manas Bhardwaj

        Well, before even going into the details, can you tell us why do you whant to do that? May be a alternative/simpler approach can help you.

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        R Offline
        R Offline
        RongNK
        wrote on last edited by
        #3

        I have 1 problem and i want to learn how to do that :(

        M 1 Reply Last reply
        0
        • R RongNK

          I have 1 problem and i want to learn how to do that :(

          M Offline
          M Offline
          Manas Bhardwaj
          wrote on last edited by
          #4

          This might give you a little idea:

          private void richTextBox1_MouseHover(object sender, EventArgs e)
          {
          Point _location = richTextBox1.GetPositionFromCharIndex(richTextBox1.Text.Length - 1);
          MessageBox.Show(string.Format("{0}, {1}",
          _location.X,
          _location.Y));
          }

          Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          R 1 Reply Last reply
          0
          • M Manas Bhardwaj

            This might give you a little idea:

            private void richTextBox1_MouseHover(object sender, EventArgs e)
            {
            Point _location = richTextBox1.GetPositionFromCharIndex(richTextBox1.Text.Length - 1);
            MessageBox.Show(string.Format("{0}, {1}",
            _location.X,
            _location.Y));
            }

            Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

            R Offline
            R Offline
            RongNK
            wrote on last edited by
            #5

            Sorry , i want to identify the row and column of editing cursor . for example : I paste a document to richtextbox end then i use "up key" or "down key" to move the edting cursor and then i know the position of editing cursor . Please help me ! Sorry for my english.

            D 1 Reply Last reply
            0
            • R RongNK

              Sorry , i want to identify the row and column of editing cursor . for example : I paste a document to richtextbox end then i use "up key" or "down key" to move the edting cursor and then i know the position of editing cursor . Please help me ! Sorry for my english.

              D Offline
              D Offline
              DoctorMick
              wrote on last edited by
              #6

              Something like this would work but I doubt it is the best way to do it....

                  private void richTextBox1\_KeyUp(object sender, KeyEventArgs e)
                  {
                      int totalLength = 0;
                      int line = 0;
                      int pos = 0;
                      for (int i = 0; i < richTextBox1.Lines.Length; i++)
                      {
                          if(i != 0) totalLength++;
                          totalLength += richTextBox1.Lines\[i\].Length;
                          if (totalLength >= richTextBox1.SelectionStart)
                          {
                              line = i + 1;
                              pos = richTextBox1.SelectionStart - (totalLength - richTextBox1.Lines\[i\].Length);
                              break;
                          }
                      }
                      label1.Text = "Line " + line.ToString() + "; Char " + pos.ToString();
                  }
              
              1 Reply Last reply
              0
              • R RongNK

                In window Form : I ­­­­­­­­­­­­want to identify the ro­­­­­­­­­­w and colum ­­­­­­­­­of edit cursor .when I use movement key or mouse click ,i still kno­­w position of cursor (row and colum) .So ­­what to do that . Sorry for my english !

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                Hi, I haven't used it myself (I don't like RTB that much) but this looks like the right tool[^] for you. :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups