473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 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 2346
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
by: Andrey Tatarinov | last post by:
Hi. It would be great to be able to reverse usage/definition parts in haskell-way with "where" keyword. Since Python 3 would miss lambda, that would be extremly useful for creating readable...
3
by: A.V.C. | last post by:
Hello, I found members of this group very helpful for my last queries. Have one problem with CASE. I can use the column name alias in Order By Clause but unable to use it in WHERE CLAUSE. PLS...
3
by: Xiangliang Meng | last post by:
Hi, all. In 1998, I graduated from Computer Science Dept. in a university in China. Since then, I've been using C Language for almost 6 years. Although I'm using C++ in my current job, I'm also...
1
by: GG | last post by:
Is there a class similar to DataGrid.HitTestInfo for Keyboard moving? Need to get the coordinates of the grid when the user is using the shift key and arrows Thanks *** Sent via...
2
by: Tom P | last post by:
I'm trying to use DataGrid.HitTestInfo in my OnMouseDown event but firstly I cannot see it in Intellisense, secondly when I try to use it I get strange 'COMPILE' errors when building the app I'll...
3
by: John Smith | last post by:
Hey folks, Does anyone know if it's possible for me to determine on a checkbox's checkedchanged event whether the actual box was clicked or if it's text was clicked? I know with DataGrids you...
7
by: Britney | last post by:
Original code: this.oleDbSelectCommand1.CommandText = "SELECT TOP 100 user_id, password, nick_name, sex, age, has_picture, city, state, " + "country FROM dbo.users WHERE (has_picture = ?) AND (sex...
1
by: asprabahar | last post by:
Hi I have a Different Issue the Class DataGrid.HitTestInfo is missing . The issue is when i type DataGrid and then when i type (.) and the HitTestInfo is not diaplaying ,but the say way when i copy...
0
by: Beagley | last post by:
I'm trying to give a context menu to my user when they right click on a particular row in my datagrid. I created two functions that pass back the indicies for the row and column. The following code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.