• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Drawing.Pen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Eto.Drawing.Pen的典型用法代码示例。如果您正苦于以下问题:C# Pen类的具体用法?C# Pen怎么用?C# Pen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Pen类属于Eto.Drawing命名空间,在下文中一共展示了Pen类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DrawingRectangleAdorner

        public DrawingRectangleAdorner(PictureBox pictureBox)
        {
            pictureBox.MouseDown += PictureBox_MouseDown;
            pictureBox.MouseMove += PictureBox_MouseMove;
            pictureBox.MouseUp += PictureBox_MouseUp;
            pictureBox.Paint += PictureBox_Paint;

            control = pictureBox;

            rect = RectangleF.Empty;

            Pen = new Pen(Colors.Green, 5);
        }
开发者ID:gitter-badger,项目名称:dot-imaging,代码行数:13,代码来源:DrawingRectangleAdorner.cs


示例2: GetPen

		static Pen GetPen (Generator generator, Color color, float thickness = 1f, DashStyle dashStyle = null)
		{
			var cache = generator.Cache<PenKey, Pen> (cacheKey);
			Pen pen;
			lock (cache) {
				var key = new PenKey (color.ToArgb (), thickness, dashStyle);
				if (!cache.TryGetValue (key, out pen)) {
					pen = new Pen (color, thickness, generator);
					if (dashStyle != null) pen.DashStyle = dashStyle;
					cache.Add (key, pen);
				}
			}
			return pen;
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:14,代码来源:Pens.cs


示例3: DrawingPenAdorner

        public DrawingPenAdorner(PictureBox pictureBox)
        {
            pictureBox.MouseDown += PictureBox_MouseDown;
            pictureBox.MouseMove += PictureBox_MouseMove;
            pictureBox.MouseUp += PictureBox_MouseUp;
            pictureBox.Paint += PictureBox_Paint;

            control = pictureBox;

            Paths = new List<Path>();

            Pen = new Pen(Colors.Green, 10);
            Pen.LineCap = PenLineCap.Round;
            Pen.LineJoin = PenLineJoin.Round;
        }
开发者ID:gitter-badger,项目名称:dot-imaging,代码行数:15,代码来源:DrawingPenAdorner.cs


示例4: SetMiterLimit

		public void SetMiterLimit(Pen widget, float miterLimit)
		{
			throw new NotImplementedException();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例5: SetLineCap

		public void SetLineCap(Pen widget, PenLineCap lineCap)
		{
			throw new NotImplementedException();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例6: SetLineJoin

		public void SetLineJoin(Pen widget, PenLineJoin lineJoin)
		{
			throw new NotImplementedException();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例7: SetThickness

		public void SetThickness(Pen widget, float thickness)
		{
			throw new NotImplementedException();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例8: SetColor

		public void SetColor(Pen widget, Color color)
		{
			throw new NotImplementedException();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例9: ToPen

        /// <summary>
        /// 
        /// </summary>
        /// <param name="style"></param>
        /// <param name="scale"></param>
        /// <returns></returns>
        private Pen ToPen(BaseStyle style, Func<double, float> scale)
        {
            var pen = new Pen(
                ToColor(style.Stroke),
                scale(style.Thickness / _state.Zoom));

            switch (style.LineCap)
            {
                case Test2d.LineCap.Flat:
                    pen.LineCap = PenLineCap.Butt;
                    break;
                case Test2d.LineCap.Square:
                    pen.LineCap = PenLineCap.Square;
                    break;
                case Test2d.LineCap.Round:
                    pen.LineCap = PenLineCap.Round;
                    break;
            }
            if (style.Dashes != null)
            {
                pen.DashStyle = new DashStyle(
                    (float)style.DashOffset,
                    style.Dashes.Select(x => (float)x).ToArray());
            }
            return pen;
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:32,代码来源:EtoRenderer.cs


示例10: GetLineJoin

		public PenLineJoin GetLineJoin(Pen widget)
		{
			return widget.ToAndroid().StrokeJoin.ToEto();
		}
开发者ID:mhusen,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例11: SetThickness

		public void SetThickness(Pen widget, float thickness)
		{
			widget.ToAndroid().StrokeWidth = thickness;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例12: GetThickness

		public float GetThickness(Pen widget)
		{
			return widget.ToAndroid().StrokeWidth;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例13: SetColor

		public void SetColor(Pen widget, Color color)
		{
			widget.ToAndroid().Color = color.ToAndroid();
		}
开发者ID:mhusen,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例14: GetColor

		public Color GetColor(Pen widget)
		{
			return widget.ToAndroid().Color.ToEto();
		}
开发者ID:mhusen,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例15: Draw

		void Draw(Graphics g, Action<Pen> action)
		{
			var path = new GraphicsPath();
			path.AddLines(new PointF(0, 0), new PointF(100, 40), new PointF(0, 30), new PointF(50, 70));

			for (int i = 0; i < 4; i++)
			{
				float thickness = 1f + i * PenThickness;
				var pen = new Pen(Colors.Black, thickness);
				pen.LineCap = this.LineCap;
				pen.LineJoin = this.LineJoin;
				pen.DashStyle = this.DashStyle;
				if (action != null)
					action(pen);
				var y = i * 20;
				g.DrawLine(pen, 10, y, 110, y);
				
				y = 80 + i * 50;
				g.DrawRectangle(pen, 10, y, 100, 30);

				y = i * 70;
				g.DrawArc(pen, 140, y, 100, 80, 160, 160);
				
				y = i * 70;
				g.DrawEllipse(pen, 260, y, 100, 50);
				
				g.SaveTransform();
				y = i * 70;
				g.TranslateTransform(400, y);
				g.DrawPath(pen, path);
				g.RestoreTransform();
			}
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:33,代码来源:PenSection.cs


示例16: DrawRectangleInternal

        /// <summary>
        /// 
        /// </summary>
        /// <param name="gfx"></param>
        /// <param name="brush"></param>
        /// <param name="pen"></param>
        /// <param name="isStroked"></param>
        /// <param name="isFilled"></param>
        /// <param name="rect"></param>
        private static void DrawRectangleInternal(
            Graphics gfx,
            Brush brush,
            Pen pen,
            bool isStroked,
            bool isFilled,
            ref Rect2 rect)
        {
            if (isFilled)
            {
                gfx.FillRectangle(
                    brush,
                    (float)rect.X,
                    (float)rect.Y,
                    (float)rect.Width,
                    (float)rect.Height);
            }

            if (isStroked)
            {
                gfx.DrawRectangle(
                    pen,
                    (float)rect.X,
                    (float)rect.Y,
                    (float)rect.Width,
                    (float)rect.Height);
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:37,代码来源:EtoRenderer.cs


示例17: DrawGridInternal

        /// <summary>
        /// 
        /// </summary>
        /// <param name="gfx"></param>
        /// <param name="stroke"></param>
        /// <param name="rect"></param>
        /// <param name="offsetX"></param>
        /// <param name="offsetY"></param>
        /// <param name="cellWidth"></param>
        /// <param name="cellHeight"></param>
        /// <param name="isStroked"></param>
        private void DrawGridInternal(
            Graphics gfx,
            Pen stroke,
            ref Rect2 rect,
            double offsetX, double offsetY,
            double cellWidth, double cellHeight,
            bool isStroked)
        {
            double ox = rect.X;
            double oy = rect.Y;
            double sx = ox + offsetX;
            double sy = oy + offsetY;
            double ex = ox + rect.Width;
            double ey = oy + rect.Height;

            for (double x = sx; x < ex; x += cellWidth)
            {
                var p0 = new PointF(
                    _scaleToPage(x),
                    _scaleToPage(oy));
                var p1 = new PointF(
                    _scaleToPage(x),
                    _scaleToPage(ey));
                DrawLineInternal(gfx, stroke, isStroked, ref p0, ref p1);
            }

            for (double y = sy; y < ey; y += cellHeight)
            {
                var p0 = new PointF(
                    _scaleToPage(ox),
                    _scaleToPage(y));
                var p1 = new PointF(
                    _scaleToPage(ex),
                    _scaleToPage(y));
                DrawLineInternal(gfx, stroke, isStroked, ref p0, ref p1);
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:48,代码来源:EtoRenderer.cs


示例18: SetLineJoin

		public void SetLineJoin(Pen widget, PenLineJoin lineJoin)
		{
			widget.ToAndroid().StrokeJoin = lineJoin.ToAndroid();
		}
开发者ID:mhusen,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例19: GetColor

		public Color GetColor(Pen widget)
		{
			throw new NotImplementedException();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs


示例20: GetLineCap

		public PenLineCap GetLineCap(Pen widget)
		{
			return widget.ToAndroid().StrokeCap.ToEto();
		}
开发者ID:mhusen,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Drawing.PointF类代码示例发布时间:2022-05-26
下一篇:
C# Tools.NameObjectList类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap