2016-07-24 86 views
1

繪製一個多邊形我想知道是否可以用Xamarin.Forms做這樣的事情。用Xamarin.forms

enter image description here

我已經可以seprate我的佈局,像這樣的,但我不知道我該怎麼做才能繪製多邊形?或者也許還有其他方法來實現這一目標?像drawable更好的方法?但它需要在每個設備上都是一樣的...

// Relative Layouts 
this.contentLayout = new RelativeLayout(); 
this.topLayout = new RelativeLayout(); 
this.bottomLayout = new RelativeLayout(); 

//topLayout.BackgroundColor = Color.FromHex("#00162E"); 
//bottomLayout.BackgroundColor = Color.FromHex("#FFFFFF"); 

// Top and Bottom Layouts 
this.contentLayout.Children.Add(
    topLayout, 
    Constraint.RelativeToParent((parent) => { return 0; }), 
    Constraint.RelativeToParent((parent) => { return 0; }), 
    Constraint.RelativeToParent((parent) => { return parent.Width; }), 
    Constraint.RelativeToParent((parent) => { return (parent.Height/2.5); }) 
); 
this.contentLayout.Children.Add(
    bottomLayout, 
    Constraint.RelativeToParent((parent) => { return 0; }), 
    Constraint.RelativeToParent((parent) => { return this.topLayout.Height; }), 
    Constraint.RelativeToParent((parent) => { return parent.Width; }), 
    Constraint.RelativeToParent((parent) => { return (parent.Height/1.5); }) 
); 

// Inside Top Layout 
// ??? Draw Polygon 

// Inside Bottom Layout 

謝謝大家!

祝您有美好的一天!

回答

1

看看NControl。我還沒有使用它,但你應該能夠達到你所期待的外觀和感覺。

這是一個圍繞NGraphics構建的包裝,它支持許多形狀,包括路徑。