8 Answers, 1 is accepted
0
Emanuel Varga
Top achievements
Rank 1
answered on 16 Nov 2012, 11:05 AM
Hello,
What do you mean by row border coordinates? Location of the control inside a form?
Best Regards,
Emanuel Varga
WinForms MVP
What do you mean by row border coordinates? Location of the control inside a form?
Best Regards,
Emanuel Varga
WinForms MVP
0
Vishal
Top achievements
Rank 1
answered on 16 Nov 2012, 11:17 AM
Hi,
We have 2 gridVIew on the same screen separated by the panel. we need to draw a line between rows of the grids based on the row data;
Since gridview also have scroll bars attached to it. so when row is scrolled, i wish to have running coordinates of the row, in that way. on paint event a line will be re-drawn the moment row is scrolled.
for that purpose i need to have border co-ordinates of the row,
Thanks,
Vishal
We have 2 gridVIew on the same screen separated by the panel. we need to draw a line between rows of the grids based on the row data;
Since gridview also have scroll bars attached to it. so when row is scrolled, i wish to have running coordinates of the row, in that way. on paint event a line will be re-drawn the moment row is scrolled.
for that purpose i need to have border co-ordinates of the row,
Thanks,
Vishal
0
Emanuel Varga
Top achievements
Rank 1
answered on 16 Nov 2012, 11:19 AM
Can you please add a screenshot?
Best Regards,
Emanuel Varga
WinForms MVP
Best Regards,
Emanuel Varga
WinForms MVP
0
Vishal
Top achievements
Rank 1
answered on 16 Nov 2012, 11:35 AM
Hi,
screenshots cannot be placed, but can you tell me on how to have coordinates of a row on rowformatting event.
I have placed screenshot now, with lines been drawn, but as you can see when the scroll event will fire, as the coordinates are static; the lines will not be re-drawn. I want to re-draw lines against the mapped rows. so when the mapped rows are moved/ or are out of visible area. lines are again drawn; as row coordinates have changed.
screenshots cannot be placed, but can you tell me on how to have coordinates of a row on rowformatting event.
I have placed screenshot now, with lines been drawn, but as you can see when the scroll event will fire, as the coordinates are static; the lines will not be re-drawn. I want to re-draw lines against the mapped rows. so when the mapped rows are moved/ or are out of visible area. lines are again drawn; as row coordinates have changed.
0
Emanuel Varga
Top achievements
Rank 1
answered on 16 Nov 2012, 12:23 PM
Hello again,
You could try registering for the CellFormatting event and getting the Cell.LocationToControl,
But from what i see it's not very reliable...
Best Regards,
Emanuel Varga
WinForms MVP
You could try registering for the CellFormatting event and getting the Cell.LocationToControl,
void
grid_CellFormatting(
object
sender, CellFormattingEventArgs e)
{
e.CellElement.Text = e.CellElement.LocationToControl().ToString();
}
But from what i see it's not very reliable...
Best Regards,
Emanuel Varga
WinForms MVP
0
Hi guys,
Thank you for writing.
You could use the 'Paint' event for the drawing. In order to apply the new painting the panel should be re-painted. This can be achieved by calling its Invalidate method. The Invalidate method cause repainting of the whole control, which apparently raises the RowPaint event. Here is a sample demo:
I hope that you find this information useful.
Greetings,
Plamen
the Telerik team
Thank you for writing.
You could use the 'Paint' event for the drawing. In order to apply the new painting the panel should be re-painted. This can be achieved by calling its Invalidate method. The Invalidate method cause repainting of the whole control, which apparently raises the RowPaint event. Here is a sample demo:
radPanel1.Paint +=
new
PaintEventHandler(radPanel1_Paint);
radGridView1.TableElement.VScrollBar.Scroll +=
new
ScrollEventHandler(VScrollBar_Scroll);
void
radPanel1_Paint(
object
sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
foreach
(GridRowElement row
in
radGridView1.TableElement.VisualRows)
{
GridDataRowElement dataRow = row
as
GridDataRowElement;
if
(dataRow !=
null
)
{
Point location = dataRow.ControlBoundingRectangle.Location;
g.DrawLine(Pens.Blue, 10, location.Y, 200, location.Y);
}
}
}
void
VScrollBar_Scroll(
object
sender, ScrollEventArgs e)
{
radPanel1.Invalidate();
}
I hope that you find this information useful.
Greetings,
Plamen
the Telerik team
0
Vishal
Top achievements
Rank 1
answered on 21 Nov 2012, 09:44 AM
Hi Plamen,
Thanks for the response, and for the solution. can you shae the sample application.
Regards,
Vishal Gupta
Thanks for the response, and for the solution. can you shae the sample application.
Regards,
Vishal Gupta
0
Hi Vishal,
Thank you for getting back to me.
Please, find attached an example project where I have implemented a similar case to yours.
I hope this will be useful. Should you have further questions, I would be glad to help.
Greetings,
Plamen
the Telerik team
Thank you for getting back to me.
Please, find attached an example project where I have implemented a similar case to yours.
I hope this will be useful. Should you have further questions, I would be glad to help.
Greetings,
Plamen
the Telerik team