0

So this is vary basic but I cannot seem to find a function that can do this.

lets say I have the following text starting at 0,0 of the console window

123456789
   _

lets say I set the cursor position to 0,3 which is "4" then I use Console.CursorLeft to get the current position which is still 0,3.

I will now set it to 0,2 and it is on the "3" how would I read the text in the current cursor position into a string/char?

Jordan Trainor
  • 2,410
  • 5
  • 21
  • 23
  • Why are you trying to do this? – John Saunders Nov 17 '12 at 04:47
  • Cursor.Position.ToString() try that. And there are a lot of posts here that talks about getting current cursor position. Let us know if this is what you need or not.. – bonCodigo Nov 17 '12 at 04:47
  • @bonCodigo *Cursor*.Position.ToString() does not exist in the current context is this for a windows form application or a console application? – Jordan Trainor Nov 17 '12 at 05:57
  • @JohnSaunders I am trying to make a dynamically updating screen without redrawing the whole console which makes it "tear" and looks horrible – Jordan Trainor Nov 17 '12 at 05:58
  • I ask because I did this over 30 years ago. It sounds so strange to hear of someone trying to do dynamic updates of a character-cell display, instead of using Windows Forms or WPF. – John Saunders Nov 17 '12 at 06:00
  • BTW, 30+ years ago, the answer was to have my program keep its own copy of the screen in memory, update the copy first, then only update the actual display if there was a change. – John Saunders Nov 17 '12 at 06:01
  • @JohnSaunders well that is exactly what I am doing now but because there is quite a large grid it takes about 1 second to draw it. not long but long enough if the user holds a key and the screen updates every 0.1 secconds. – Jordan Trainor Nov 17 '12 at 06:19
  • @JordanTrainor: I did better than 1 second refresh time on a KA-10 system running TOPS-10, with under 1MB of **core** memory. Mind, that was an 80x24 display, and you've probably got higher resolution, but still, that was about 20 generations ago in "computer years". – John Saunders Nov 17 '12 at 06:26
  • @JohnSaunders http://youtu.be/ZaIYEoMIQh4 – Jordan Trainor Nov 17 '12 at 09:36

1 Answers1

0

use Cursor.PositionProperty.The Position property is identical to the Control.MousePositionproperty.
likt this: just as one general example

this.Cursor = new Cursor(Cursor.Current.Handle);
   Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50);
Ravindra Bagale
  • 17,226
  • 9
  • 43
  • 70
  • Doesn't exist in current context? Is this for a windows form application or a console application? and if so how does this grab the text under that cursor point? – Jordan Trainor Nov 17 '12 at 05:54