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


C# Context.SetColor方法代码示例

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


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

示例1: OnDraw

        protected override void OnDraw(Context ctx, Rectangle dirtyRect)
        {
            // Line arround
            ctx.SetColor(Colors.DarkGray);

            // Drive line arround
            ctx.Rectangle(Bounds);
            ctx.Fill();

            ctx.SetColor(Colors.Gray);
            ctx.Rectangle(Bounds.Inflate(-margin, -margin));
            ctx.Fill();

            // Draw image
            ctx.DrawImage(Image.FromResource(Logo), 5.0, 5.0);

            // Draw text
            ctx.SetColor(Colors.White);
            TextLayout _layout = new TextLayout();
            _layout.Font = Font.WithSize(22);
            _layout.Text = Label;
            _layout.SetFontWeight(FontWeight.Bold, 0, Label.Length);

            // Cocoa layouts
            ctx.DrawTextLayout(_layout, 45, ((Config.Cocoa || Config.Gtk) ? 5 : 2));
        }
开发者ID:KIV-ASWI-PL2014,项目名称:Director,代码行数:26,代码来源:InfoBox.cs

示例2: OnDraw

 protected override void OnDraw(Context ctx)
 {
     ctx.SetLineWidth (5);
     ctx.SetColor (new Color (1.0f, 0f, 0.5f));
     ctx.Rectangle (5, 5, 200, 100);
     ctx.FillPreserve ();
     ctx.SetColor (new Color (0f, 0f, 1f));
     ctx.Stroke ();
 }
开发者ID:sandeep-datta,项目名称:xwt,代码行数:9,代码来源:NotebookSample.cs

示例3: PatternsAndImages

		public void PatternsAndImages (Context ctx, double x, double y)
		{
			ctx.Save ();
			ctx.Translate (x, y);
			
			ctx.SetColor (Colors.Black);
			// Dashed lines

			ctx.SetLineWidth (2);
			ctx.SetLineDash (15, 10, 10, 5, 5);
			ctx.Rectangle (10, 10, 100, 100);
			ctx.Stroke ();
			ctx.SetLineDash (0);
			
			// Image
			var arcColor = new Color (1, 0, 1);
			ImageBuilder ib = new ImageBuilder (30, 30);
			ib.Context.Arc (15, 15, 15, 0, 360);
			ib.Context.SetColor (arcColor);
			ib.Context.Fill ();
			ib.Context.SetColor (Colors.DarkKhaki);
			ib.Context.Rectangle (0, 0, 5, 5);
			ib.Context.Fill ();
			var img = ib.ToVectorImage ();
			ctx.DrawImage (img, 0, 0);
			ctx.DrawImage (img, 0, 50, 50, 10);
			
			ctx.Arc (100, 100, 15, 0, 360);
			arcColor.Alpha = 0.4;
			ctx.SetColor (arcColor);
			ctx.Fill ();
			
			// ImagePattern
			
			ctx.Save ();
			
			ctx.Translate (x + 130, y);
			ctx.Pattern = new ImagePattern (img);
			ctx.Rectangle (0, 0, 100, 100);
			ctx.Fill ();
			ctx.Restore ();
			
			ctx.Restore ();
			
			// Setting pixels
			
			ctx.SetLineWidth (1);
			for (int i=0; i<50;i++) {
				for (var j=0; j<50;j++) {
					Color c = Color.FromHsl (0.5, (double)i / 50d, (double)j / 50d);
					ctx.Rectangle (i, j, 1, 1);
					ctx.SetColor (c);
					ctx.Fill ();
				}
			}
		}	
开发者ID:m13253,项目名称:xwt,代码行数:56,代码来源:DrawingPatternsAndImages.cs

示例4: OnDraw

 protected override void OnDraw(Context ctx, Rectangle dirtyRect)
 {
     if (Window?.DrawRedDebugOutline ?? false)
     {
         ctx.SetColor(Colors.Blue);
         ctx.Rectangle(0, 0, Bounds.Width, Bounds.Height);
         ctx.Stroke();
         ctx.SetColor(Colors.Black);
     }
 }
开发者ID:fourtf,项目名称:4Plug,代码行数:10,代码来源:EmptyControl.cs

示例5: OnDraw

 protected override void OnDraw(Context ctx, Rectangle dirtyRect)
 {
     ctx.SetColor(new Color(0.5, 0.5, 0.5));
     ctx.Rectangle(Bounds);
     ctx.Fill();
     ctx.SetColor(new Color(0.8, 0.8, 0.8));
     ctx.Rectangle(Bounds.Inflate(-margin, -margin));
     ctx.Fill();
     ctx.SetColor(highlight ? Color.BlendWith(Xwt.Drawing.Colors.White, 0.5) : Color);
     ctx.Rectangle(Bounds.Width / 2 - coreSize.Width / 2, Bounds.Height / 2 - coreSize.Height / 2, coreSize.Width, coreSize.Height);
     ctx.Fill();
 }
开发者ID:sergueik,项目名称:xwt_swd,代码行数:12,代码来源:SimpleBox.cs

示例6: InitBlank

		protected void InitBlank (int width = 50, int height = 50)
		{
			if (builder != null)
				builder.Dispose ();

			builder = new ImageBuilder (width, height);
			context = builder.Context;
			context.Rectangle (0, 0, width, height);
			context.SetColor (Colors.White);
			context.Fill ();
			context.SetColor (Colors.Black);
			context.SetLineWidth (1);
		}
开发者ID:m13253,项目名称:xwt,代码行数:13,代码来源:DrawingTestsBase.cs

示例7: OnDraw

        protected override void OnDraw(Context ctx, Rectangle cellArea)
        {
            var pct = GetValue (ValueField);
            var size = (cellArea.Width * pct) / 100f;
            cellArea.Width = (int) size;

            ctx.SetLineWidth (1);
            ctx.Rectangle (cellArea.Inflate (-0.5, -0.5));
            ctx.SetColor (Colors.LightBlue);
            ctx.FillPreserve ();
            ctx.SetColor (Colors.Gray);
            ctx.Stroke ();
        }
开发者ID:nbros,项目名称:xwt,代码行数:13,代码来源:ListView1.cs

示例8: Draw

		internal protected override void Draw (Context ctx, Rectangle area, long line, double x, double y)
		{
			ctx.Rectangle (x, y, Width, Editor.LineHeight);
			ctx.SetColor (Style.HexOffsetBg);
			ctx.Fill ();

			if (line >= 0 && line * Editor.BytesInRow < Data.Length) {
				LayoutWrapper layout = GetLayout (line);
				var sz = layout.Layout.GetSize ();
				ctx.SetColor (line != Caret.Line ? Style.HexOffset : Style.HexOffsetHighlighted);
				ctx.DrawTextLayout (layout.Layout, x + Width - sz.Width - 4, y);
				if (layout.IsUncached)
					layout.Dispose ();
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:15,代码来源:GutterMargin.cs

示例9: OnDraw

			protected override void OnDraw (Context ctx, Rectangle dirtyRect)
			{
				base.OnDraw (ctx, dirtyRect);

				ctx.Rectangle (0, 0, Size.Width, Size.Height);
				ctx.SetColor (Colors.LightGray);
				ctx.Fill ();

				ctx.SetColor (Colors.Black);
				using (var layout = new TextLayout (this))
				{
					layout.Text = text;
					ctx.DrawTextLayout (layout, new Point (0, 20));
				}
			}
开发者ID:m13253,项目名称:xwt,代码行数:15,代码来源:TextInput.cs

示例10: Curves2

        public virtual void Curves2(Context ctx, double sx, double sy)
        {
            ctx.Save ();
            ctx.Translate (sx, sy);
            ctx.SetColor (Colors.Black);

            double x = 0, y = 40;
            double x1 = y - x, y1 = x1 + y, x2 = x + y, y2 = x, x3 = y1, y3 = y;

            ctx.MoveTo (x, y);
            ctx.CurveTo (x1, y1, x2, y2, x3, y3);

            ctx.SetLineWidth (2.0);
            ctx.Stroke ();

            ctx.SetColor (new Color (1, 0.2, 0.2, 0.6));
            ctx.SetLineWidth (1.0);
            ctx.MoveTo (x, y);
            ctx.LineTo (x1, y1);
            ctx.MoveTo (x2, y2);
            ctx.LineTo (x3, y3);
            ctx.Stroke ();

            ctx.Restore ();
        }
开发者ID:RevolutionSmythe,项目名称:xwt,代码行数:25,代码来源:DrawingFigures.cs

示例11: Draw

		internal protected override void Draw (Context win, Rectangle area, long line, double x, double y)
		{
			win.Rectangle (x, y, Width, Editor.LineHeight);
			win.SetColor (Style.IconBarBg);
			win.Fill ();
			win.MoveTo (x + Width - 1, y);
			win.LineTo (x + Width - 1, y + Editor.LineHeight);
			win.SetColor (Style.IconBarSeperator);
			win.Stroke ();

			foreach (long bookmark in Data.Bookmarks) {
				if (line * Editor.BytesInRow <= bookmark && bookmark < line * Editor.BytesInRow + Editor.BytesInRow) {
					DrawBookmark (win, x, y);
					return;
				}
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:17,代码来源:IconMargin.cs

示例12: DrawBackground

 protected internal override void DrawBackground(Context cr, Xwt.Rectangle area, DocumentLine line, int lineNumber, double x, double y, double height)
 {
     cr.Save();
     cr.SetColor(Colors.LightGray);
     cr.Rectangle(x, y, Width, height + 1);
     cr.Fill();
     cr.Restore();
 }
开发者ID:cra0zy,项目名称:XwtPlus.TextEditor,代码行数:8,代码来源:LineNumberMargin.cs

示例13: OnDraw

        protected override void OnDraw(Context ctx, Rectangle dirtyRect)
        {
            base.OnDraw(ctx, dirtyRect);

            ctx.SetColor(Colors.Gray);
            ctx.SetLineWidth(1);

            ctx.RoundRectangle(0, Padding.Top / 2 - .5, Width - 4.5, Height - Padding.Bottom * 1.5, 3);
            ctx.Stroke();

            var tl = new TextLayout(this) { Text = title, Width = Width - Padding.Left - Padding.Right / 2 };

            ctx.SetColor(Colors.White);
            ctx.Rectangle(Padding.Left, 0, tl.GetSize().Width, Padding.Top);
            ctx.Fill();

            ctx.SetColor(Colors.Black);
            ctx.DrawTextLayout(tl, Padding.Left, 0);
        }
开发者ID:fourtf,项目名称:4Plug,代码行数:19,代码来源:GroupContainer.cs

示例14: OnDraw

        protected override void OnDraw(Context ctx, Rectangle dirtyRect)
        {
            base.OnDraw(ctx, dirtyRect);

            ctx.Save();
            ctx.SetColor(editor.Options.Background);
            ctx.Rectangle(dirtyRect);
            ctx.Fill();
            ctx.Restore();

            UpdateMarginXOffsets();
            RenderMargins(ctx, dirtyRect);
        }
开发者ID:cra0zy,项目名称:XwtPlus.TextEditor,代码行数:13,代码来源:TextArea.cs

示例15: OnDraw

		protected override void OnDraw (Context ctx, Rectangle bounds)
		{
			var lineWidth = bounds.Width / 32d;
			var section = ((bounds.Width / 2) - lineWidth / 2) / 3;

			ctx.SetLineWidth (lineWidth);

			ctx.SetColor (Colors.Black);
			ctx.Arc (bounds.Center.X, bounds.Center.Y, 1, 0, 360);
			ctx.Stroke ();
			
			ctx.SetColor (Colors.Red);
			ctx.Arc (bounds.Center.X, bounds.Center.Y, section, 0, 360);
			ctx.Stroke ();

			ctx.SetColor (Colors.Green);
			ctx.Arc (bounds.Center.X, bounds.Center.Y, section * 2, 0, 360);
			ctx.Stroke ();

			ctx.SetColor (Colors.Blue);
			ctx.Arc (bounds.Center.X, bounds.Center.Y, section * 3, 0, 360);
			ctx.Stroke ();
		}
开发者ID:m13253,项目名称:xwt,代码行数:23,代码来源:ImageScaling.cs


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