On Sat, 14 Jan 2006 20:10:44 GMT, "Fabio Cannizzo"
<fcannizzo.miff t2001@london.ed u> wrote:
[color=blue]
>If a multiline text window is "scrolled", how can I get ho much it has been
>scrolled from the begin of the document?
>
>Thanks,
>Fabio[/color]
You can do this by lines or by characters.
1 Characters:
The total number of characters is myTextBox.Text. Length, the character
position at the start of the current line is
myTextBox.GetFi rstCharIndexOfC urrentLine(). From those two you can
get an idea of where you are in the text.
2 Lines:
The total number of lines is myTextBox.Lines .Count. To find the
current line use GetFirstCharInd exOfCurrentLine () as above and then
use GetLineFromChar Index(int charIndex) to find the current line.
Again this will give you an idea of where you are in the text.
The Object Browser is your friend in things like this.
rossum
--
The ultimate truth is that there is no ultimate truth
I think that GetFirstCharInd exOfCurrentLine () does not solve my problem.
Current line, is the line where the caret is located. However, if the text
has been scrolled using the default scrollbars, that could well be outside
the screen. I need to know the position of the screen window with respect to
my text document.
For instance, if I take the client coordinates (1,1), if there was a way to
know which character correspond to that position, that would do it.
Regards,
Fabio
"rossum" <rossum48@coldm ail.com> wrote in message
news:5pvis11sn7 mviuufn2o85v3kt c7d8nct53@4ax.c om...[color=blue]
> On Sat, 14 Jan 2006 20:10:44 GMT, "Fabio Cannizzo"
> <fcannizzo.miff t2001@london.ed u> wrote:
>[color=green]
>>If a multiline text window is "scrolled", how can I get ho much it has
>>been
>>scrolled from the begin of the document?
>>
>>Thanks,
>>Fabio[/color]
>
> You can do this by lines or by characters.
>
> 1 Characters:
>
> The total number of characters is myTextBox.Text. Length, the character
> position at the start of the current line is
> myTextBox.GetFi rstCharIndexOfC urrentLine(). From those two you can
> get an idea of where you are in the text.
>
> 2 Lines:
>
> The total number of lines is myTextBox.Lines .Count. To find the
> current line use GetFirstCharInd exOfCurrentLine () as above and then
> use GetLineFromChar Index(int charIndex) to find the current line.
> Again this will give you an idea of where you are in the text.
>
> The Object Browser is your friend in things like this.
>
> rossum
>
>
> --
>
> The ultimate truth is that there is no ultimate truth[/color]
On Mon, 16 Jan 2006 00:22:25 GMT, "Fabio Cannizzo"
<fcannizzo.miff t2001@london.ed u> wrote:
[color=blue]
>For instance, if I take the client coordinates (1,1), if there was a way to
>know which character correspond to that position, that would do it.[/color]
myTextBox.GetCh arIndexFromPosi tion(System.Dra wing.Point) returns the
integer character index of the character at a given position, in your
case (1, 1). This seems to be what you want.
rossum
--
The ultimate truth is that there is no ultimate truth
Comment