1
我试图用数组中的值设置椭圆的边距。我至今的代码是这样的:Windows Phone 8 C#中的边距厚度
private void Dots()
{
string[] strArray = new string[] { "387,10,396,432"}; // this is the margin
foreach (string str in strArray)
{
Ellipse a = new Ellipse();
a.Fill = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
a.Margin = new Thickness(Convert.ToInt32(str)); // the margin goes here
a.Width = 25;
a.Height = 25;
a.Tap += DotTap;
LevelPanel1.Children.Add(a);
}
}
现在的问题是,我得到错误“输入的字符串不是正确的格式”。 保证金最终应该是这样的:
a.Margin = new Thickness(387,10,396,432);
有谁现在如何解决这一问题?如果这是一个非常愚蠢的问题,我很抱歉。)
在此先感谢。
谢谢,这是工作,但我怎么能得到这个工作,如果我有多个利润率,而不只是一个? – 2014-11-02 12:18:56
@NLGameVideosNL只是做另一个:),看到更新的解决方案。 – 2014-11-02 12:26:56
非常感谢你,每个人都像一个魅力:) – 2014-11-02 12:34:40