本文整理汇总了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
);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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
);
}
示例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
);
}
示例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);
}
}
示例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());
}
});
}
}