Пример #1
0
        internal bool CustomizeCells(Row row)
        {
            bool flag = false;

            if (!this.HasCustomizedCells || (this.Parent == null))
            {
                return(false);
            }
            int count = this.m_CellTemplates.Count;

            for (int i = 0; i < count; i++)
            {
                Cell cell = this.m_CellTemplates[i];
                if (cell.CustomizeCell)
                {
                    object data = cell[row, i];
                    CustomizeCellEventArgs e = new CustomizeCellEventArgs(cell, data, row);
                    this.OnCustomizeCell(e);
                    RowSpecificCellProperties rowSpecificProperties = cell.GetRowSpecificProperties(row);
                    bool flag2 = rowSpecificProperties.Visible.Value;
                    rowSpecificProperties.Selectable       = new bool?(e.Cell.Selectable);
                    rowSpecificProperties.Visible          = new bool?(e.Cell.Visible);
                    rowSpecificProperties.CachedAutoHeight = e.Cell.GetAutoHeight(e.DataRow, i, rowSpecificProperties);
                    rowSpecificProperties.Cea = e;
                    if (e.Cell.Visible != flag2)
                    {
                        flag = true;
                    }
                }
            }
            return(flag);
        }
Пример #2
0
        protected internal virtual Rectangle CalculateBounds(int xOffset, int yOffset, Row row, int gridWidth, RowSpecificCellProperties preRscp)
        {
            Rectangle rectangle;
            RowSpecificCellProperties rowSpecificProperties = preRscp;

            if (rowSpecificProperties == null)
            {
                rowSpecificProperties = this.GetRowSpecificProperties(row);
            }
            if ((rowSpecificProperties != null) && rowSpecificProperties.CachedBounds.HasValue)
            {
                rectangle = rowSpecificProperties.CachedBounds.Value;
            }
            else
            {
                int cachedAutoHeight = 0;
                if ((rowSpecificProperties != null) && (rowSpecificProperties.CachedAutoHeight >= 0))
                {
                    cachedAutoHeight = rowSpecificProperties.CachedAutoHeight;
                }
                rectangle = this.CalculateCellWidth(gridWidth);
                if (this.AutoHeight && (cachedAutoHeight > this.m_Bounds.Height))
                {
                    rectangle.Height = cachedAutoHeight;
                }
                if ((this.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom)
                {
                    if ((this.Anchor & AnchorStyles.Top) == AnchorStyles.Top)
                    {
                        rectangle.Height = row.ActualHeight - (this.m_anchorSizeTop + this.m_anchorSizeBottom);
                        if (rectangle.Height < 0)
                        {
                            rectangle.Height = 0;
                        }
                    }
                    else
                    {
                        rectangle.Y = row.ActualHeight - (this.m_anchorSizeBottom + rectangle.Height);
                        if (rectangle.Y < 0)
                        {
                            rectangle.Y = 0;
                        }
                    }
                }
                else if (rectangle.Bottom > row.ActualHeight)
                {
                    rectangle.Height = row.ActualHeight - rectangle.Y;
                }
                if ((this.Parent != null) ? this.Parent.RightToLeft : false)
                {
                    rectangle.X = gridWidth - rectangle.Right;
                }
                if (rowSpecificProperties != null)
                {
                    rowSpecificProperties.CachedBounds = new Rectangle?(rectangle);
                }
            }
            rectangle.Offset(xOffset, yOffset);
            return(rectangle);
        }
Пример #3
0
        public virtual int GetAutoHeight(Row r, int index, RowSpecificCellProperties preRscp)
        {
            RowSpecificCellProperties properties = (preRscp == null) ? this.GetRowSpecificProperties(r) : preRscp;

            properties.CachedAutoHeight = this.m_Bounds.Height;
            return(properties.CachedAutoHeight);
        }
Пример #4
0
        public override int GetAutoHeight(Row r, int index, RowSpecificCellProperties preRscp)
        {
            int num = 0;

            if (!base.AutoHeight)
            {
                return(base.Bounds.Height);
            }
            RowSpecificCellProperties properties = (preRscp == null) ? base.GetRowSpecificProperties(r) : preRscp;

            if (properties.CachedAutoHeight >= 0)
            {
                return(properties.CachedAutoHeight);
            }
            string text = this.GetText(base[r, index]);

            if (((text == null) || (text.Length == 0)) || !properties.Visible.Value)
            {
                return(0);
            }
            int gridWidth = 0;

            Resco.Controls.AdvancedList.AdvancedList parent = base.Parent;
            if (parent != null)
            {
                gridWidth = parent.CalculateClientRect().Width - (parent.ScrollbarVisible ? parent.ScrollbarWidth : 0);
            }
            if (gridWidth != 0)
            {
                Rectangle rectangle = base.CalculateCellWidth(gridWidth);
                rectangle.Width -= 3;
                if (rectangle.Width > base.Parent.ScrollbarWidth)
                {
                    Graphics gr   = base.Graphics;
                    bool     flag = false;
                    if ((gr == null) && (base.Parent != null))
                    {
                        gr   = base.Parent.CreateGraphics();
                        flag = true;
                    }
                    WrapTextData data = Utility.WrapText(gr, text, this.m_Font, rectangle.Width);
                    if ((gr != null) && flag)
                    {
                        gr.Dispose();
                    }
                    num = (data != null) ? (data.Height + 2) : 0;
                }
            }
            properties.CachedAutoHeight = num;
            return(num);
        }
Пример #5
0
        internal int GetCellClick(int pos_x, int pos_y, Row row)
        {
            int num = this.m_CellTemplates.Count - 1;

            while (num >= 0)
            {
                RowSpecificCellProperties rowSpecificProperties = this.m_CellTemplates[num].GetRowSpecificProperties(row);
                if ((rowSpecificProperties.Visible.Value && rowSpecificProperties.CachedBounds.HasValue) && rowSpecificProperties.CachedBounds.Value.Contains(pos_x, pos_y))
                {
                    return(num);
                }
                num--;
            }
            return(num);
        }
Пример #6
0
        internal RowSpecificCellProperties GetRowSpecificProperties(Row row)
        {
            RowSpecificCellProperties properties = null;

            if (row != null)
            {
                properties = (RowSpecificCellProperties)row.RowSpecificCellProperties[this];
                if (properties == null)
                {
                    properties = new RowSpecificCellProperties(this);
                    row.RowSpecificCellProperties[this] = properties;
                }
            }
            return(properties);
        }
Пример #7
0
 public override int GetAutoHeight(Row r, int index, RowSpecificCellProperties preRscp)
 {
     int num = 0;
     if (!base.AutoHeight)
     {
         return base.Bounds.Height;
     }
     RowSpecificCellProperties properties = (preRscp == null) ? base.GetRowSpecificProperties(r) : preRscp;
     if (properties.CachedAutoHeight >= 0)
     {
         return properties.CachedAutoHeight;
     }
     string text = this.GetText(base[r, index]);
     if (((text == null) || (text.Length == 0)) || !properties.Visible.Value)
     {
         return 0;
     }
     int gridWidth = 0;
     Resco.Controls.AdvancedList.AdvancedList parent = base.Parent;
     if (parent != null)
     {
         gridWidth = parent.CalculateClientRect().Width - (parent.ScrollbarVisible ? parent.ScrollbarWidth : 0);
     }
     if (gridWidth != 0)
     {
         Rectangle rectangle = base.CalculateCellWidth(gridWidth);
         rectangle.Width -= 3;
         if (rectangle.Width > base.Parent.ScrollbarWidth)
         {
             Graphics gr = base.Graphics;
             bool flag = false;
             if ((gr == null) && (base.Parent != null))
             {
                 gr = base.Parent.CreateGraphics();
                 flag = true;
             }
             WrapTextData data = Utility.WrapText(gr, text, this.m_Font, rectangle.Width);
             if ((gr != null) && flag)
             {
                 gr.Dispose();
             }
             num = (data != null) ? (data.Height + 2) : 0;
         }
     }
     properties.CachedAutoHeight = num;
     return num;
 }
Пример #8
0
        protected internal virtual void Draw(Graphics gr, int xOffset, int yOffset, Row row, int width, int height)
        {
            Color colorKey;

            this.CurrentRow = row;
            if (height == -1)
            {
                height = this.GetHeight(row);
            }
            if (this.m_BackColor == Color.Transparent)
            {
                if (this.Parent.BackgroundType == BackgroundType.btGradient)
                {
                    colorKey = this.Parent.m_colorKey;
                }
                else
                {
                    colorKey = this.Parent.BackColor;
                }
            }
            else
            {
                colorKey = this.m_BackColor;
            }
            if (((this.GradientBackColor != null) && !this.GradientBackColor.CanDraw()) && (this.Parent != null))
            {
                if ((this.Parent.BackgroundType == BackgroundType.btSolid) || (this.m_BackColor != Color.Transparent))
                {
                    gr.FillRectangle(Resco.Controls.AdvancedList.AdvancedList.GetBrush(colorKey), xOffset, yOffset, width, height);
                }
            }
            else
            {
                this.m_bgRect.X      = xOffset;
                this.m_bgRect.Y      = yOffset;
                this.m_bgRect.Width  = width;
                this.m_bgRect.Height = height;
                this.m_gradientBackColor.DrawGradient(gr, this.m_bgRect);
            }
            int count = this.m_CellTemplates.Count;

            for (int i = 0; i < count; i++)
            {
                Cell cell = this.m_CellTemplates[i];
                RowSpecificCellProperties rscp = null;
                object data = null;
                if (cell.CustomizeCell && (this.Parent != null))
                {
                    rscp = cell.GetRowSpecificProperties(row);
                    if (rscp.Cea != null)
                    {
                        cell = rscp.Cea.Cell;
                        data = rscp.Cea.Data;
                    }
                }
                else
                {
                    data = cell[row, i];
                }
                if (cell is ButtonCell)
                {
                    ((ButtonCell)cell).Pressed = row.PressedButtonIndex == i;
                }
                if ((cell != null) && cell.Visible)
                {
                    cell.Draw(gr, xOffset, yOffset, width, data, rscp);
                }
                if (rscp != null)
                {
                    rscp.Cea = null;
                }
            }
        }
Пример #9
0
        protected internal virtual void Draw(System.Drawing.Graphics gr, int xOffset, int yOffset, int gridWidth, object data, RowSpecificCellProperties rscp)
        {
            this.CurrentData = data;
            Rectangle drawbounds = this.CalculateBounds(xOffset, yOffset, this.Owner.CurrentRow, gridWidth, rscp);

            if (this.m_bVisible)
            {
                this.DrawBackground(gr, drawbounds);
                this.DrawContent(gr, drawbounds, data);
                this.DrawBorder(gr, drawbounds);
                if ((this.Selectable && (this.Owner.CurrentRow == this.Parent.ActiveRow)) && ((this.Parent.SelectedCell == this) || ((rscp != null) && (rscp.OriginalCell == this.Parent.SelectedCell))))
                {
                    this.DrawSelection(gr, drawbounds);
                }
            }
            this.CurrentData = null;
        }
Пример #10
0
 internal RowSpecificCellProperties GetRowSpecificProperties(Row row)
 {
     RowSpecificCellProperties properties = null;
     if (row != null)
     {
         properties = (RowSpecificCellProperties) row.RowSpecificCellProperties[this];
         if (properties == null)
         {
             properties = new RowSpecificCellProperties(this);
             row.RowSpecificCellProperties[this] = properties;
         }
     }
     return properties;
 }
Пример #11
0
 protected internal virtual void Draw(System.Drawing.Graphics gr, int xOffset, int yOffset, int gridWidth, object data, RowSpecificCellProperties rscp)
 {
     this.CurrentData = data;
     Rectangle drawbounds = this.CalculateBounds(xOffset, yOffset, this.Owner.CurrentRow, gridWidth, rscp);
     if (this.m_bVisible)
     {
         this.DrawBackground(gr, drawbounds);
         this.DrawContent(gr, drawbounds, data);
         this.DrawBorder(gr, drawbounds);
         if ((this.Selectable && (this.Owner.CurrentRow == this.Parent.ActiveRow)) && ((this.Parent.SelectedCell == this) || ((rscp != null) && (rscp.OriginalCell == this.Parent.SelectedCell))))
         {
             this.DrawSelection(gr, drawbounds);
         }
     }
     this.CurrentData = null;
 }
Пример #12
0
 protected internal virtual Rectangle CalculateBounds(int xOffset, int yOffset, Row row, int gridWidth, RowSpecificCellProperties preRscp)
 {
     Rectangle rectangle;
     RowSpecificCellProperties rowSpecificProperties = preRscp;
     if (rowSpecificProperties == null)
     {
         rowSpecificProperties = this.GetRowSpecificProperties(row);
     }
     if ((rowSpecificProperties != null) && rowSpecificProperties.CachedBounds.HasValue)
     {
         rectangle = rowSpecificProperties.CachedBounds.Value;
     }
     else
     {
         int cachedAutoHeight = 0;
         if ((rowSpecificProperties != null) && (rowSpecificProperties.CachedAutoHeight >= 0))
         {
             cachedAutoHeight = rowSpecificProperties.CachedAutoHeight;
         }
         rectangle = this.CalculateCellWidth(gridWidth);
         if (this.AutoHeight && (cachedAutoHeight > this.m_Bounds.Height))
         {
             rectangle.Height = cachedAutoHeight;
         }
         if ((this.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom)
         {
             if ((this.Anchor & AnchorStyles.Top) == AnchorStyles.Top)
             {
                 rectangle.Height = row.ActualHeight - (this.m_anchorSizeTop + this.m_anchorSizeBottom);
                 if (rectangle.Height < 0)
                 {
                     rectangle.Height = 0;
                 }
             }
             else
             {
                 rectangle.Y = row.ActualHeight - (this.m_anchorSizeBottom + rectangle.Height);
                 if (rectangle.Y < 0)
                 {
                     rectangle.Y = 0;
                 }
             }
         }
         else if (rectangle.Bottom > row.ActualHeight)
         {
             rectangle.Height = row.ActualHeight - rectangle.Y;
         }
         if ((this.Parent != null) ? this.Parent.RightToLeft : false)
         {
             rectangle.X = gridWidth - rectangle.Right;
         }
         if (rowSpecificProperties != null)
         {
             rowSpecificProperties.CachedBounds = new Rectangle?(rectangle);
         }
     }
     rectangle.Offset(xOffset, yOffset);
     return rectangle;
 }
Пример #13
0
 public virtual int GetAutoHeight(Row r, int index, RowSpecificCellProperties preRscp)
 {
     RowSpecificCellProperties properties = (preRscp == null) ? this.GetRowSpecificProperties(r) : preRscp;
     properties.CachedAutoHeight = this.m_Bounds.Height;
     return properties.CachedAutoHeight;
 }