大家看看这段代码有什么错误!C#的

来源:百度知道 编辑:UC知道 时间:2024/05/30 08:12:30
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace keybord
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
string[] key = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
int[] num = new int[26];
Random random = new Random();
private void MainForm_Load(object sender, EventArgs e)
{

fo

谋杀脑细胞!

楼主能不能简单介绍一下你的程序想干什么?有什么问题?

foreach (Control a in this.Controls)
{
if (a is Button)
{
for (int i = 0; i < key.Length; i++)
{
a.Text = key[num[i]]; //这里循环没意义,最后a.Text = key[num[25]];
}
}
}