예제 #1
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);
        }
예제 #2
0
        /// <summary>
        /// Toggle the state value of the image cell
        /// </summary>
        /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionEventArgs"/> instance containing the event data.</param>
        public void ChangeState(PositionEventArgs e)
        {
            e.Grid.Redraw = false;
            IExpandCell l_Cell     = (IExpandCell)e.Cell;
            bool        l_newState = !l_Cell.GetStateValue(e.Position);

            l_Cell.SetStateValue(e.Position, l_newState);

            foreach (ICell item in l_Cell.GetChildCells())
            {
                if (l_newState == true)
                {
                    e.Grid.Rows[item.Row].Height = 0;
                }
                else
                {
                    e.Grid.AutoSizeRowRange(item.Row, 10, 0, e.Grid.ColumnsCount - 1);
                }
            }

            e.Grid.Redraw = true;

            //  e.Grid.InvalidateRange(new Range(e.Position.Row, 0, e.Grid.RowsCount-1, e.Grid.ColumnsCount-1));
        }