You can find the coordinates of the column relative to GridControland then translate into coordinates Form. For this, you can use an object GridColumnsInfothat you can get from the property GridViewInfo.ColumnsInfo. To get an object GridViewInfo, you can use a method gridView.GetViewInfo().
When you find the coordinates, you will need to subscribe to events that occur during various changes GridViewand GridControl. For example, you can subscribe to GridView.Layoutand
GridView.LeftCoordChangedevents. To resize, you need to subscribe to the event GridControl.Resize.
Example:
private void UpdatePosition(GridView gridView, string columnName, Control control)
{
var column = gridView.Columns[columnName];
if (column == null) return;
var viewInfo = (GridViewInfo)gridView.GetViewInfo();
var columnInfo = viewInfo.ColumnsInfo[column];
if (columnInfo != null)
{
var bounds = columnInfo.Bounds;
var point = PointToClient(gridView.GridControl.PointToScreen(bounds.Location));
control.Left = point.X;
control.Top = point.Y - control.Height;
control.Width = bounds.Width;
control.Show();
}
else
control.Hide();
}
You can call this method for every event you register.
source
share