Example #1
0
        /// <summary>
        /// calculate editor bounds
        /// </summary>
        /// <returns></returns>
        public override Rectangle Bounds()
        {
            Rectangle rect = new Rectangle();

            if (_column != null)
            {
                rect = ((TableControl)parentControl).getCellRect(_column.Index, RowIdx);
                if (IsHeaderEditor)
                {
                    ICoordinator coordinator = BoundsComputer as ICoordinator;
                    if (coordinator != null)
                    {
                        if (coordinator.X < 0)
                        {
                            TableControl tableControl = (TableControl)parentControl;
                            // Defect# 130148: When a column is re-ordered with 1st column, then only use actual co-ordinates for X,
                            // otherwise this problem occurs i.e. control from 1st column remains at same location
                            if ((!(tableControl.RightToLeftLayout) && _column.Index == 0) ||
                                (tableControl.RightToLeftLayout && tableControl.ColumnCount - 1 == _column.Index))
                            {
                                rect.X = coordinator.X;
                            }
                        }
                        rect.Y = coordinator.Y < 0 ? coordinator.Y : 0;
                    }

                    rect.Height = Math.Abs(rect.Y) + ((TableControl)parentControl).Height;
                    if (((TableControl)parentControl).RightToLeftLayout)
                    {
                        rect.Width = rect.Width + rect.X;
                        rect.X     = 0;
                    }
                    else
                    {
                        rect.Width = parentControl.Bounds.Width - rect.X;
                    }
                }
            }

            // Defect 140258: If header control is hidden when column to which it is attached is hidden,
            // BoundsComputer is null. So return empty rectangle in this case.
            if (BoundsComputer != null)
            {
                return(BoundsComputer.computeEditorBounds(rect, IsHeaderEditor));
            }
            else
            {
                return(Rectangle.Empty);
            }
        }
Example #2
0
 public override void Hide()
 {
     BoundsComputer = null;
     base.Hide();
 }