/// <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);
        }
Exemple #2
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);
        }
Exemple #3
0
 /// <summary>
 /// Returns the minimum required size of the current cell, calculating using the
 /// current DisplayString, Image and Borders information.
 /// </summary>
 /// <param name="p_Graphics">GDI+ drawing surface</param>
 /// <param name="p_Cell">The cell.</param>
 /// <param name="p_CellPosition">The cell position.</param>
 /// <returns></returns>
 public override SizeF GetRequiredSize(Graphics p_Graphics,
                                       Cells.ICellVirtual p_Cell,
                                       Position p_CellPosition)
 {
     return(VisualModelBase.CalculateRequiredSize(
                p_Graphics,
                p_Cell.GetDisplayText(p_CellPosition),
                StringFormat,
                GetCellFont(),
                this.cellImage,
                this.imageAlignment,
                this.doAlignTextToImage,
                this.doImageStretch,
                Border));
 }
        /// <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);
        }
        /// <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);
        }
Exemple #6
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);
                    }
                }
            }
        }
        /// <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);
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VisualModelBase"/> class.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="isReadOnly">if set to <c>true</c> model is read only.</param>
        /// <remarks>
        /// Copy Constructor.
        /// This method duplicates all reference fields (Image, Font, StringFormat) to create a new instance.
        /// </remarks>
        protected VisualModelBase(VisualModelBase source, bool isReadOnly)
        {
            // Duplicate the reference fieldsD
            Font l_tmpFont = null;

            if (source.font != null)
            {
                l_tmpFont = (Font)source.font.Clone();
            }
            StringFormat l_tmpStringFormat = null;

            if (source.stringFormat != null)
            {
                l_tmpStringFormat = (StringFormat)source.stringFormat.Clone();
            }

            this.isReadOnly   = isReadOnly;
            this.backColor    = source.backColor;
            this.foreColor    = source.foreColor;
            this.font         = l_tmpFont;
            this.stringFormat = l_tmpStringFormat;
            this.border       = source.border;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="VisualModelBase"/> class.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="isReadOnly">if set to <c>true</c> model is read only.</param>
        /// <remarks>
        /// Copy Constructor.
        /// This method duplicates all reference fields (Image, Font, StringFormat) to create a new instance.
        /// </remarks>
        protected VisualModelBase(VisualModelBase source, bool isReadOnly)
        {
            // Duplicate the reference fieldsD
              Font l_tmpFont = null;
              if (source.font != null)
              {
            l_tmpFont = (Font)source.font.Clone();
              }
              StringFormat l_tmpStringFormat = null;
              if (source.stringFormat != null)
              {
            l_tmpStringFormat = (StringFormat)source.stringFormat.Clone();
              }

              this.isReadOnly = isReadOnly;
              this.backColor = source.backColor;
              this.foreColor = source.foreColor;
              this.font = l_tmpFont;
              this.stringFormat = l_tmpStringFormat;
              this.border = source.border;
        }