I was using this value to correct the top position of a cell. The value
26 is a height of a grid header. I'm sure it can be calculated using
jamie wrote:
> This works thank you. Could you explain where the -26 comes from? I
> found that I needed to set it to -32 on mine and I believe thats due to the
> size of the box due to font size. What exactly is it doing?
> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> wrote in message
> news:%23CrFrHl3FHA.2524@TK2MSFTNGP10.phx.gbl...
>
>>Try this code:
>>
>>Rectangle r = dataGrid1.GetCellBounds(dataGrid1.CurrentCell.RowNumber,
>>dataGrid1.CurrentCell.ColumnNumber);
>>r = dataGrid1.RectangleToScreen(r);
>>
>>textBox.Top = r.Top - 26;
>>textBox.Left = r.Left;
>>textBox.Width = r.Width;
>>textBox.Height = r.Height;
>>
>>
>>Probably you will need VScroll/HScroll events of the grid:
>>
http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/browse_frm/thread/c1c56299d08b30d3/50b62940f767437b#50b62940f767437b
>>
>>
>>--
>>Sergey Bogdanov [.NET CF MVP, MCSD]
>>
http://www.sergeybogdanov.com >>
>>
>>jamie wrote:
>>
>>>I'm looking for a way to be able to edit data in the datagrid similar to
>>>how
>>>it works in the full framework. My current thought is when I select a
>>>cell
>>>in a datagrid place a textbox in the exact location and focus on the text
>>>box, when done save the value in the datagrid and move the textbox.
>>>
>>>Is there a way to get the location and size of the current sell on the
>>>screen?
>>>
>>>I'm thinking that on the currentcellchanged event find the currentcell
>>>position on screen.
>>> Set the textbox exactly to that size and position.
>>> Then change the focus to the textbox.
>>>
>>>Anyone see any issues with this?
>>>
>>>Anyone have a better recommendation?
>>>
>>>Jamie
>>>
>>>
>