Marking regions and methods, drawing problem

Hello there,

i'm working on a plugin for the r# and i have problems with determining
if a codeblock is collapsed or not.
the idea is to create a plugin which underlines all "#region ..." so that
it's easier to read the code.
drawing is not the problem ... but drawing at the correct coordinates is
confusing me. because each time i collapse
a region all drawings regarding all the regions after the collapsed one
are wrong ... the line is drawn at the
(visual) wrong coordinates.

look at the picture at the following link to see what i mean:

---> http://www.bitethebytes.com/downloads/mean.png


If you have any ideas to solve this problem ... please mail me :)

Thx and greetz

Stefan

2 comments
Comment actions Permalink

Please use the "ITextControl.IsUnderColapsedRegion" method

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Stefan Kraus" <stefan.kraus@bitethebytes.com> wrote in message
news:op.thqd7bnqrs7ph1@laptop2...
Hello there,

i'm working on a plugin for the r# and i have problems with determining
if a codeblock is collapsed or not.
the idea is to create a plugin which underlines all "#region ..." so that
it's easier to read the code.
drawing is not the problem ... but drawing at the correct coordinates is
confusing me. because each time i collapse
a region all drawings regarding all the regions after the collapsed one
are wrong ... the line is drawn at the
(visual) wrong coordinates.

look at the picture at the following link to see what i mean:

---> http://www.bitethebytes.com/downloads/mean.png


If you have any ideas to solve this problem ... please mail me :)

Thx and greetz

Stefan


0
Comment actions Permalink

Hi,

well ... of course I have found this method too ;) ... but it does not
work ... or maybe I
can't use that one ;)

no, I tried it over and over and I alway get a 'false'. Still don't know
why?

Here's the code I have used in combination with the
IsUnderCollapsedRegion method:


The top of the source code file (the one i check if a documentoffset is
under the
collapsed region):

1 #region Test
2 using System;
3 using System.Drawing;
4 using System.Windows.Forms;
5 using JetBrains.ReSharper.ActionManagement;
6 using JetBrains.ReSharper.Shell;
7 using JetBrains.ReSharper.TextControl;
8 using JetBrains.ReSharper.TextControl.Graphics;
9 #endregion
...


And the code which checks the IsUnderCollapsedRegion is here:

if
(textControl.IsUnderColapsedRegion(textControl.RowModel.GetRow(3).GetDocumentOffset(2)))
MessageBox.Show("true");
else
MessageBox.Show("false");

So if i collapse the region and do the check i have to recieve a TRUE ...
but i recieve a false.

Maybe i did something wrong ... if so please tell me what :)

Thx for the fast reply and the great support
Stefan

0

Please sign in to leave a comment.