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


C# Drawing.Pen类代码示例

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


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


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