Beispiel #1
0
        protected override void DrawCell_Background(Cells.ICellVirtual p_Cell,
                                                    Position p_CellPosition,
                                                    PaintEventArgs e,
                                                    Rectangle p_ClientRectangle,
                                                    DrawCellStatus p_Status)
        {
            Color l_BackColor = BackColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_BackColor = FocusBackColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_BackColor = SelectionBackColor;
            }

            using (SolidBrush br = new SolidBrush(l_BackColor))
            {
                if (p_Status == DrawCellStatus.Normal)
                {
                    e.Graphics.FillRectangle(br, p_ClientRectangle);
                }
                else
                {
                    br.Color = _selectionBackColor;//p_Cell.VisualModel.BackColor;
                    e.Graphics.FillRectangle(br, p_ClientRectangle);

                    Rectangle rect = new Rectangle(p_ClientRectangle.Left, p_ClientRectangle.Top, p_ClientRectangle.Width - 1, p_ClientRectangle.Height - 1);
                    e.Graphics.DrawRectangle(new Pen(Brushes.Black, 2), rect);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Draw the background of the specified cell. Background
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_Background(Cells.ICellVirtual p_Cell,
                                                    Position p_CellPosition,
                                                    PaintEventArgs e,
                                                    Rectangle p_ClientRectangle,
                                                    DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
            {
                return;
            }

            Color l_BackColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_BackColor = FocusBackColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_BackColor = SelectionBackColor;
            }
            else
            {
                l_BackColor = BackColor;
            }

            SolidBrush br = new SolidBrush(l_BackColor);

            e.Graphics.FillRectangle(br, p_ClientRectangle);
        }
Beispiel #3
0
        /// <summary>
        /// Draw the borders of the specified cell.
        /// </summary>
        /// <param name="p_Cell"></param>
        /// <param name="p_CellPosition"></param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status"></param>
        protected override void DrawCell_Border(Cells.ICellVirtual p_Cell,
                                                Position p_CellPosition,
                                                PaintEventArgs e,
                                                Rectangle p_ClientRectangle,
                                                DrawCellStatus p_Status)
        {
            RectangleBorder l_Border = Border;

            l_Border.SetColor(BorderColor);
            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border = FocusBorder;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border = SelectionBorder;
            }

            ControlPaint.DrawBorder(e.Graphics, p_ClientRectangle,
                                    l_Border.Left.Color,
                                    l_Border.Left.Width,
                                    ButtonBorderStyle.Solid,
                                    l_Border.Top.Color,
                                    l_Border.Top.Width,
                                    ButtonBorderStyle.Solid,
                                    l_Border.Right.Color,
                                    l_Border.Right.Width,
                                    ButtonBorderStyle.Solid,
                                    l_Border.Bottom.Color,
                                    l_Border.Bottom.Width,
                                    ButtonBorderStyle.Solid);
        }
Beispiel #4
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell"></param>
        /// <param name="p_CellPosition"></param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status"></param>
        protected override void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell,
                                                      Position p_CellPosition,
                                                      PaintEventArgs e,
                                                      Rectangle p_ClientRectangle,
                                                      DrawCellStatus p_Status)
        {
            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            Font l_CurrentFont = GetCellFont();

            //Image and Text
            Utility.PaintImageAndText(e.Graphics,
                                      p_ClientRectangle,
                                      Image,
                                      ImageAlignment,
                                      ImageStretch,
                                      p_Cell.GetDisplayText(p_CellPosition),
                                      StringFormat,
                                      AlignTextToImage,
                                      l_Border,
                                      l_ForeColor,
                                      l_CurrentFont);
        }
Beispiel #5
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(ICellVirtual p_Cell,
                                                      Position p_CellPosition,
                                                      PaintEventArgs e,
                                                      Rectangle p_ClientRectangle,
                                                      DrawCellStatus p_Status)
        {
            bool l_lastExpandedCell;

            ICell cell = p_Cell as ICell;

            if (cell == null)
            { // this must be a Virtual Cell.
                l_lastExpandedCell = false;
            }
            else
            {     // this is a Real Cell
                if (cell.Grid.Rows[cell.Row].Height == 0)
                { // It is safe to quit now if this cell isn't visible.
                    return;
                }
                l_lastExpandedCell = cell.IsLastExpandedCell;
            }

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            Font l_CurrentFont = GetCellFont();

            bool l_Expand = ExpandedCell;

            // Image and Text
            VisualModelBase.PaintImageAndText(e.Graphics,
                                              p_ClientRectangle,
                                              Image,
                                              ImageAlignment,
                                              ImageStretch,
                                              p_Cell.GetDisplayText(p_CellPosition),
                                              StringFormat,
                                              AlignTextToImage,
                                              l_Border,
                                              l_ForeColor,
                                              l_CurrentFont,
                                              l_Expand,
                                              l_lastExpandedCell);
        }
Beispiel #6
0
        /// <summary>
        /// Draw the background of the specified cell with gradient color. It changes the color when the mouse is upper the cell
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_Background(Cells.ICellVirtual p_Cell,
                                                    Position p_CellPosition,
                                                    PaintEventArgs e,
                                                    Rectangle p_ClientRectangle,
                                                    DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
            {
                return;
            }

            Color menuItemBackColorStart;
            Color menuItemBackColorEnd;

            Position mouseCellPosition = p_Cell.Grid.MouseCellPosition;
            Brush    backBrush;

            if ((p_Cell.Grid.FixedColumns > 0 && p_CellPosition.Column > p_Cell.Grid.FixedColumns - 1 && p_Cell.Grid.Columns[0].Width > 0) ||
                (p_Cell.Grid.FixedRows > 0 && p_CellPosition.Row > p_Cell.Grid.FixedRows - 1 && p_Cell.Grid.Rows[0].Height > 0))
            {
                if (mouseCellPosition == p_CellPosition)
                {
                    menuItemBackColorStart = Color.WhiteSmoke;
                    menuItemBackColorEnd   = Color.Orange;
                }
                else
                {
                    menuItemBackColorStart = Color.WhiteSmoke;
                    menuItemBackColorEnd   = Color.Gray;
                }
            }
            else
            {
                Point mousePoint = p_Cell.Grid.PointToClient(Grid.MousePosition); // peut etre source d'erreurs

                if ((mousePoint.X > p_ClientRectangle.Left && mousePoint.X < p_ClientRectangle.Right &&
                     mousePoint.Y > p_ClientRectangle.Top && mousePoint.Y < p_ClientRectangle.Bottom) || mouseCellPosition == p_CellPosition)
                {
                    menuItemBackColorStart = Color.WhiteSmoke;
                    menuItemBackColorEnd   = Color.Orange;
                }
                else
                {
                    menuItemBackColorStart = Color.WhiteSmoke;
                    menuItemBackColorEnd   = Color.Gray;
                }
            }

            backBrush = new LinearGradientBrush(
                p_ClientRectangle,
                menuItemBackColorStart, menuItemBackColorEnd, LinearGradientMode.Vertical);
            e.Graphics.FillRectangle(backBrush, p_ClientRectangle);
        }
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell,
        /// relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(
            ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e,
            System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
            {
                return;
            }

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            ICellBitmapCell l_BitmapCell  = (ICellBitmapCell)p_Cell;
            Font            l_CurrentFont = GetCellFont();

            Image l_Image = (Image)l_BitmapCell.GetBitmap(p_CellPosition);

            bool l_lastExpandedCell = p_Cell is ICell && ((ICell)p_Cell).IsLastExpandedCell;

            // Image and Text
            VisualModelBase.PaintImageAndText(e.Graphics,
                                              p_ClientRectangle,
                                              l_Image,
                                              imageAlignment,
                                              ImageStretch,
                                              string.Empty, // p_Cell.GetDisplayText(p_CellPosition),
                                              StringFormat,
                                              AlignTextToImage,
                                              l_Border,
                                              l_ForeColor,
                                              l_CurrentFont,
                                              false,
                                              l_lastExpandedCell);
        }
Beispiel #8
0
        /// <summary>
        /// Draw the background of the specified cell. Background
        /// </summary>
        /// <param name="p_Cell"></param>
        /// <param name="p_CellPosition"></param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status"></param>
        protected override void DrawCell_Background(Cells.ICellVirtual p_Cell,
                                                    Position p_CellPosition,
                                                    PaintEventArgs e,
                                                    Rectangle p_ClientRectangle,
                                                    DrawCellStatus p_Status)
        {
            Color l_BackColor = BackColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_BackColor = FocusBackColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_BackColor = SelectionBackColor;
            }

            using (SolidBrush br = new SolidBrush(l_BackColor))
            {
                e.Graphics.FillRectangle(br, p_ClientRectangle);
            }
        }
   /// <summary>
   /// Draw the image and the DisplayString of the specified cell.
   /// </summary>
   /// <param name="p_Cell">The cell.</param>
   /// <param name="p_CellPosition">The cell position.</param>
   /// <param name="e">Paint arguments</param>
   /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
   /// <param name="p_Status">The cell status.</param>
   protected abstract void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell,
 Position p_CellPosition,
 PaintEventArgs e,
 Rectangle p_ClientRectangle,
 DrawCellStatus p_Status);
Beispiel #10
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell"></param>
        /// <param name="p_CellPosition"></param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status"></param>
        protected override void DrawCell_ImageAndText(ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e, System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            //in questo caso non chiamo la classe base perch� devo disegnare una textbox
            //base.DrawCell_ImageAndText (p_Cell, p_CellPosition, e, p_ClientRectangle, p_ForeColor, p_CellBorder);

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            ICellCheckBox  l_CheckBox = (ICellCheckBox)p_Cell;
            CheckBoxStatus l_Status   = l_CheckBox.GetCheckBoxStatus(p_CellPosition);

            Image l_CheckImage = GetImageForState(l_Status.Checked, p_Cell.Grid.MouseCellPosition == p_CellPosition, l_Status.CheckEnable);

            Font l_CurrentFont = GetCellFont();

            //Image and Text
            Utility.PaintImageAndText(e.Graphics,
                                      p_ClientRectangle,
                                      l_CheckImage,
                                      m_CheckBoxAlignment,
                                      ImageStretch,
                                      l_Status.Caption,
                                      StringFormat,
                                      AlignTextToImage,
                                      l_Border,
                                      l_ForeColor,
                                      l_CurrentFont);
        }
Beispiel #11
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e, System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            //base.DrawCell_ImageAndText (p_Cell, p_CellPosition, e, p_ClientRectangle, p_ForeColor, p_CellBorder);
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
            {
                return;
            }

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            ICellCheckBox  l_CheckBox = (ICellCheckBox)p_Cell;
            CheckBoxStatus l_Status   = l_CheckBox.GetCheckBoxStatus(p_CellPosition);

            Image l_CheckImage = GetImageForState(l_Status.Checked, p_Cell.Grid.MouseCellPosition == p_CellPosition, l_Status.CheckEnable);

            Font l_CurrentFont = GetCellFont();

            bool l_lastExpandedCell = p_Cell is ICell && ((ICell)p_Cell).IsLastExpandedCell;

            // Image and Text
            VisualModelBase.PaintImageAndText(e.Graphics,
                                              p_ClientRectangle,
                                              l_CheckImage,
                                              checkBoxAlignment,
                                              ImageStretch,
                                              l_Status.Caption,
                                              StringFormat,
                                              AlignTextToImage,
                                              l_Border,
                                              l_ForeColor,
                                              l_CurrentFont,
                                              false,
                                              l_lastExpandedCell);
        }
Beispiel #12
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            base.DrawCell_ImageAndText(p_Cell, p_CellPosition, e, p_ClientRectangle, p_Status);

              if (p_Cell is ICellSortableHeader)
              {
            ICellSortableHeader l_Header = (ICellSortableHeader)p_Cell;
            SortStatus l_Status = l_Header.GetSortStatus(p_CellPosition);

            if (l_Status.EnableSort)
            {
              if (l_Status.Mode == GridSortMode.Ascending)
              {
            VisualModelBase.PaintImageAndText(e.Graphics, p_ClientRectangle, IconUtility.SortUp, ContentAlignment.MiddleRight, false, null, null, false, Border, Color.Black, null, false, false);
              }
              else if (l_Status.Mode == GridSortMode.Descending)
              {
            VisualModelBase.PaintImageAndText(e.Graphics, p_ClientRectangle, IconUtility.SortDown, ContentAlignment.MiddleRight, false, null, null, false, Border, Color.Black, null, false, false);
              }
            }
              }
        }
Beispiel #13
0
        /// <summary>
        /// Draw the borders of the specified cell using DrawGradient3DBorder
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_Border(Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            Color l_BackColor;
              if (p_Status == DrawCellStatus.Focus)
              {
            l_BackColor = FocusBackColor;
              }
              else if (p_Status == DrawCellStatus.Selected)
              {
            l_BackColor = SelectionBackColor;
              }
              else
              {
            l_BackColor = BackColor;
              }

              if (p_CellPosition == p_Cell.Grid.MouseDownPosition)
              {
            DrawGradient3DBorder(e.Graphics, p_ClientRectangle, l_BackColor, HeaderShadowColor, HeaderLightColor, HeaderShadowBorderWidth, HeaderLightBorderWidth, Gradient3DBorderStyle.Sunken);
              }
              else
              {
            DrawGradient3DBorder(e.Graphics, p_ClientRectangle, l_BackColor, HeaderShadowColor, HeaderLightColor, HeaderShadowBorderWidth, HeaderLightBorderWidth, Gradient3DBorderStyle.Raised);
              }
        }
Beispiel #14
0
 /// <summary>
 /// Draw the image and the displaystring of the specified cell.
 /// </summary>
 /// <param name="p_Cell"></param>
 /// <param name="p_CellPosition"></param>
 /// <param name="e">Paint arguments</param>
 /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
 /// <param name="p_Status"></param>
 protected abstract void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell,
                                               Position p_CellPosition,
                                               PaintEventArgs e,
                                               Rectangle p_ClientRectangle,
                                               DrawCellStatus p_Status);
Beispiel #15
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            base.DrawCell_ImageAndText(p_Cell, p_CellPosition, e, p_ClientRectangle, p_Status);

            if (p_Cell is ICellSortableHeader)
            {
                ICellSortableHeader l_Header = (ICellSortableHeader)p_Cell;
                SortStatus          l_Status = l_Header.GetSortStatus(p_CellPosition);

                if (l_Status.EnableSort)
                {
                    if (l_Status.Mode == GridSortMode.Ascending)
                    {
                        VisualModelBase.PaintImageAndText(e.Graphics, p_ClientRectangle, IconUtility.SortUp, ContentAlignment.MiddleRight, false, null, null, false, Border, Color.Black, null, false, false);
                    }
                    else if (l_Status.Mode == GridSortMode.Descending)
                    {
                        VisualModelBase.PaintImageAndText(e.Graphics, p_ClientRectangle, IconUtility.SortDown, ContentAlignment.MiddleRight, false, null, null, false, Border, Color.Black, null, false, false);
                    }
                }
            }
        }
Beispiel #16
0
        /// <summary>
        /// Draw the background of the specified cell. Background
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_Background(Cells.ICellVirtual p_Cell,
      Position p_CellPosition,
      PaintEventArgs e,
      Rectangle p_ClientRectangle,
      DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
              {
            return;
              }

              Color l_BackColor;
              if (p_Status == DrawCellStatus.Focus)
              {
            l_BackColor = FocusBackColor;
              }
              else if (p_Status == DrawCellStatus.Selected)
              {
            l_BackColor = SelectionBackColor;
              }
              else
              {
            l_BackColor = BackColor;
              }

              SolidBrush br = new SolidBrush(l_BackColor);
              e.Graphics.FillRectangle(br, p_ClientRectangle);
        }
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e, System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            base.DrawCell_ImageAndText(p_Cell, p_CellPosition, e, p_ClientRectangle, p_Status);

              RectangleBorder l_Border = Border;
              Color l_ForeColor = ForeColor;
              if (p_Status == DrawCellStatus.Focus)
              {
            l_Border = FocusBorder;
            l_ForeColor = FocusForeColor;
              }
              else if (p_Status == DrawCellStatus.Selected)
              {
            l_Border = SelectionBorder;
            l_ForeColor = SelectionForeColor;
              }

              for (int i = 0; i < positionedImages.Count; i++)
              {
            if (positionedImages[i] != null)
            {
              VisualModelBase.PaintImageAndText(e.Graphics,
            p_ClientRectangle,
            positionedImages[i].Image,
            positionedImages[i].Alignment,
            false,
            null, // not used
            null, // not used
            false, // not used
            l_Border,
            l_ForeColor,
            null,//not used
            false,
            false);
            }
              }
        }
Beispiel #18
0
        /// <summary>
        /// Draw the image and the display string of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
            {
                return;
            }

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            IExpandCell l_Cell   = (IExpandCell)p_Cell;
            bool        l_Status = l_Cell.GetStateValue(p_CellPosition);

            Image l_StateImage = GetImageForState(l_Status);

            Font l_CurrentFont = GetCellFont();

            // Image and Text
            VisualModelBase.PaintImageAndText(e.Graphics,
                                              p_ClientRectangle,
                                              l_StateImage,
                                              ContentAlignment.MiddleCenter,
                                              false, // unused
                                              null,  // unused
                                              StringFormat,
                                              false, // unused
                                              l_Border,
                                              l_ForeColor,
                                              l_CurrentFont,
                                              false,
                                              false);
        }
Beispiel #19
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(ICellVirtual p_Cell,
      Position p_CellPosition,
      PaintEventArgs e,
      Rectangle p_ClientRectangle,
      DrawCellStatus p_Status)
        {
            bool l_lastExpandedCell;

              ICell cell = p_Cell as ICell;
              if (cell == null)
              { // this must be a Virtual Cell.
            l_lastExpandedCell = false;
              }
              else
              { // this is a Real Cell
            if (cell.Grid.Rows[cell.Row].Height == 0)
            { // It is safe to quit now if this cell isn't visible.
              return;
            }
            l_lastExpandedCell = cell.IsLastExpandedCell;
              }

              RectangleBorder l_Border = Border;
              Color l_ForeColor = ForeColor;
              if (p_Status == DrawCellStatus.Focus)
              {
            l_Border = FocusBorder;
            l_ForeColor = FocusForeColor;
              }
              else if (p_Status == DrawCellStatus.Selected)
              {
            l_Border = SelectionBorder;
            l_ForeColor = SelectionForeColor;
              }

              Font l_CurrentFont = GetCellFont();

              bool l_Expand = ExpandedCell;

              // Image and Text
              VisualModelBase.PaintImageAndText(e.Graphics,
            p_ClientRectangle,
            Image,
            ImageAlignment,
            ImageStretch,
            p_Cell.GetDisplayText(p_CellPosition),
            StringFormat,
            AlignTextToImage,
            l_Border,
            l_ForeColor,
            l_CurrentFont,
            l_Expand,
            l_lastExpandedCell);
        }
Beispiel #20
0
        /// <summary>
        /// Draw the image and the display string of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
              {
            return;
              }

              RectangleBorder l_Border = Border;
              Color l_ForeColor = ForeColor;

              IExpandCell l_Cell = (IExpandCell)p_Cell;
              bool l_Status = l_Cell.GetStateValue(p_CellPosition);

              Image l_StateImage = GetImageForState(l_Status);

              Font l_CurrentFont = GetCellFont();

              // Image and Text
              VisualModelBase.PaintImageAndText(e.Graphics,
            p_ClientRectangle,
            l_StateImage,
            ContentAlignment.MiddleCenter,
            false,      // unused
            null,      // unused
            StringFormat,
            false,      // unused
            l_Border,
            l_ForeColor,
            l_CurrentFont,
            false,
            false);
        }
Beispiel #21
0
        /// <summary>
        /// Draw the borders of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_Border(Cells.ICellVirtual p_Cell,
      Position p_CellPosition,
      PaintEventArgs e,
      Rectangle p_ClientRectangle,
      DrawCellStatus p_Status)
        {
            RectangleBorder l_Border = Border;
              if (p_Status == DrawCellStatus.Focus)
              {
            l_Border = FocusBorder;
              }
              else if (p_Status == DrawCellStatus.Selected)
              {
            l_Border = SelectionBorder;
              }

              ControlPaint.DrawBorder(e.Graphics, p_ClientRectangle,
            l_Border.Left.Color,
            l_Border.Left.Width,
            ButtonBorderStyle.Solid,
            l_Border.Top.Color,
            l_Border.Top.Width,
            ButtonBorderStyle.Solid,
            l_Border.Right.Color,
            l_Border.Right.Width,
            ButtonBorderStyle.Solid,
            l_Border.Bottom.Color,
            l_Border.Bottom.Width,
            ButtonBorderStyle.Solid);
        }
Beispiel #22
0
        /// <summary>
        /// Draw the background of the specified cell with gradient color. It changes the color when the mouse is upper the cell
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_Background(Cells.ICellVirtual p_Cell,
      Position p_CellPosition,
      PaintEventArgs e,
      Rectangle p_ClientRectangle,
      DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
              {
            return;
              }

              Color menuItemBackColorStart;
              Color menuItemBackColorEnd;

              Position mouseCellPosition = p_Cell.Grid.MouseCellPosition;
              Brush backBrush;

              if ((p_Cell.Grid.FixedColumns > 0 && p_CellPosition.Column > p_Cell.Grid.FixedColumns - 1 && p_Cell.Grid.Columns[0].Width > 0)
               || (p_Cell.Grid.FixedRows > 0 && p_CellPosition.Row > p_Cell.Grid.FixedRows - 1 && p_Cell.Grid.Rows[0].Height > 0))
              {
            if (mouseCellPosition == p_CellPosition)
            {
              menuItemBackColorStart = Color.WhiteSmoke;
              menuItemBackColorEnd = Color.Orange;
            }
            else
            {
              menuItemBackColorStart = Color.WhiteSmoke;
              menuItemBackColorEnd = Color.Gray;
            }
              }
              else
              {
            Point mousePoint = p_Cell.Grid.PointToClient(Grid.MousePosition);  // peut etre source d'erreurs

            if ((mousePoint.X > p_ClientRectangle.Left && mousePoint.X < p_ClientRectangle.Right &&
              mousePoint.Y > p_ClientRectangle.Top && mousePoint.Y < p_ClientRectangle.Bottom) || mouseCellPosition == p_CellPosition)
            {
              menuItemBackColorStart = Color.WhiteSmoke;
              menuItemBackColorEnd = Color.Orange;
            }
            else
            {
              menuItemBackColorStart = Color.WhiteSmoke;
              menuItemBackColorEnd = Color.Gray;
            }
              }

              backBrush = new LinearGradientBrush(
            p_ClientRectangle,
            menuItemBackColorStart, menuItemBackColorEnd, LinearGradientMode.Vertical);
              e.Graphics.FillRectangle(backBrush, p_ClientRectangle);
        }
Beispiel #23
0
        /// <summary>
        /// Draw the borders of the specified cell using DrawGradient3DBorder
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_Border(Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            Color l_BackColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_BackColor = FocusBackColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_BackColor = SelectionBackColor;
            }
            else
            {
                l_BackColor = BackColor;
            }

            if (p_CellPosition == p_Cell.Grid.MouseDownPosition)
            {
                DrawGradient3DBorder(e.Graphics, p_ClientRectangle, l_BackColor, HeaderShadowColor, HeaderLightColor, HeaderShadowBorderWidth, HeaderLightBorderWidth, Gradient3DBorderStyle.Sunken);
            }
            else
            {
                DrawGradient3DBorder(e.Graphics, p_ClientRectangle, l_BackColor, HeaderShadowColor, HeaderLightColor, HeaderShadowBorderWidth, HeaderLightBorderWidth, Gradient3DBorderStyle.Raised);
            }
        }
Beispiel #24
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell,
        /// relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(
      ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e,
      System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
              {
            return;
              }

              RectangleBorder l_Border = Border;
              Color l_ForeColor = ForeColor;
              if (p_Status == DrawCellStatus.Focus)
              {
            l_Border = FocusBorder;
            l_ForeColor = FocusForeColor;
              }
              else if (p_Status == DrawCellStatus.Selected)
              {
            l_Border = SelectionBorder;
            l_ForeColor = SelectionForeColor;
              }

              ICellBitmapCell l_BitmapCell = (ICellBitmapCell)p_Cell;
              Font l_CurrentFont = GetCellFont();

              Image l_Image = (Image)l_BitmapCell.GetBitmap(p_CellPosition);

              bool l_lastExpandedCell = p_Cell is ICell && ((ICell)p_Cell).IsLastExpandedCell;

              // Image and Text
              VisualModelBase.PaintImageAndText(e.Graphics,
            p_ClientRectangle,
            l_Image,
            imageAlignment,
            ImageStretch,
            string.Empty, // p_Cell.GetDisplayText(p_CellPosition),
            StringFormat,
            AlignTextToImage,
            l_Border,
            l_ForeColor,
            l_CurrentFont,
            false,
            l_lastExpandedCell);
        }
Beispiel #25
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell"></param>
        /// <param name="p_CellPosition"></param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status"></param>
        protected override void DrawCell_ImageAndText(Cells.ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e, System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            base.DrawCell_ImageAndText(p_Cell, p_CellPosition, e, p_ClientRectangle, p_Status);

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            for (int i = 0; i < m_Images.Count; i++)
            {
                if (m_Images[i] != null)
                {
                    Utility.PaintImageAndText(e.Graphics,
                                              p_ClientRectangle,
                                              m_Images[i].Image,
                                              m_Images[i].Alignment,
                                              false,
                                              null,        //not used
                                              null,        //not used
                                              false,       //not used
                                              l_Border,
                                              Color.Black, //not used
                                              null);       //not used
                }
            }
        }
Beispiel #26
0
        /// <summary>
        /// Draw the borders of the specified cell using DrawGradient3DBorder
        /// </summary>
        /// <param name="p_Cell"></param>
        /// <param name="p_CellPosition"></param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status"></param>
        protected override void DrawCell_Border(SourceGrid2.Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            Color l_BackColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_BackColor = Color.Black;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_BackColor = Color.Black;
            }
            else
            {
                l_BackColor = BackColor;
            }

            if (p_CellPosition == p_Cell.Grid.MouseDownPosition)
            {
                SourceLibrary.Drawing.ControlPaint.DrawGradient3DBorder(e.Graphics, p_ClientRectangle, l_BackColor, HeaderShadowColor, HeaderLightColor, HeaderShadowBorderWidth, HeaderLightBorderWidth, SourceLibrary.Drawing.Gradient3DBorderStyle.Sunken);
            }
            else
            {
                SourceLibrary.Drawing.ControlPaint.DrawGradient3DBorder(e.Graphics, p_ClientRectangle, l_BackColor, HeaderShadowColor, HeaderLightColor, HeaderShadowBorderWidth, HeaderLightBorderWidth, SourceLibrary.Drawing.Gradient3DBorderStyle.Raised);
            }
        }