Ejemplo n.º 1
0
        /// <summary>
        ///   returns control rectangle
        /// </summary>
        /// <param name = "cellRect">rectangle of table's cell </param>
        /// <returns> </returns>
        public virtual Rectangle getDisplayRect(Rectangle cellRect, bool isHeaderEditor)
        {
            var rect = new Rectangle(0, 0, 0, 0);

            //if (_logicalControl is Line)
            //   rect = ((Line)_logicalControl).calcDisplayRect();
            //else
            {
                // compute rectangle relativly to table
                rect.Height = Height;
                rect.Width  = Width;
                PlacementData placementData = _logicalControl.PlacementData;

                // apply X placement (depends on column width)
                Rectangle      placementRect = placementData.Placement;
                ILogicalColumn columnManager = _tableManager.ColumnsManager.getLgColumnByMagicIdx(MgColumn);
                int            dx            = columnManager.getDx();
                if (_tableManager.RightToLeftLayout)
                {
                    int right = cellRect.Right - _xorigin;
                    right      -= dx * placementRect.X / 100;
                    rect.Width += ((dx * placementRect.Width) / 100);
                    rect.X      = right - rect.Width;
                }
                else
                {
                    rect.X      = GetDisplayRectangleLeft(cellRect);
                    rect.X     += dx * placementRect.X / 100;
                    rect.Width += ((dx * placementRect.Width) / 100);
                }

                // apply Y placement (depends on row height)
                // Defect 138536: For Header control, do not consider change in row height and hence do not consider placement for Y & Height
                int dy = isHeaderEditor ? 0 : _tableManager.GetChangeInRowHeight();
                rect.Y  = GetDisplayRectangleTop(cellRect);
                rect.Y += dy * placementRect.Y / 100;

                //Height of the 3D ComboBox is fixed and depends on the Font.
                //We cannot change it by setting the Height.
                //So, the Height placement is irrelevant.
                //Sets height only for 2D combobox
                if (!IsComboControl() || Is2DComboBoxControl())
                {
                    rect.Height += ((dy * placementRect.Height) / 100);
                }

                rect = _tableManager.GetTableMultiColumnStrategy(isHeaderEditor).GetRectToDraw(rect, cellRect);
            }

            return(rect);
        }