471,327 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,327 software developers and data experts.

Where is HitTestInfo?

I've read on the forums of other people having problems with
HitTestInfo not appearing. I've read these but they didn't help:

http://groups.google.com/group/micro...6428decee1637e

http://groups.google.com/group/micro...d9c9894057861a

System.Windows.Forms.DataGrid doesn't have it either. Any ideas?

Thanks,
Brett

Dec 9 '05 #1
15 2251
Brett,

HitTestInfo declaration is nested in the DataGrid.

In MSDN's Index type DataGrid.HitTestInfo class in order to find the docs.

If you want to create variable of this type you should declare it as

DataGrid.HitTestInfo hitTestInfo;

--
HTH
Stoitcho Goutsev (100) [C# MVP]
"Brett Romero" <ac*****@cygen.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I've read on the forums of other people having problems with
HitTestInfo not appearing. I've read these but they didn't help:

http://groups.google.com/group/micro...6428decee1637e

http://groups.google.com/group/micro...d9c9894057861a

System.Windows.Forms.DataGrid doesn't have it either. Any ideas?

Thanks,
Brett

Dec 9 '05 #2
Perhaps you didn't read my original post. You can clearly see I have
referenced DataGrid above and no HitTestInfo. Are you saying I need to
download something from MSDN?

Thanks,
Brett

Dec 9 '05 #3
Brett,

In this case I still don't understand the question.

You said:
I've read on the forums of other people having problems with
HitTestInfo not appearing.
System.Windows.Forms.DataGrid doesn't have it either. Any ideas?
I thought the problem is that HitTestInfo is not there (or Intellisense
doesn't show it) and DataGrid class doesn't have it. Even more - the
subject of the question is "Where is HitTestInfo?"

I think I correctly understood that the problem is the HitTestInfo class.

Are you saying that you cannot find the DataGrid class? Make sure that you
reference System.Windows.Forms.dll.

Maybe you should rephrase the question. Give more background of the problem
you are experiencing. With such a vague question I don't think anyone on the
ng can give you an answer.
--

Stoitcho Goutsev (100) [C# MVP]

"Brett Romero" <ac*****@cygen.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com... Perhaps you didn't read my original post. You can clearly see I have
referenced DataGrid above and no HitTestInfo. Are you saying I need to
download something from MSDN?

Thanks,
Brett

Dec 9 '05 #4
I'm not sure how much simpler I can make it. I type
System.Windows.Forms.DataGrid. and look through the intellisense
listing. No HitTestInfo. What part of this is confusing? I do have a
DataGrid on my form. System.Windows.Forms. does show DataGrid in
intellisense. I scroll to DataGrid, hit the <enter> key and now I have
System.Windows.Forms.DataGrid. I type a dot and now I have
System.Windows.Forms.DataGrid. (notice the dot after DataGrid, which is
not a period) and intellisense waiting for me to choose something.
HitTestInfo is not a choice for me here because it "isn't" listed. It
doesn't display in intellisense.

I seems you understood the question initially very well:
I thought the problem is that HitTestInfo is not there (or Intellisense

doesn't show it) and DataGrid class doesn't have it.

That is right. DataGrid class didn't have it.

Sorry, just not sure how much clearer I can get. If it is still
confusing, perhaps I'll just wait to see who posts or I'm just out. No
need for us to keep examing how many shades of red an apple has.

Thanks,
Brett

Dec 9 '05 #5
One more thing, HitTestInfo does show up on my home machine in
intellisense.

Dec 9 '05 #6
On my work machine, I created a test project and HitTestInfo is there.
I checked my original solution that has two project. No HitTestInfo
for projectB. However, it is accessible from projectA. I opened
projectB outside of the solution and HitTestInfo is there. It seems
that when HitTestInfo is in the solution with projectB, HitTestInfo is
not accessible. Any ideas why?

Thanks,
Brett

Dec 9 '05 #7
Here's the problem. The class I'm in inherits
System.Windows.Forms.Form as it is a form. That means I'm one
namespace to far up. Any suggestions on how I get around this are
welcome.

Dec 9 '05 #8
Hey, I was trying to help. If I were asking question I'd give as much info
as it possible to make it easier for the people to answer it.

Anyways...
I was able to repro the problem. It just happened that I tried the
Intellisense on DataGrid inside the project I was working on - no
HitTestInfo nor any other nested type (DataGrid declares couple more). In
the test project that I created when I read your post first it was working.
All the references were OK. It is definitely bug in Intellisens.

Knowing that VS keeps some Intellisense information in the *.projdata file
(in the project's *obj* folder) I closed VS and deleted that file. I did
this for the project where Intellisense didn't work.

When I opened the project again it was working.

So, go ahead and try to delete the *projdata file.

If it doesn't help you gonna need to type all the members by hend. Even the
Intellisense doesn't work the project has to compile as long as there is no
errors
--

Stoitcho Goutsev (100) [C# MVP]

"Brett Romero" <ac*****@cygen.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I'm not sure how much simpler I can make it. I type
System.Windows.Forms.DataGrid. and look through the intellisense
listing. No HitTestInfo. What part of this is confusing? I do have a
DataGrid on my form. System.Windows.Forms. does show DataGrid in
intellisense. I scroll to DataGrid, hit the <enter> key and now I have
System.Windows.Forms.DataGrid. I type a dot and now I have
System.Windows.Forms.DataGrid. (notice the dot after DataGrid, which is
not a period) and intellisense waiting for me to choose something.
HitTestInfo is not a choice for me here because it "isn't" listed. It
doesn't display in intellisense.

I seems you understood the question initially very well:
I thought the problem is that HitTestInfo is not there (or Intellisense

doesn't show it) and DataGrid class doesn't have it.

That is right. DataGrid class didn't have it.

Sorry, just not sure how much clearer I can get. If it is still
confusing, perhaps I'll just wait to see who posts or I'm just out. No
need for us to keep examing how many shades of red an apple has.

Thanks,
Brett

Dec 9 '05 #9
Sorry, didn't mean to offend. Guess I didn't understand the problem
enough and was posting gibberish. Not trying to claim I know more than
you. I appreciate all of your help greatly.

I did also get it to work by just typing HitTestInfo. All of the weird
compile errors went away. Not sure why. I also had to manually type
hit.Row or hit.Column. No intellisense. It is all working now.

I didn't find a *.projdata file. I'm using VSS with VS.NET so not sure
if that changes things. I do have these files:
*.csproj
*.scc
*.sln
*.csproj.user
*.suo
*.csproj.vspscc

That tip on deleting the file and getting intellisense back would be
great. Any idea why our setups are different in reference to
*.projdata?

Here's the code that will get the coordinates of a cell in a datagrid.
Also highlights the clicked row and dehighlights when a new row is
clicked. One thing, how do I get the value in say column 2 when all I
have are coordinates? I can't use CurrentCell or EditCell. I'm using
the right mouse click so there is no EditCell. CurrentCell gives a
cell from left clicking. I just need something I can feed in my row
index, traverse to a column and get that value.

private int lastRowSelected = 0;
private void Participant_MouseDown(object sender, MouseEventArgs e)
{
//Participant is the datagrid name
Participant.UnSelect(lastRowSelected);

Point pt = new Point(e.X, e.Y);
System.Windows.Forms.DataGrid.HitTestInfo hit =
Participant.HitTest(pt);
if (e.Button == MouseButtons.Right)
{
if(hit.Type == DataGrid.HitTestType.Cell)
{
Participant.Select(hit.Row);
lastRowSelected = hit.Row;
}
}
}

Thanks agian,
Brett

Dec 9 '05 #10
Brett,

When you open project in VSS it should create two subfolders - 'bin' and
'obj'. Both folders have subfolders in their own - Debug and Release.

Look at
[project folder]\obj\Debug
and
[project folder]obj\Release

there have to be files with extension 'projdata', delete them

Or, easier, delete the whole 'obj' folder all together; VS will create it
again
--

Stoitcho Goutsev (100) [C# MVP]

"Brett Romero" <ac*****@cygen.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Sorry, didn't mean to offend. Guess I didn't understand the problem
enough and was posting gibberish. Not trying to claim I know more than
you. I appreciate all of your help greatly.

I did also get it to work by just typing HitTestInfo. All of the weird
compile errors went away. Not sure why. I also had to manually type
hit.Row or hit.Column. No intellisense. It is all working now.

I didn't find a *.projdata file. I'm using VSS with VS.NET so not sure
if that changes things. I do have these files:
*.csproj
*.scc
*.sln
*.csproj.user
*.suo
*.csproj.vspscc

That tip on deleting the file and getting intellisense back would be
great. Any idea why our setups are different in reference to
*.projdata?

Here's the code that will get the coordinates of a cell in a datagrid.
Also highlights the clicked row and dehighlights when a new row is
clicked. One thing, how do I get the value in say column 2 when all I
have are coordinates? I can't use CurrentCell or EditCell. I'm using
the right mouse click so there is no EditCell. CurrentCell gives a
cell from left clicking. I just need something I can feed in my row
index, traverse to a column and get that value.

private int lastRowSelected = 0;
private void Participant_MouseDown(object sender, MouseEventArgs e)
{
//Participant is the datagrid name
Participant.UnSelect(lastRowSelected);

Point pt = new Point(e.X, e.Y);
System.Windows.Forms.DataGrid.HitTestInfo hit =
Participant.HitTest(pt);
if (e.Button == MouseButtons.Right)
{
if(hit.Type == DataGrid.HitTestType.Cell)
{
Participant.Select(hit.Row);
lastRowSelected = hit.Row;
}
}
}

Thanks agian,
Brett

Dec 9 '05 #11
Ok, I tried that but HitTestInfo still doesn't show up. Deleted both
the bin and obj folders then rebuilt.

Any ideas on getting a datagrid cell value using coordinates?

Thanks,
Brett

Dec 9 '05 #12
Other than HitTest method? ...Hm I can't think of anything. DataGrid.HitTest
is meant to be used for this.

Sorry to hear deleting those files/folders didn't work for you, they
certainly did work for me.

--

Stoitcho Goutsev (100) [C# MVP]

"Brett Romero" <ac*****@cygen.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Ok, I tried that but HitTestInfo still doesn't show up. Deleted both
the bin and obj folders then rebuilt.

Any ideas on getting a datagrid cell value using coordinates?

Thanks,
Brett

Dec 9 '05 #13
Here's a revised "if" statement that does get the cell value:

if(hit.Type == DataGrid.HitTestType.Cell)
{
Participant.Select(hit.Row);
DataGridCell dgc = Participant.CurrentCell;
dgc.RowNumber = hit.Row;
dgc.ColumnNumber = 2;
Participant.CurrentCell = dgc;
personIDToFile = Participant[dgc].ToString();
//save current cell for dehighlighting on next selection
lastRowSelected = hit.Row;
}

Another question on this, how do I handle some one highlighting a cell,
holding down shift and selecting three rows. I'd like to get the value
from column three for each of those rows (as I do above). My current
method will always get the value from the cell where the right mouse
click occurred. Any ideas?

Thanks,
Brett

Dec 9 '05 #14
Brett,

I can see that similar questions has been asked many times in the news
groups. I believe that you can find the answer of your question in google.
For example look at this thread

http://groups.google.ca/group/micros...c9abf5c464fcaf
--

Stoitcho Goutsev (100) [C# MVP]

"Brett Romero" <ac*****@cygen.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Here's a revised "if" statement that does get the cell value:

if(hit.Type == DataGrid.HitTestType.Cell)
{
Participant.Select(hit.Row);
DataGridCell dgc = Participant.CurrentCell;
dgc.RowNumber = hit.Row;
dgc.ColumnNumber = 2;
Participant.CurrentCell = dgc;
personIDToFile = Participant[dgc].ToString();
//save current cell for dehighlighting on next selection
lastRowSelected = hit.Row;
}

Another question on this, how do I handle some one highlighting a cell,
holding down shift and selecting three rows. I'd like to get the value
from column three for each of those rows (as I do above). My current
method will always get the value from the cell where the right mouse
click occurred. Any ideas?

Thanks,
Brett

Dec 12 '05 #15

use the namespace:

using System.ComponentModel.Design;
*** Sent via Developersdex http://www.developersdex.com ***
Nov 16 '06 #16

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

47 posts views Thread by Andrey Tatarinov | last post: by
3 posts views Thread by A.V.C. | last post: by
3 posts views Thread by John Smith | last post: by
7 posts views Thread by Britney | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.