public override void Draw(RectangleF rect) { float textWidth = rect.Width - TextOffset - XBorderPadding; CGContext ctx = UIGraphics.GetCurrentContext(); float y = rect.Y; float x = rect.X; TextColor.SetColor(); DrawString(Make ?? "Unknown Make", new RectangleF(x + TextOffset, y + MakeYOffset, textWidth, AircraftMakeFontSize), AircraftMakeFont); DrawString(Model ?? "Unknown Model", new RectangleF(x + TextOffset, y + ModelYOffset, textWidth, AircraftModelFontSize), AircraftModelFont); DrawString(Remarks ?? "", new RectangleF(x + TextOffset, y + RemarksYOffset, textWidth, RemarksFontSize * 3), RemarksFont, UILineBreakMode.WordWrap); ctx.SaveState(); ctx.TranslateCTM(XBorderPadding, YBorderPadding); ctx.AddPath(PhotoBorder); ctx.Clip(); if (Photograph == null) { DefaultPhoto.Draw(PhotoRect); } else { Photograph.Draw(PhotoRect); } ctx.AddPath(PhotoBorder); ctx.SetStrokeColor(0.5f, 0.5f, 0.5f, 1.0f); ctx.SetLineWidth(0.5f); ctx.StrokePath(); ctx.RestoreState(); }
void DrawPhoto(CGContext ctx) { ctx.SaveState(); ctx.AddPath(PhotoBorder); ctx.Clip(); Photograph.Draw(PhotoRect); ctx.AddPath(PhotoBorder); ctx.SetStrokeColor(0.5f, 0.5f, 0.5f, 1.0f); ctx.SetLineWidth(0.5f); ctx.StrokePath(); ctx.RestoreState(); }