using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        enum planetperiods : int
        {
            mercury = 88, venus = 225, earth = 365, mars = 687
        }
        private void form1_click(object sender, EventArgs e)
        {
            label1.Text += "水星绕地球一周的时间为" + (int)planetperiods.mercury + "天\n";
            label1.Text += "金星绕地球一周的时间为" + (int)planetperiods.venus + "天\n";
            label1.Text += "地星绕地球一周的时间为" + (int)planetperiods.earth + "天\n";
            label1.Text += "火星绕地球一周的时间为" + (int)planetperiods.mars + "天\n";
        }
    }
}
代码没有错。

解决方案 »

  1.   

    直接看结果是不是你要的就行了,实在不行就用messagebox.show你不懂就闭嘴吧我真烦死你了。            label1.Text += "水星绕地球一周的时间为" + (int)planetperiods.mercury + "天\n";
     MessageBox.Show("");
                label1.Text += "金星绕地球一周的时间为" + (int)planetperiods.venus + "天\n";
     MessageBox.Show("");
                label1.Text += "地星绕地球一周的时间为" + (int)planetperiods.earth + "天\n";
     MessageBox.Show("");
                label1.Text += "火星绕地球一周的时间为" + (int)planetperiods.mars + "天\n";这样就行了你再试试
      

  2.   


    label1.Text += "水星绕地球一周的时间为" + planetperiods.mercury.ToString() + "天\n";
    你这一直过不去,不会是有错误吧...
      

  3.   

    (int)planetperiods.mercury  你有这个对象么?我跟楼主说呢,你怎么连代码都看不明白就3个绿裤衩了?
      

  4.   


    (int)planetperiods.mercury  这个是个枚举值,
    另外调试时候确实是冻结了窗口,不能看到的,你如果想看到输出的信息可以使用 Debug.WriteLine 来查看,也可以监视变量的变化,方法很多。一般都是采用的控制台输出调试信息来看的,如果在多线程里面的话,你想打断点来调试都是非常困难的一件事,使用 Debug.WriteLine来输出你要看到的信息吧