public override void Draw(RangePaintEventArgs e)
		{
			RangeRegion region = mSelection.GetSelectionRegion();

			if (region.IsEmpty())
				return;

			// get visible range for scrollable area
			Range visibleScrollabeRange = mSelection.Grid.RangeAtAreaExpanded(CellPositionType.Scrollable);
			
			
			System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);

			CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
			// get focus rectangle
			// clipped to visible range
			Range focusClippedRange = visibleScrollabeRange.Intersect(new Range(mSelection.ActivePosition, mSelection.ActivePosition));
			System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(focusClippedRange.Start);

			//Draw each selection range
			foreach (Range rangeToLoop in region)
			{
				// intersect given range with visible range
				// this way we ensure we don't loop through thousands
				// of rows to calculate rectToDraw
				Range rng = visibleScrollabeRange.Intersect(rangeToLoop);
				

				System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
				if (rectToDraw == System.Drawing.Rectangle.Empty)
					continue;

				System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);

				if (rectToDraw.IntersectsWith(focusRect))
					regionToDraw.Exclude(focusRect);

				e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);

				//Draw the border only if there isn't a editing cell
				// and is the range that contains the focus or there is a single range
				if (rng.Contains(mSelection.ActivePosition) || region.Count == 1)
				{
					if (focusContext.IsEditing() == false)
						mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
				}
			}

			//Draw Focus
			System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
			e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
		}
Exemple #2
0
        public override void Draw(RangePaintEventArgs e)
        {
            RangeRegion region = mSelection.GetSelectionRegion();

            if (region.IsEmpty())
            {
                return;
            }

            System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);

            CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);

            System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(mSelection.ActivePosition);

            RangeCollection ranges = region.GetRanges();

            //Draw each selection range
            foreach (Range rng in ranges)
            {
                System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
                if (rectToDraw == System.Drawing.Rectangle.Empty)
                {
                    continue;
                }

                System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);

                if (rectToDraw.IntersectsWith(focusRect))
                {
                    regionToDraw.Exclude(focusRect);
                }

                e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);

                //Draw the border only if there isn't a editing cell
                // and is the range that contains the focus or there is a single range
                if (rng.Contains(mSelection.ActivePosition) || ranges.Count == 1)
                {
                    if (focusContext == null || focusContext.IsEditing() == false)
                    {
                        mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
                    }
                }
            }

            //Draw Focus
            System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
            e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
        }
        public override void Draw(RangePaintEventArgs e)
        {
            RangeRegion region = mSelection.GetSelectionRegion();

            if (region.IsEmpty())
                return;

            System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);

            CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
            System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(mSelection.ActivePosition);

            RangeCollection ranges = region.GetRanges();

            //Draw each selection range
            foreach (Range rng in ranges)
            {
                System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
                if (rectToDraw == System.Drawing.Rectangle.Empty)
                    continue;

                System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);

                if (rectToDraw.IntersectsWith(focusRect))
                    regionToDraw.Exclude(focusRect);

                e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);

                //Draw the border only if there isn't a editing cell
                // and is the range that contains the focus or there is a single range
                if (rng.Contains(mSelection.ActivePosition) || ranges.Count == 1)
                {
                    if (focusContext == null || focusContext.IsEditing() == false)
                        mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
                }
            }

            //Draw Focus
            System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
            e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
        }
        public override void Draw(RangePaintEventArgs e)
        {
            RangeRegion region = mSelection.GetSelectionRegion();

            if (region.IsEmpty())
            {
                return;
            }

            // get visible range for scrollable area
            // AlanP: June 2014.  Changed the call from RangeAtAreaExpanded to RangeAtArea to fix a bug that occurred on Partner/Find screen
            // The grid on this screen has 3 fixed columns on the left but the highlight was always applied to the cell 'behind' the last fixed column
            //   as well as the rest of the row.  This is because of getting the 'expanded' range.
            // To be honest I don't understand what the expanded range is for.  The comment for it is not helpful (to me anyway).
            // It may be something to do with drawing the focus cell?  If we see a problem later we could revies this code
            //Range visibleScrollabeRange = mSelection.Grid.RangeAtAreaExpanded(CellPositionType.Scrollable);
            Range visibleScrollableRange = mSelection.Grid.RangeAtArea(CellPositionType.Scrollable);

            System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);

            // In OP we would like to have the rows of fixed columns highlighted as well - this seems non-standard
            // This code is the same as is used in the standard code below, but for the FixedLeft Range
            Range visibleFixedLeftRange = mSelection.Grid.RangeAtArea(CellPositionType.FixedLeft);

            foreach (Range rangeToLoop in region)
            {
                Range rng = visibleFixedLeftRange.Intersect(rangeToLoop);
                System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
                if (rectToDraw == System.Drawing.Rectangle.Empty)
                {
                    continue;
                }

                System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);
                e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);
            }

            // Deal with the focus rectangle...  The original grid code does not seem to support the focus being on a fixed column, which seems like a bug
            //  but does not affect OpenPetra
            CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
            // get focus rectangle
            // clipped to visible range
            Range focusClippedRange = visibleScrollableRange.Intersect(new Range(mSelection.ActivePosition, mSelection.ActivePosition));

            System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(focusClippedRange.Start);

            //Draw each selection range
            foreach (Range rangeToLoop in region)
            {
                // intersect given range with visible range
                // this way we ensure we don't loop through thousands
                // of rows to calculate rectToDraw
                Range rng = visibleScrollableRange.Intersect(rangeToLoop);

                System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
                if (rectToDraw == System.Drawing.Rectangle.Empty)
                {
                    continue;
                }

                System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);

                if (rectToDraw.IntersectsWith(focusRect))
                {
                    regionToDraw.Exclude(focusRect);
                }

                e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);

                //Draw the border only if there isn't a editing cell
                // and is the range that contains the focus or there is a single range
                if (rng.Contains(mSelection.ActivePosition) || region.Count == 1)
                {
                    if (focusContext.IsEditing() == false)
                    {
                        mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
                    }
                }
            }

            //Draw Focus
            System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
            e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
        }
 public override void Draw(RangePaintEventArgs e)
 {
 }
Exemple #6
0
 public abstract void Draw(RangePaintEventArgs e);
 public override void Draw(RangePaintEventArgs e)
 {
 }
Exemple #8
0
        public override void Draw(RangePaintEventArgs e)
        {
            RangeRegion region = mSelection.GetSelectionRegion();

            if (region.IsEmpty())
            {
                return;
            }

            //[email protected]: To support freezePanes enahancement
            // get visible range for data area
            Range dataRange = mSelection.Grid.CompleteRange;

            System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);

            CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
            // get focus rectangle
            // clipped to visible range
            Range focusClippedRange = dataRange.Intersect(new Range(mSelection.ActivePosition, mSelection.ActivePosition));

            System.Drawing.Rectangle focusRect = e.Grid.PositionToVisibleRectangle(focusClippedRange.Start);

            //[email protected]: To support smooth scrolling. Otherwise transform will not be applied.
            focusRect.X -= (int)e.GraphicsCache.Graphics.Transform.OffsetX;
            focusRect.Y -= (int)e.GraphicsCache.Graphics.Transform.OffsetY;

            bool isFocusCellVisible = e.Grid.IsCellVisible(focusContext.Position, true);

            //Draw each selection range
            foreach (Range rangeToLoop in region)
            {
                // intersect given range with visible range
                // this way we ensure we don't loop through thousands
                // of rows to calculate rectToDraw
                Range rng = dataRange.Intersect(rangeToLoop);

                //[email protected]: To support freezePanes enahancement
                System.Drawing.Rectangle rectToDraw = e.Grid.RangeToVisibleRectangle(rng);

                //[email protected]: To support smooth scrolling. Otherwise transform will not be applied.
                rectToDraw.X -= (int)e.GraphicsCache.Graphics.Transform.OffsetX;
                rectToDraw.Y -= (int)e.GraphicsCache.Graphics.Transform.OffsetY;

                if (rectToDraw == System.Drawing.Rectangle.Empty)
                {
                    continue;
                }

                System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);

                Range cellRange = e.Grid.PositionToCellRange(focusContext.Position);
                //[email protected]: To support freezePanes enahancement: Only if the cell is visible exclude it. It can be hidden under a fixedrow\column
                if (rectToDraw.IntersectsWith(focusRect) && (isFocusCellVisible || rng.Contains(cellRange)))
                {
                    regionToDraw.Exclude(focusRect);
                }

                e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);

                var partType = GetBorderType(e.Grid, rng);

                //Draw the border only if there isn't a editing cell
                // and is the range that contains the focus or there is a single range
                if ((rng.Contains(mSelection.ActivePosition) || region.Count == 1) && partType != BorderPartType.None)
                {
                    //if (!focusContext.IsEditing())
                    //[email protected]: the border should be drawn even when editing,

                    mSelection.Border.Draw(e.GraphicsCache, rectToDraw, partType);
                }
            }

            //[email protected]: To support freezePanes enahancement: Only if the cell is visible exclude it. It can be hidden under a fixedrow\column
            if (isFocusCellVisible)
            //Draw Focus
            {
                System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
                e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
            }
        }
        public override void Draw(RangePaintEventArgs e)
        {
            RangeRegion region = mSelection.GetSelectionRegion();

            if (region.IsEmpty())
            {
                return;
            }

            // get visible range for scrollable area
            Range visibleScrollabeRange = mSelection.Grid.RangeAtAreaExpanded(CellPositionType.Scrollable);


            System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);

            CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
            // get focus rectangle
            // clipped to visible range
            Range focusClippedRange = visibleScrollabeRange.Intersect(new Range(mSelection.ActivePosition, mSelection.ActivePosition));

            System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(focusClippedRange.Start);

            //Draw each selection range
            foreach (Range rangeToLoop in region)
            {
                // intersect given range with visible range
                // this way we ensure we don't loop through thousands
                // of rows to calculate rectToDraw
                Range rng = visibleScrollabeRange.Intersect(rangeToLoop);


                System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
                if (rectToDraw == System.Drawing.Rectangle.Empty)
                {
                    continue;
                }

                System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);

                if (rectToDraw.IntersectsWith(focusRect))
                {
                    regionToDraw.Exclude(focusRect);
                }

                e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);

                //Draw the border only if there isn't a editing cell
                // and is the range that contains the focus or there is a single range
                if (rng.Contains(mSelection.ActivePosition) || region.Count == 1)
                {
                    if (focusContext.IsEditing() == false)
                    {
                        mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
                    }
                }
            }

            //Draw Focus
            System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
            e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
        }
Exemple #10
0
 public abstract void Draw(RangePaintEventArgs e);
		public override void Draw(RangePaintEventArgs e)
		{
			RangeRegion region = mSelection.GetSelectionRegion();

			if (region.IsEmpty())
				return;

			// get visible range for scrollable area
            // AlanP: June 2014.  Changed the call from RangeAtAreaExpanded to RangeAtArea to fix a bug that occurred on Partner/Find screen
            // The grid on this screen has 3 fixed columns on the left but the highlight was always applied to the cell 'behind' the last fixed column
            //   as well as the rest of the row.  This is because of getting the 'expanded' range.
            // To be honest I don't understand what the expanded range is for.  The comment for it is not helpful (to me anyway).
            // It may be something to do with drawing the focus cell?  If we see a problem later we could revies this code
            //Range visibleScrollabeRange = mSelection.Grid.RangeAtAreaExpanded(CellPositionType.Scrollable);
            Range visibleScrollableRange = mSelection.Grid.RangeAtArea(CellPositionType.Scrollable);
			
			System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);

            // In OP we would like to have the rows of fixed columns highlighted as well - this seems non-standard
            // This code is the same as is used in the standard code below, but for the FixedLeft Range
            Range visibleFixedLeftRange = mSelection.Grid.RangeAtArea(CellPositionType.FixedLeft);
            foreach (Range rangeToLoop in region)
            {
                Range rng = visibleFixedLeftRange.Intersect(rangeToLoop);
                System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
                if (rectToDraw == System.Drawing.Rectangle.Empty)
                    continue;

                System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);
                e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);
            }

			// Deal with the focus rectangle...  The original grid code does not seem to support the focus being on a fixed column, which seems like a bug
            //  but does not affect OpenPetra
            CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
			// get focus rectangle
			// clipped to visible range
            Range focusClippedRange = visibleScrollableRange.Intersect(new Range(mSelection.ActivePosition, mSelection.ActivePosition));
			System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(focusClippedRange.Start);

			//Draw each selection range
			foreach (Range rangeToLoop in region)
			{
				// intersect given range with visible range
				// this way we ensure we don't loop through thousands
				// of rows to calculate rectToDraw
                Range rng = visibleScrollableRange.Intersect(rangeToLoop);

				System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
				if (rectToDraw == System.Drawing.Rectangle.Empty)
					continue;

				System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);

				if (rectToDraw.IntersectsWith(focusRect))
					regionToDraw.Exclude(focusRect);

				e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);

				//Draw the border only if there isn't a editing cell
				// and is the range that contains the focus or there is a single range
				if (rng.Contains(mSelection.ActivePosition) || region.Count == 1)
				{
					if (focusContext.IsEditing() == false)
						mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
				}
			}

			//Draw Focus
			System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
			e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
		}