473,711 Members | 2,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView Cell Position

How do I get DataGridViewCel l cell position in a window?

For a button I would do this:
this.Button.Poi ntToClient(this .Button.Locatio n)

But what do I do for DataGridViewCel l?
Thanks
Peter
Dec 2 '05 #1
5 13303
Hi Peter,

Because the DataGridViewCel l is inside the DataGridView, we cannot get the
location of the cell by any properties.

An alternative is to caculate the total size of the left and upper cells.
Then add the value of the DataGridView.Lo cation to get the relative
position of the cell.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 3 '05 #2

"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:Hz******** ******@TK2MSFTN GXA02.phx.gbl.. .
Hi Peter,

Because the DataGridViewCel l is inside the DataGridView, we cannot get the
location of the cell by any properties.

An alternative is to caculate the total size of the left and upper cells.
Then add the value of the DataGridView.Lo cation to get the relative
position of the cell.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


I do not understand what you mean by "total size of the left and upper
cells", do you have an example?
Dec 3 '05 #3
Hi Peter,

For example, the cell is on the 2nd row and 3rd column. In this case, we
need to collection the width of column 1 and 2, and the height of row 1. So
the left edge of cell(2,3) is width(1)+width( 2) and the top is at height(1).

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 6 '05 #4

"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:D3******** ********@TK2MSF TNGXA02.phx.gbl ...
Hi Peter,

For example, the cell is on the 2nd row and 3rd column. In this case, we
need to collection the width of column 1 and 2, and the height of row 1.
So
the left edge of cell(2,3) is width(1)+width( 2) and the top is at
height(1).

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Thank You
Dec 9 '05 #5
You're welcome.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 9 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1937
by: Steve | last post by:
I am looking for an example of a custom user control ( 2 labels and 2 datetime pickers ) in a datagridview cell. Every example I have come across handles only once control such as a datetimepicker or a value list, etc. Can anyone point me in the right direction? Thanks!
11
109601
by: dgk | last post by:
Is there a way to change the foreground or background color of a single cell in an unbound datagridview?
3
14578
by: Rich | last post by:
Hello, If I want to update data displayed in a datagrideview/datagridview cell, how can I determine what cell I am updating? I am looking at the click event below, for example. Can I get information from the sender object or the EventArgs? How? Private Sub DataGridView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.Click Console.WriteLine("row number of cell is ?")
10
45206
by: steve | last post by:
Hi All I would like to be able to change the cell borders on certain cells to none at runtime to make a group of cells appear to be merged I have tried the following in the cellformatting event..., to no avail Any ideas Regards
0
1295
by: Bob | last post by:
Hi Trying to overlay a Datagridview current cell with a dtp so that the client gets to set the current cell value via the dtp. Figured Start with dtp at the back then bring it to the front when client clicks cell. Having problem determining absolute screen position of the clicked cell. 1) Is this the best way to do it. 2) If so, how do I get the absolute position of the DGV current cell. thanks Bob
0
2747
by: varunk2 | last post by:
Hi How to autocomplete a datagridview cell in c# windows forms. Please anybody help me... Thanks in advance Regards,
0
5270
by: hydro123 | last post by:
I am using VC++2008 and am trying to read data enetered in unbound datagridview to implement in function. Under button_click event I entered the following: // initialize varaibles from dataGridView double C1; double INF1; double T1; //Read String values from each dataGridView Cell String^C1s = safe_cast<String^>(dataGridView1->Value); String^INF1s = safe_cast<String^>(dataGridView1->Value);
0
15240
by: ziketo | last post by:
Hi, I searched a lot about changing the DataGridView cell borders. BYTES helped me so I will write down the solution: 1. You should override the class DataGridViewTextBoxCell, and the new class should have a property of type DataGridViewAdvancedBorderStyle, this property you will change from the outside: 2. You will override also the PaintBorder, and Paint methods in a way that they will get the new property instead of the default one....
2
2023
by: priyamtheone | last post by:
How can I get the position of a certain cell of a datagridview. To be specific I don't want the mouse coordinates. Suppose I have a datagridview with Name (ReadOnly), ID and TransDate columns and I want to popup a tiny lookup form when the mouse is clicked or Enter button is pressed when the focus is upon the Name column. The lookup form should openup exactly upon the Name column of the selected row. Thanks.
0
8699
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9295
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7935
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6617
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4457
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2099
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.