菜鸟求助
wpf吧
全部回复
仅看楼主
level 2
魔灵txy 楼主
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace WpfApplication1
/// <summary>
/// Window4.xaml 的交互逻辑
/// </summary>
public partial class Window4 : Window
{
public Window4()
{
InitializeComponent();
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
}
private void button3_Click(object sender, RoutedEventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox6.Clear();
textBox7.Clear();
textBox8.Clear();
textBox9.Clear();
textBox10.Clear();
textBox11.Clear();
textBox12.Clear();
textBox13.Clear();
textBox14.Clear();
textBox15.Clear();
textBox16.Clear();
textBox17.Clear();
textBox18.Clear();
textBox1.Focus();
}
int[] array = new int[10];
private void button1_Click(object sender, RoutedEventArgs e)
{
List<float> zkscore = new List<float>();
foreach (Control item in )
{
TextBox t = item as TextBox;
if (null != t)
{
if (!string.IsNullOrEmpty(t.Text))
{
try
{
zkscore.Add(float.Parse(t.Text));
}
catch (Exception)
{
MessageBox.Show("请正确输入分数!");
break;
}
}
else
{
MessageBox.Show("每个评委都必须
打分
!");
break;
}
}
}
if (zkscore.Count == 10)
{
float high = zkscore.Max();
float low = zkscore.Min();
label213.Content = high.ToString();
label224.Content= low.ToString();
zkscore.Remove(high);
zkscore.Remove(low);
la1zhuanke.Content= zkscore.Average();
}
}
private void button2_Click(object sender, RoutedEventArgs e)
{
List<float> bkscore = new List<float>();
foreach (Control item in bk.Children)
{
TextBox t = item as TextBox;
if (null != t)
{
if (!string.IsNullOrEmpty(t.Text))
{
try
{
bkscore.Add(float.Parse(t.Text));
}
catch (Exception)
{
MessageBox.Show("请正确输入分数!");
break;
}
}
else
{
MessageBox.Show("每个评委都必须打分!");
break;
}
}
}
if (bkscore.Count == 8)
{
float high = bkscore.Max();
float low = bkscore.Min();
lbl321.Content = high.ToString();
lbl542.Content = low.ToString();
bkscore.Remove(high);
bkscore.Remove(low);
labelbenke.Content = bkscore.Average();
}
}
}
}
2015年01月12日 11点01分 1
level 5
虽然不知道你想问什么,但我知道你第一个foreach错了
2015年01月17日 06点01分 2
1