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


C# CGContext.FillRect方法代码示例

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


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

示例1: DrawBorders

        void DrawBorders(CGContext context, nfloat xMin, nfloat xMax, nfloat yMin, nfloat yMax, nfloat fWidth, nfloat fHeight)
        {
            if (BorderColorTop != null)
            {
                context.SetFillColor(BorderColorTop.CGColor);
                context.FillRect(new CGRect(xMin, yMin, fWidth, BorderWidth.Top));
            }

            if (BorderColorLeft != null)
            {
                context.SetFillColor(BorderColorLeft.CGColor);
                context.FillRect(new CGRect(xMin, yMin, BorderWidth.Left, fHeight));
            }

            if (BorderColorRight != null)
            {
                context.SetFillColor(BorderColorRight.CGColor);
                context.FillRect(new CGRect(xMax - BorderWidth.Right, yMin, BorderWidth.Right, fHeight));
            }

            if (BorderColorBottom != null)
            {
                context.SetFillColor(BorderColorBottom.CGColor);
                context.FillRect(new CGRect(xMin, yMax - BorderWidth.Bottom, fWidth, BorderWidth.Bottom));
            }
        }
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:26,代码来源:DrawBorder.cs

示例2: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            UIColor.White.SetFill ();
            context.FillRect (bounds);

            context.DrawLinearGradient (
                gradient,
                new PointF (bounds.Left, bounds.Top),
                new PointF (bounds.Left, bounds.Bottom),
                CGGradientDrawingOptions.DrawsAfterEndLocation
            );

            UIColor.DarkGray.SetColor ();
            view.DrawString (
                this.Label,
                new RectangleF (10, 10, bounds.Width / 2, 10),
                captionFont,
                UILineBreakMode.TailTruncation
            );

            UIColor.Black.SetColor ();
            view.DrawString (
                this.Number.ToString (),
                new RectangleF (bounds.Width / 2, 10, (bounds.Width / 2) - 10, 10),
                amountFont,
                UILineBreakMode.TailTruncation,
                UITextAlignment.Right
            );
        }
开发者ID:rajeshwarn,项目名称:GhostPractice-iPadRepo,代码行数:29,代码来源:NumberElement.cs

示例3: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            UIColor.DarkGray.SetFill();
            context.FillRect(bounds);

            UIColor.Yellow.SetColor();
            view.DrawString(_text, new RectangleF(10, 15, bounds.Width - 20, bounds.Height - 30), UIFont.BoldSystemFontOfSize(14.0f), UILineBreakMode.TailTruncation);
        }
开发者ID:unsliced,项目名称:head-race-management,代码行数:8,代码来源:TimingDetailViewController.cs

示例4: FillRect

 public static void FillRect(CGContext context, RectangleF rect, CGColor color)
 {
     context.SaveState();
     context.AddRect(rect);
     context.Clip();
     context.SetFillColor(color);
     context.FillRect(rect);
     context.RestoreState();
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:9,代码来源:CoreGraphicsHelper.cs

示例5: Draw

		public override void Draw(RectangleF bounds, CGContext context, UIView view)
		{
			UIColor.White.SetFill();
			context.FillRect(bounds);
			
			context.DrawLinearGradient(gradient, new PointF(bounds.Left, bounds.Top), new PointF(bounds.Left, bounds.Bottom), CGGradientDrawingOptions.DrawsAfterEndLocation);
			
			UIColor.DarkGray.SetColor();
			view.DrawString(Caption, new RectangleF(10, 10, bounds.Width - 20, TextHeight(bounds)), _CaptionFont, UILineBreakMode.WordWrap);
		}
开发者ID:briandonahue,项目名称:MonoTouch.MVVM,代码行数:10,代码来源:MovieElement.cs

示例6: Selected

		/*
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			base.Selected (dvc, tableView, path);
		}
		*/
		
		public override void Draw (RectangleF bounds, CGContext context, UIView view)
		{			
			UIColor.White.SetFill ();
			context.FillRect (bounds);
			
			RectangleF frame = _inviteButton.Frame;
			frame.X = view.Frame.Width - frame.Width - 10;
			_inviteButton.Frame = frame;
			view.Add(_inviteButton);
			
			if (userImage != null)
			{
				//context.DrawImage(new RectangleF((_height - 35)/2, (_height - 35)/2, 35, 35), userImage.CGImage);
				userImage.Draw(new RectangleF((_height - 35)/2, (_height - 35)/2, 35, 35));
			}
			
			if (graph.ContainsKey(_User.id))
				_User = graph[_User.id];
			
			UIColor.Black.SetColor ();
			if (_User.name != null)
			{
				view.DrawString(_User.name, new RectangleF(50, 5, bounds.Width/2, 10 ), fromFont, UILineBreakMode.TailTruncation);
				
				if (userImage == null)
				{
					userImage = ImageStore.RequestFullPicture((long)_User.id, (long)_User.id, SizeDB.SizeFacebook, this);
					userImage = userImage ?? ImageStore.EmptyProfileImage;
					userImage = UIImageUtils.resizeImage(userImage, new SizeF (35, 35));
					userImage = GraphicsII.RemoveSharpEdges(userImage);
					if (userImage != null)
						userImage.Draw(new RectangleF((_height - 35)/2, (_height - 35)/2, 35, 35));
				}				
			}
			else
			{
				ThreadPool.QueueUserWorkItem(o =>
				{					
					GraphUser gUser = AppDelegateIPhone.AIphone.FacebookServ.GetFriend(_User.id);
					if (gUser == null)
						return;
					
					lock (lock_graph)
					{
						graph[gUser.id] = gUser;
					}
					
					if (gUser.id == _User.id)
					{
						_User = gUser;
						nss.InvokeOnMainThread(()=> view.SetNeedsDisplay());
					}
				});
			}
		}
开发者ID:21Off,项目名称:21Off,代码行数:62,代码来源:FbUserElement.cs

示例7: DrawLayer

 public override void DrawLayer(CALayer layer, CGContext context)
 {
     context.SaveState ();
     context.SetFillColor (1.0f, 1.0f, 1.0f, 1.0f);
     context.FillRect (context.GetClipBoundingBox ());
     context.TranslateCTM (0.0f, layer.Bounds.Size.Height);
     context.ScaleCTM (1.0f, -1.0f);
     context.ConcatCTM (this.oParentController.currentPDFPage.GetDrawingTransform (CGPDFBox.Crop, layer.Bounds, 0, true));
     context.DrawPDFPage (this.oParentController.currentPDFPage);
     context.RestoreState ();
 }
开发者ID:Emasoft,项目名称:IpaziaPDFReader,代码行数:11,代码来源:TiledLayerDelegate.cs

示例8: DrawInContext

    public override void DrawInContext(CGContext context)
    {
        // Start with a background whose color we don't use in the demo
        context.SetGrayFillColor (0.2f, 1);
        context.FillRect (Bounds);

        // We want to just lay down the background without any blending so we use the Copy mode rather than Normal
        context.SetBlendMode(CGBlendMode.Copy);

        // Draw a rect with the "background" color - this is the "Destination" for the blending formulas
        context.SetFillColorWithColor (DestinationColor.CGColor);
        context.FillRect(new RectangleF (110, 20, 100, 100));

        // Set up our blend mode
        context.SetBlendMode (BlendMode);

        // And draw a rect with the "foreground" color - this is the "Source" for the blending formulas
        context.SetFillColorWithColor (SourceColor.CGColor);
        context.FillRect (new RectangleF (60, 45, 200, 50));
    }
开发者ID:CVertex,项目名称:monotouch-samples,代码行数:20,代码来源:blend.cs

示例9: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            UIColor.White.SetFill ();
            context.FillRect (bounds);

            context.DrawLinearGradient (gradient, new PointF (bounds.Left, bounds.Top), new PointF (bounds.Left, bounds.Bottom), CGGradientDrawingOptions.DrawsAfterEndLocation);

            UIColor.Black.SetColor ();
            view.DrawString("Assigned to: " + this.User, new RectangleF(10, 5, bounds.Width-20, 7), nameFont,UILineBreakMode.TailTruncation);

            UIColor.DarkGray.SetColor();
            view.DrawString(this.Text, new RectangleF(10, 30, bounds.Width - 20, TextHeight(bounds) ), descriptionFont, UILineBreakMode.WordWrap);
        }
开发者ID:GunioRobot,项目名称:AgileZen,代码行数:13,代码来源:StoryDetailElement.cs

示例10: Draw

		public override void Draw (RectangleF bounds, CGContext context, UIView view)
		{
			UIColor.White.SetFill ();
			context.FillRect (bounds);
			
			//if (userImage == null)
			//	userImage = UIImageUtils.GetPreview (string.Format("Images/Profiles/{0}.jpg", _User.Id), new SizeF (40, 40));

			if (userImage != null)
				context.DrawImage(new RectangleF(0, 0, 40, 40), userImage.CGImage);
			
			UIColor.Black.SetColor ();
			view.DrawString(_User.Name, new RectangleF(50, 5, bounds.Width/2, 10 ), fromFont, UILineBreakMode.TailTruncation);
		}
开发者ID:21Off,项目名称:21Off,代码行数:14,代码来源:UserElement.cs

示例11: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            UIColor.White.SetFill ();
            context.FillRect (bounds);

            context.DrawLinearGradient (gradient, new PointF (bounds.Left, bounds.Top), new PointF (bounds.Left, bounds.Bottom), CGGradientDrawingOptions.DrawsAfterEndLocation);

            UIColor.Black.SetColor ();
            view.DrawString(this.Text, new RectangleF(10, 5, bounds.Width-20, 7), nameFont,UILineBreakMode.TailTruncation);

            //UIColor.Brown.SetColor ();
            //view.DrawString(this.CreatedTime, new RectangleF(bounds.Width/2, 5, (bounds.Width/2) - 10, 10 ), dateFont, UILineBreakMode.TailTruncation, UITextAlignment.Right);

            UIColor.DarkGray.SetColor();
            view.DrawString(this.Description, new RectangleF(10, 30, bounds.Width - 20, TextHeight(bounds) ), descriptionFont, UILineBreakMode.WordWrap);
        }
开发者ID:GunioRobot,项目名称:AgileZen,代码行数:16,代码来源:ProjectElement.cs

示例12: DrawLayer

        public override void DrawLayer(CALayer layer, CGContext context)
        {
            // fill with white background
            context.SetFillColor (1.0f, 1.0f, 1.0f, 1.0f);
            context.FillRect (bounds);
            context.SaveState ();

            // flip page so we render it as it's meant to be read
            context.TranslateCTM (0.0f, bounds.Height);
            context.ScaleCTM (1.0f, -1.0f);

            // scale page at the view-zoom level
            context.ScaleCTM (view.Scale, view.Scale);
            context.DrawPDFPage (view.Page);
            context.RestoreState ();
        }
开发者ID:BoogieMAN2K,项目名称:monotouch-samples,代码行数:16,代码来源:TiledPdfView.cs

示例13: DrawContentView

		public void DrawContentView(RectangleF rect, CGContext context, UITableViewElementCell cell)
		{
			context.SaveState();
			
			var backgroundColor = CellBackgroundColor;
			if (backgroundColor != null)
			{
				if (backgroundColor == UIColor.Clear)
					backgroundColor = UIColor.White;
				
				context.SetFillColorWithColor(backgroundColor.ColorWithAlpha(0.4f).CGColor);
				context.SetBlendMode(CGBlendMode.Overlay);
				context.FillRect(rect);
			}
			
			context.RestoreState();
		}
开发者ID:CartBlanche,项目名称:MonoMobile.MVVM,代码行数:17,代码来源:SampleTheme.cs

示例14: DrawLayer

		public override void DrawLayer (CALayer layer, CGContext context)
		{
			// keep a copy since (a) it's a _virtual_ property and (b) it could change between filling and flipping
			RectangleF bounds = view.Bounds;
			
			// fill with white background
			context.SetFillColor (1.0f, 1.0f, 1.0f, 1.0f);
			context.FillRect (bounds);
			context.SaveState ();

			// flip page so we render it as it's meant to be read
			context.TranslateCTM (0.0f, bounds.Height);
			context.ScaleCTM (1.0f, -1.0f);
	
			// scale page at the view-zoom level
			context.ScaleCTM (view.Scale, view.Scale);
			context.DrawPDFPage (view.Page);
			context.RestoreState ();
		}
开发者ID:rojepp,项目名称:monotouch-samples,代码行数:19,代码来源:TiledPdfView.cs

示例15: DrawInContext

        public override void DrawInContext(CGContext ctx)
        {
            base.DrawInContext (ctx);

            // clip
            var cornerRadius = Bounds.Height * Slider.Curvaceousness / 2.0f;
            UIBezierPath switchOutline =  UIBezierPath.FromRoundedRect( (CGRect)Bounds, (nfloat)cornerRadius);
            ctx.AddPath (switchOutline.CGPath);
            ctx.Clip ();

            // 1) fill the track
            ctx.SetFillColor (Slider.TrackColor.CGColor);
            ctx.AddPath(switchOutline.CGPath);
            ctx.FillPath ();

            // 2) fill the highlighed range
            ctx.SetFillColor(Slider.TrackHighlightColor.CGColor);
            var lower = Slider.positionForValue (Slider.LowValue);
            var higher = Slider.positionForValue(Slider.HighValue);
            ctx.FillRect((CGRect)new CGRect(lower, 0, higher - lower, Bounds.Height));

            // 3) add a highlight over the track
            CGRect highlight = new CGRect(cornerRadius/2, Bounds.Height/2,
                Bounds.Width - cornerRadius, Bounds.Height/2);
            UIBezierPath highlightPath = UIBezierPath.FromRoundedRect ((CGRect)highlight, (nfloat)highlight.Height * Slider.Curvaceousness / 2.0f);
            ctx.AddPath(highlightPath.CGPath);
            ctx.SetFillColor( UIColor.FromWhiteAlpha((nfloat)1.0f, (nfloat)0.4f).CGColor);
            ctx.FillPath ();

            // 4) inner shadow
            ctx.SetShadow( new CGSize(0f, 2.0f), 3.0f, UIColor.Gray.CGColor);
            ctx.AddPath (switchOutline.CGPath);
            ctx.SetStrokeColor(UIColor.Gray.CGColor);
            ctx.StrokePath ();

            // 5) outline the track
            ctx.AddPath( switchOutline.CGPath);
            ctx.SetStrokeColor(UIColor.Black.CGColor);
            ctx.SetLineWidth ((nfloat)0.5f);
            ctx.StrokePath ();
        }
开发者ID:jasallen,项目名称:FuRangeSlider,代码行数:41,代码来源:FuRangeSliderTrackLayer.cs


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