0
您好,我使用NGraphics繪製了xamarin形式的筆畫。在Android中,我可以使用圓帽來繪製筆畫,因此端點的筆觸是圓形的。在NGraphics中,我仍然可以畫出中風,但終點有彎道。NGraphics:有沒有辦法在筆畫上有圓帽
您好,我使用NGraphics繪製了xamarin形式的筆畫。在Android中,我可以使用圓帽來繪製筆畫,因此端點的筆觸是圓形的。在NGraphics中,我仍然可以畫出中風,但終點有彎道。NGraphics:有沒有辦法在筆畫上有圓帽
簡短的回答:沒有
的NGraphic的Pen
類不公開像StrokeJoins
和StrokeCaps
項目。
您可以隨時修改源代碼,將這些類型的屬性添加到Pen
類中,並設置相應的平臺相關項目。
即在Android執行力度,私營GetPenPaint
方法設置了Android Paint
對象,只需要設置Paint.StrokeCap
在適當的時候:
`paint.StrokeCap = Paint.Cap.Round;`
Paint GetPenPaint (Pen pen)
{
var paint = new Paint (PaintFlags.AntiAlias);
paint.SetStyle (Paint.Style.Stroke);
paint.SetARGB (pen.Color.A, pen.Color.R, pen.Color.G, pen.Color.B);
paint.StrokeWidth = (float)pen.Width;
if (pen.DashPattern != null && pen.DashPattern.Any()) {
var dashPathEffect = new DashPathEffect(pen.DashPattern.ToArray(), 0);
paint.SetPathEffect(dashPathEffect);
}
return paint;
}
感謝您的responsed – LittleFunny