当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.ResetClip方法代码示例

本文整理汇总了C#中System.Drawing.Graphics.ResetClip方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.ResetClip方法的具体用法?C# Graphics.ResetClip怎么用?C# Graphics.ResetClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Graphics的用法示例。


在下文中一共展示了Graphics.ResetClip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        protected override void Draw(Graphics g)
        {
            if (points.Count > 2)
            {
                g.SmoothingMode = SmoothingMode.HighQuality;

                borderDotPen.DashOffset = (float)timer.Elapsed.TotalSeconds * 10;
                borderDotPen2.DashOffset = 5 + (float)timer.Elapsed.TotalSeconds * 10;

                using (Region region = new Region(regionFillPath))
                {
                    g.Clip = region;
                    g.FillRectangle(lightBackgroundBrush, ScreenRectangle0Based);
                    g.ResetClip();
                }

                g.DrawPath(borderDotPen, regionFillPath);
                g.DrawPath(borderDotPen2, regionFillPath);
                g.DrawLine(borderDotPen, points[points.Count - 1], points[0]);
                g.DrawLine(borderDotPen2, points[points.Count - 1], points[0]);
                g.DrawRectangleProper(borderPen, currentArea);
            }

            base.Draw(g);
        }
开发者ID:TreeSeed,项目名称:ShareX,代码行数:25,代码来源:FreeHandRegion.cs

示例2: Draw

        protected override void Draw(Graphics g)
        {
            if (points.Count > 2)
            {
                g.SmoothingMode = SmoothingMode.HighQuality;

                if (Config.UseDimming)
                {
                    using (Region region = new Region(regionFillPath))
                    {
                        g.Clip = region;
                        g.FillRectangle(lightBackgroundBrush, ScreenRectangle0Based);
                        g.ResetClip();
                    }
                }

                g.DrawPath(borderPen, regionFillPath);
                g.DrawPath(borderDotPen, regionFillPath);
                g.DrawLine(borderPen, points[points.Count - 1], points[0]);
                g.DrawLine(borderDotPen, points[points.Count - 1], points[0]);
                g.DrawRectangleProper(borderPen, currentArea);
            }

            base.Draw(g);
        }
开发者ID:andre-d,项目名称:ShareXYZ,代码行数:25,代码来源:FreeHandRegion.cs

示例3: DrawImage

        public static void DrawImage(Graphics g, Image image, ImageLayoutMode layoutMode, Rectangle rect)
        {
            // Graphics g = Graphics.FromHwnd(IntPtr.Zero);

            if (layoutMode == ImageLayoutMode.None)
            {
                Rectangle tempRect = new Rectangle(rect.X, rect.Y, image.Width, image.Height);
                g.SetClip(rect);
                g.DrawImage(image, tempRect);
                g.ResetClip();
            }
            else if (layoutMode == ImageLayoutMode.Stretch)
            {
                g.DrawImage(image, rect);
            }
            else if (layoutMode == ImageLayoutMode.FitToWidth)
            {
                g.SetClip(rect);
                Size newSize = new Size(rect.Width, rect.Width * image.Height / image.Width);
                g.DrawImage(image, new Rectangle(rect.Location, newSize));
                g.ResetClip();
            }
            else if (layoutMode == ImageLayoutMode.FitToHeight)
            {
                g.SetClip(rect);
                Size newSize = new Size(rect.Height * image.Width / image.Height, rect.Height);
                g.DrawImage(image, new Rectangle(rect.Location, newSize));
                g.ResetClip();
            }
        }
开发者ID:powernick,项目名称:CodeLib,代码行数:30,代码来源:DrawImageLayout.cs

示例4: Draw

        protected override void Draw(Graphics g)
        {
            g.SmoothingMode = SmoothingMode.HighQuality;

            regionFillPath = new GraphicsPath();

            for (int i = 0; i < nodes.Count - 1; i++)
            {
                regionFillPath.AddLine(nodes[i].Position, nodes[i + 1].Position);
            }

            if (nodes.Count > 2)
            {
                regionFillPath.CloseFigure();

                using (Region region = new Region(regionFillPath))
                {
                    g.Clip = region;
                    g.FillRectangle(lightBackgroundBrush, ScreenRectangle0Based);
                    g.ResetClip();
                }

                g.DrawRectangleProper(borderPen, currentArea);
            }

            if (nodes.Count > 1)
            {
                g.DrawPath(borderPen, regionFillPath);
                g.DrawPath(borderDotPen, regionFillPath);
            }

            base.Draw(g);
        }
开发者ID:Edison6351,项目名称:ShareX,代码行数:33,代码来源:PolygonRegion.cs

示例5: Draw

        protected override void Draw(Graphics g)
        {
            regionFillPath = new GraphicsPath();

            for (int i = 0; i < nodes.Count - 1; i++)
            {
                regionFillPath.AddLine(nodes[i].Position, nodes[i + 1].Position);
            }

            if (nodes.Count > 2)
            {
                regionFillPath.CloseFigure();

                using (Region region = new Region(regionFillPath))
                {
                    g.ExcludeClip(region);
                    g.FillRectangle(shadowBrush, 0, 0, Width, Height);
                    g.ResetClip();
                }

                g.DrawRectangleProper(borderPen, currentArea);
            }
            else
            {
                g.FillRectangle(shadowBrush, 0, 0, Width, Height);
            }

            if (nodes.Count > 1)
            {
                g.DrawPath(borderPen, regionFillPath);
            }

            base.Draw(g);
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:34,代码来源:PolygonRegion.cs

示例6: Render

        /// <summary>
        /// Renders the key in the specified surface.
        /// </summary>
        /// <param name="g">The GDI+ surface to render on.</param>
        /// <param name="scrollCount">The number of times the direction has been scrolled within the timeout.</param>
        public void Render(Graphics g, int scrollCount)
        {
            var pressed = scrollCount > 0;
            var style = GlobalSettings.CurrentStyle.TryGetElementStyle<KeyStyle>(this.Id)
                            ?? GlobalSettings.CurrentStyle.DefaultKeyStyle;
            var defaultStyle = GlobalSettings.CurrentStyle.DefaultKeyStyle;
            var subStyle = pressed ? style?.Pressed ?? defaultStyle.Pressed : style?.Loose ?? defaultStyle.Loose;

            var text = pressed ? scrollCount.ToString() : this.Text;
            var txtSize = g.MeasureString(text, subStyle.Font);
            var txtPoint = new TPoint(
                this.TextPosition.X - (int)(txtSize.Width / 2),
                this.TextPosition.Y - (int)(txtSize.Height / 2));

            // Draw the background
            var backgroundBrush = this.GetBackgroundBrush(subStyle, pressed);
            g.FillPolygon(backgroundBrush, this.Boundaries.ConvertAll<Point>(x => x).ToArray());

            // Draw the text
            g.SetClip(this.GetBoundingBox());
            g.DrawString(text, subStyle.Font, new SolidBrush(subStyle.Text), (Point)txtPoint);
            g.ResetClip();

            // Draw the outline.
            if (subStyle.ShowOutline)
                g.DrawPolygon(new Pen(subStyle.Outline, 1), this.Boundaries.ConvertAll<Point>(x => x).ToArray());
        }
开发者ID:ThoNohT,项目名称:NohBoard,代码行数:32,代码来源:MouseScrollDefinition.cs

示例7: DrawPointerDown

		private void DrawPointerDown(Graphics g)
		{
			Point[] points = new Point[] { new Point(ThumbBounds.Left + (ThumbBounds.Width / 2), ThumbBounds.Bottom - 1), new Point(ThumbBounds.Left, (ThumbBounds.Bottom - (ThumbBounds.Width / 2)) - 1), ThumbBounds.Location, new Point(ThumbBounds.Right - 1, ThumbBounds.Top), new Point(ThumbBounds.Right - 1, (ThumbBounds.Bottom - (ThumbBounds.Width / 2)) - 1), new Point(ThumbBounds.Left + (ThumbBounds.Width / 2), ThumbBounds.Bottom - 1) };
			GraphicsPath path = new GraphicsPath();
			path.AddLines(points);
			Region region = new Region(path);
			g.Clip = region;

			if (ThumbState == 3 || !base.Enabled)
				ControlPaint.DrawButton(g, ThumbBounds, ButtonState.All);
			else
				g.Clear(SystemColors.Control);

			g.ResetClip();
			region.Dispose();
			path.Dispose();
			Point[] pointArray2 = new Point[] { points[0], points[1], points[2], points[3] };
			g.DrawLines(SystemPens.ControlLightLight, pointArray2);
			pointArray2 = new Point[] { points[3], points[4], points[5] };
			g.DrawLines(SystemPens.ControlDarkDark, pointArray2);
			points[0].Offset(0, -1);
			points[1].Offset(1, 0);
			points[2].Offset(1, 1);
			points[3].Offset(-1, 1);
			points[4].Offset(-1, 0);
			points[5] = points[0];
			pointArray2 = new Point[] { points[0], points[1], points[2], points[3] };
			g.DrawLines(SystemPens.ControlLight, pointArray2);
			pointArray2 = new Point[] { points[3], points[4], points[5] };
			g.DrawLines(SystemPens.ControlDark, pointArray2);
		}
开发者ID:JamesH001,项目名称:SX1231,代码行数:31,代码来源:FusionTrackBar.cs

示例8: DrawHover

        public void DrawHover(Graphics graphics, Rectangle bounds, double hoverDone)
        {
            using (Bitmap b = new Bitmap(mBackgroundImage, bounds.Size))
                graphics.DrawImage(b, bounds.Location);

            var path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddPie(bounds.X, bounds.Y, bounds.Width, bounds.Height, -90f, (float) (360 * hoverDone));
            graphics.SetClip(path);
            using (Bitmap b = new Bitmap(mImage, bounds.Size))
                graphics.DrawImage(b, bounds.Location);
            graphics.ResetClip();
        }
开发者ID:JohnMcCaffery,项目名称:ChimeraClean,代码行数:12,代码来源:ImageRenderer.cs

示例9: Paint

    public static void Paint(
        Graphics g,
        RectangleF area,
        float horizontalSpacing,
        float verticalSpacing,
        float penWidth) {
      //ControlPaint.DrawGrid(
      //    g,
      //    area,
      //    new Size(20, 20),
      //    Color.Wheat);

      //g.SmoothingMode = SmoothingMode.HighQuality;
      //g.CompositingQuality = CompositingQuality.HighQuality;
      //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
      g.SetClip(area);
      float sideLength = Math.Min(area.Width, area.Height);
      float horizSpacing = sideLength / horizontalSpacing;
      float vertSpacing = sideLength / verticalSpacing;

      Pen majorPen = new Pen(Color.DarkGray);
      majorPen.Width = penWidth;
      majorPen.DashStyle = DashStyle.Dot;

      float top = area.Top;  // The top y coord.
      float bottom = area.Bottom;  // The bottom y coord.
      float left = area.Left;  // The left y coord.
      float right = area.Right;  // The right y coord.
      PointF p1;  // The starting point for the grid line.
      PointF p2;  // The end point for the grid line.

      // Draw the horizontal lines, starting at the top.
      for (float i = top; i <= bottom; i += horizontalSpacing) {
        p1 = new PointF(left, i);
        p2 = new PointF(right, i);
        g.DrawLine(majorPen, p1, p2);
      }

      // Draw the major vertical lines, starting at the left edge.
      for (float i = left; i <= right; i += verticalSpacing) {
        p1 = new PointF(i, top);
        p2 = new PointF(i, bottom);
        g.DrawLine(majorPen, p1, p2);
      }
      g.ResetClip();
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:46,代码来源:Grid.cs

示例10: DrawSamples

        private void DrawSamples(Panel panel, Graphics g, float[] data, int dataCount, float minValue, float maxValue, int step = 1)
        {
            g.ResetClip();

            float dist = maxValue - minValue;
            float dx = (float) panel.ClientRectangle.Width / (float) dataCount;
            float x = 0.0f;

            Func<int, float> fGetData = (int index) => {
                return (1.0f - ((data[index] - minValue) / dist)) * panel.ClientRectangle.Height;
            };

            g.DrawRectangle(Pens.Black, panel.ClientRectangle);
            for (int i = step; i < dataCount; i += step) {
                g.DrawLine(Pens.Red, x, fGetData(i-step), x + dx, fGetData(i));
                x += dx * step;
            }
        }
开发者ID:marcin-mini-pw,项目名称:nnetwork_mini_pw,代码行数:18,代码来源:Form1.cs

示例11: DoGrid

        public static void DoGrid(this WidgetMidiList widget, FloatRect grid, Graphics g)
        {
            var gs = g.Save();
              using (g.Clip = new Region(grid))
              {
            using (var p0 = new Pen(Color.Black)) foreach (var i in widget.GetHLines(4))
              g.DrawLines(p0, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });

            using (var p1 = new Pen(Gray130)) foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 2))))
              g.DrawLines(p1, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });

            using (var p2 = new Pen(White)) foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 3))))
              g.DrawLines(p2, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });

            g.ResetClip();
              }
              g.Restore(gs);
        }
开发者ID:tfwio,项目名称:modest-smf-vstnet,代码行数:18,代码来源:WidgetMidiList.Painter.cs

示例12: DrawIcons

 public static Rectangle DrawIcons(Graphics gr, Rectangle aTextRect, CustomAppointment anAppointment, ImageList anAppIcons)
 {
     if ((anAppIcons != null) && (anAppointment.IconIndexes != null))
     {
         int length = anAppointment.IconIndexes.Length;
         int width = anAppIcons.ImageSize.Width;
         int num3 = aTextRect.Width / 3;
         if ((aTextRect.Width / 2) > width)
         {
             int x = (aTextRect.Right - 1) - width;
             int y = aTextRect.Y + 1;
             Region clip = gr.Clip;
             Region region2 = new Region(aTextRect);
             region2.Intersect(clip);
             gr.Clip = region2;
             for (int i = length - 1; i >= 0; i--)
             {
                 using (Image image = anAppIcons.Images[anAppointment.IconIndexes[i]])
                 {
                     Rectangle rect = new Rectangle(x, y, width, width);
                     DrawSingleIcon(gr, rect, image);
                 }
                 x -= width;
                 if (num3 >= (x - aTextRect.X))
                 {
                     aTextRect.Width -= width * (length - i);
                     return aTextRect;
                 }
             }
             gr.ResetClip();
             region2.Dispose();
             region2 = null;
             if (clip != null)
             {
                 gr.Clip = clip;
             }
             aTextRect.Width -= width * length;
         }
     }
     return aTextRect;
 }
开发者ID:north0808,项目名称:haina,代码行数:41,代码来源:Office11Renderer.cs

示例13: DoNoteIds

 public static void DoNoteIds(this WidgetMidiList widget, FloatRect grid, Graphics g)
 {
     var gs = g.Save();
       using (g.Clip = new Region(grid))
       {
     foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 2))))
     {
       var r2=new FloatRect(i.XO-16,grid.Top,32,24);
       g.FillEllipse(Brushes.Black,r2);
       g.DrawText((i.Index / 4).ToString(),Color.White,widget.Font,r2);
     }
     foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 3))))
     {
       var r2=new FloatRect(i.XO-16,grid.Top+32,32,24);
       g.FillEllipse(Brushes.Black,r2);
       g.DrawText((i.Index / 64).ToString(),Color.White,widget.Font,r2);
     }
     g.ResetClip();
       }
       g.Restore(gs);
 }
开发者ID:tfwio,项目名称:modest-smf-vstnet,代码行数:21,代码来源:WidgetMidiList.Painter.cs

示例14: Draw

        protected override void Draw(Graphics g)
        {
            if (points.Count > 2)
            {
                using (Region region = new Region(regionFillPath))
                {
                    g.ExcludeClip(region);
                    g.FillRectangle(shadowBrush, 0, 0, Width, Height);
                    g.ResetClip();
                }

                g.DrawPath(borderPen, regionFillPath);
                g.DrawLine(borderPen, points[0], points[points.Count - 1]);
                g.DrawRectangleProper(borderPen, currentArea);
            }
            else
            {
                g.FillRectangle(shadowBrush, 0, 0, Width, Height);
            }

            base.Draw(g);
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:22,代码来源:FreeHandRegion.cs

示例15: DrawColumnHeaders

        private void DrawColumnHeaders(Graphics gr)
        {
            PerformanceAnalyzer.Start("DrawColumnHeaders");
            ReorderColumnState reorder = Input as ReorderColumnState;
            int x = 0;
            TreeColumn.DrawBackground(gr, new Rectangle(0, 0, ClientRectangle.Width + 2, ColumnHeaderHeight - 1), false, false);
            gr.TranslateTransform(-OffsetX, 0);
            foreach (TreeColumn c in Columns)
            {
                if (c.IsVisible)
                {
                    if (x >= OffsetX && x - OffsetX < this.Bounds.Width)// skip invisible columns
                    {
                        Rectangle rect = new Rectangle(x, 0, c.Width, ColumnHeaderHeight - 1);
                        gr.SetClip(rect);
                        bool pressed = ((Input is ClickColumnState || reorder != null) && ((Input as ColumnState).Column == c));
                        c.Draw(gr, rect, ColumnFont, pressed, _hotColumn == c);
                        gr.ResetClip();

                        if (reorder != null && reorder.DropColumn == c)
                            TreeColumn.DrawDropMark(gr, rect);
                    }
                    x += c.Width;
                }
            }

            if (reorder != null)
            {
                if (reorder.DropColumn == null)
                    TreeColumn.DrawDropMark(gr, new Rectangle(x, 0, 0, ColumnHeaderHeight));
                gr.DrawImage(reorder.GhostImage, new Point(reorder.Location.X +  + reorder.DragOffset, reorder.Location.Y));
            }
            PerformanceAnalyzer.Finish("DrawColumnHeaders");
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:34,代码来源:TreeViewAdv.Draw.cs


注:本文中的System.Drawing.Graphics.ResetClip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。