Windows Develop Bookmark and Share   
 index > Windows Forms General > DatagridviewCell PointToScreen
 

DatagridviewCell PointToScreen

Hello.

I want to display a window form underneath a datagridview cell as a pop up box. I need to find out the location in screen cordinates where the datagridviewcell is so I can display the winform there. However, my datagridview has a scrollbar, so I cant just simply take the datagridview point to screen and adjust width and height according to row position(I would need to know the scroll position num to offset row position). Is there an easy way to do what I want to do?

Blast  Thursday, August 10, 2006 6:55 PM

In VB 2005 I did:

Dim _pointCell As Point = Me.OrderDetailDataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, True).Location

Dim _pointGrid As Point = OrderDetailDataGridView.Location

Dim _pointLocation As Point

_pointLocation.X = _pointGrid.X + _pointCell.X

_pointLocation.Y = _pointGrid.Y + _pointCell.Y

Me.ComboBox1.Location = _pointLocation

This will move the ComboBox to be directly over the cell selected.

DRuth  Saturday, September 30, 2006 8:13 PM

You can use google to search for other answers

Custom Search

More Threads

• ActiveX control crashing app when hitting 'x", but not "stop" in debugger. Started in VS2005
• Selected Item in a List Box
• Closing Form
• PrintDialog - No of Copies Option
• How to implement fraction functionality on Windows Forms?
• windows form web browser control problem
• horizontal scrollbars for ListView component in my WinForm
• PrintDocument - How to force print() command to don't repaint report
• Textbox input
• Font autoscaling and dynamically created nested user controls