System.Drawing.Graphics.IntersectClip C# (CSharp) Method

IntersectClip() public method

public IntersectClip ( Rectangle rect ) : void
rect Rectangle
return void
        public void IntersectClip(Rectangle rect)
        {
            SetClip ((RectangleF)rect, CombineMode.Intersect);
        }

Same methods

Graphics::IntersectClip ( RectangleF rect ) : void
Graphics::IntersectClip ( Region region ) : void

Usage Example

Example #1
0
        private void DrawVerticalComponent(int index, Graphics g, LiveSplitState state, float width, float height, Region clipRegion)
        {
            var component = VisibleComponents.ElementAt(index);
            var topPadding = Math.Min(GetPaddingAbove(index), component.PaddingTop) / 2f;
            var bottomPadding = Math.Min(GetPaddingBelow(index), component.PaddingBottom) / 2f;
            g.IntersectClip(new RectangleF(0, topPadding, width, component.VerticalHeight - topPadding - bottomPadding));

            var scale = g.Transform.Elements.First();
            var separatorOffset = component.VerticalHeight * scale < 3 ? 1 : 0;

            if (clipRegion.IsVisible(new RectangleF(
                g.Transform.OffsetX,
                -separatorOffset + g.Transform.OffsetY - topPadding * scale,
                width,
                separatorOffset * 2f + scale * (component.VerticalHeight + bottomPadding))))
                component.DrawVertical(g, state, width, clipRegion);
            g.TranslateTransform(0.0f, component.VerticalHeight - bottomPadding * 2f);
        }
All Usage Examples Of System.Drawing.Graphics::IntersectClip