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


C# UIView.DrawString方法代码示例

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


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

示例1: 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

示例2: Draw

        public override void Draw(RectangleF bounds, MonoTouch.CoreGraphics.CGContext context, UIView view)
        {
            CaptionColor.SetColor();
            var textHeight = Caption.MonoStringHeight(CaptionFont, bounds.Width - PaddingX * 2);
            view.DrawString(Caption, new RectangleF(PaddingX, Padding, bounds.Width - Padding * 2, bounds.Height - Padding * 2), CaptionFont, UILineBreakMode.WordWrap);

            if (Value != null)
            {
                ValueColor.SetColor();
                var valueHeight = Value.MonoStringHeight(ValueFont, bounds.Width - PaddingX * 2);
                view.DrawString(Value, new RectangleF(PaddingX, Padding + textHeight + 6f, bounds.Width - Padding * 2, valueHeight), ValueFont, UILineBreakMode.WordWrap);
            }
        }
开发者ID:GSerjo,项目名称:appreciateui,代码行数:13,代码来源:MultilinedElement.cs

示例3: Draw

        public override void Draw(RectangleF bounds, MonoTouch.CoreGraphics.CGContext context, UIView view)
        {
			view.BackgroundColor = UIColor.White;
            CaptionColor.SetColor();
            var width = bounds.Width - PaddingX * 2;
            var textHeight = Caption.MonoStringHeight(CaptionFont, width);
            view.DrawString(Caption, new RectangleF(PaddingX, PaddingY, width, bounds.Height - PaddingY * 2), CaptionFont, UILineBreakMode.WordWrap);

            if (Value != null)
            {
                ValueColor.SetColor();
                var valueOrigin = new PointF(PaddingX, PaddingY + textHeight + 8f);
                var valueSize = new SizeF(width, bounds.Height - valueOrigin.Y);
                view.DrawString(Value, new RectangleF(valueOrigin, valueSize), ValueFont, UILineBreakMode.WordWrap);
            }
        }
开发者ID:rcaratchuk,项目名称:MonoTouch.Dialog,代码行数:16,代码来源:MultilinedElement.cs

示例4: 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.From, new RectangleF(10, 5, bounds.Width/2, 10 ), fromFont, UILineBreakMode.TailTruncation);
			
			UIColor.Brown.SetColor ();
			view.DrawString(this.Sent, new RectangleF(bounds.Width/2, 5, (bounds.Width/2) - 10, 10 ), dateFont, UILineBreakMode.TailTruncation, UITextAlignment.Right);
			
			UIColor.DarkGray.SetColor();
			view.DrawString(this.Subject, new RectangleF(10, 30, bounds.Width - 20, TextHeight(bounds) ), subjectFont, UILineBreakMode.WordWrap);
		}
开发者ID:21Off,项目名称:21Off,代码行数:16,代码来源:SampleOwnerDrawnElement.cs

示例5: 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

示例6: 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

示例7: 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

示例8: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            context.BeginPath();
			context.SetLineWidth(1.0f);
			context.SetStrokeColor(UIColor.FromRGB(199, 199, 205).CGColor);
			var x = (int)System.Math.Ceiling(bounds.Width / 2 - 0.5f);
			context.MoveTo(x, 0f);
			context.AddLineToPoint(x, bounds.Height);
            context.StrokePath();

            /*
            context.BeginPath();
            context.SetStrokeColor(UIColor.FromRGBA(250, 250, 250, 128).CGColor);
            context.MoveTo(bounds.Width / 2 + 0.5f, 0);
            context.AddLineToPoint(bounds.Width / 2 + 0.5f, bounds.Height);
            context.StrokePath();
            */

            var row = Value;
            var half = bounds.Height / 2;
            var halfText = _font.LineHeight / 2 + 1;

            row.Image1.Draw(new RectangleF(15, half - 8f, 16f, 16f));

            if (!string.IsNullOrEmpty(row.Text1))
            {
                UIColor.Gray.SetColor();
                view.DrawString(row.Text1, new RectangleF(36,  half - halfText, bounds.Width / 2 - 40, _font.LineHeight), _font, UILineBreakMode.TailTruncation);
            }

            row.Image2.Draw(new RectangleF(bounds.Width / 2 + 15, half - 8f, 16f, 16f));

            if (!string.IsNullOrEmpty(row.Text2))
            {
                UIColor.Gray.SetColor();
                view.DrawString(row.Text2, new RectangleF(bounds.Width / 2 + 36,  half - halfText, bounds.Width / 2 - 40, _font.LineHeight), _font, UILineBreakMode.TailTruncation);
            }
        }
开发者ID:rcaratchuk,项目名称:MonoTouch.Dialog,代码行数:38,代码来源:SplitElement.cs

示例9: 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

示例10: 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 ();
            ColorHelper.GetGPLightPurple ().SetColor ();
            view.DrawString (
                this.Label,
                new RectangleF (10, 10, bounds.Width, 20),
                captionFont,
                UILineBreakMode.TailTruncation
            );
        }
开发者ID:rajeshwarn,项目名称:GhostPractice-iPadRepo,代码行数:21,代码来源:TitleElement.cs

示例11: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            //			string name = CultureInfo.CurrentCulture.Name;
            //			NumberFormatInfo nfi = new CultureInfo (name, true).NumberFormat;
            //			if (name == "en-ZA") {
            //				nfi.CurrencyDecimalSeparator = ",";
            //				nfi.CurrencyGroupSeparator = " ";
            //
            //				nfi.NumberDecimalSeparator = ",";
            //				nfi.NumberGroupSeparator = " ";
            //			}

            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 (20, 10, bounds.Width / 2, 10),
                captionFont,
                UILineBreakMode.TailTruncation
            );

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

示例12: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            var leftMargin = LeftRightPadding;

            // Superview is the container, its superview the uitableviewcell
            var uiTableViewCell = view.Superview.Superview as UITableViewCell;
            bool highlighted = uiTableViewCell != null && uiTableViewCell.Highlighted & IsTappedAssigned;
            var timeColor = highlighted ? UIColor.White : TimeColor;
            var textColor = highlighted ? UIColor.White : TextColor;
            var nameColor = highlighted ? UIColor.White : NameColor;
//
//			UIColor.White.SetFill();
//			context.FillRect(bounds);
//
            if (Image != null)
            {
                var imageRect = new RectangleF(LeftRightPadding, TopBottomPadding, 32f, 32f);
                UIColor.White.SetColor ();

                context.SaveState ();
                //context.TranslateCTM (imageRect.X, imageRect.Y);
//				context.SetLineWidth (1);
                
                //On device, the shadow is painted in the opposite direction!
//                context.SetShadowWithColor (new SizeF (0, 0), 3, UIColor.LightGray.CGColor);
//                context.AddPath (UIBezierPath.FromRect(imageRect).CGPath);
//                context.FillPath ();
//                context.RestoreState ();

                Image.Draw(imageRect);
                leftMargin += LeftRightPadding + imageRect.Width + 3f;
            }

            var contentWidth = bounds.Width - LeftRightPadding  - leftMargin;

            nameColor.SetColor();
            view.DrawString(Name,
                new RectangleF(leftMargin, TopBottomPadding, contentWidth, _userFont.LineHeight),
                _userFont, UILineBreakMode.TailTruncation
            );

            timeColor.SetColor();
            var daysWidth = Time.MonoStringLength(_dateFont);
            var timeRect = IsImageAssigned ? new RectangleF(leftMargin, TopBottomPadding + _userFont.LineHeight, daysWidth, _dateFont.LineHeight) : 
                new RectangleF(bounds.Width - LeftRightPadding - daysWidth,  TopBottomPadding + 1f, daysWidth, _dateFont.LineHeight);
            view.DrawString(Time, timeRect, _dateFont, UILineBreakMode.TailTruncation);

            if (!string.IsNullOrEmpty(String))
            {
                UIColor.Black.SetColor();
                var top = TopBottomPadding + _userFont.LineHeight + 3f;
                if (IsImageAssigned)
                    top += _dateFont.LineHeight;

                textColor.SetColor();
                var stringRect = IsImageAssigned ? new RectangleF(leftMargin, top, contentWidth, bounds.Height - TopBottomPadding - top) :
				                 new RectangleF(LeftRightPadding, top, bounds.Width - LeftRightPadding*2, bounds.Height - TopBottomPadding - top);

                view.DrawString(String, stringRect, _descFont, UILineBreakMode.TailTruncation);
            }
        }
开发者ID:rcaratchuk,项目名称:MonoTouch.Dialog,代码行数:61,代码来源:NameTimeStringElement.cs

示例13: 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


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