日期:2014-05-17 浏览次数:21033 次
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 Test_Static
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int i = 0; i < 3; i++)
{
testlabel.LabelBelt[i] = new MyLabel();
}
}
private void button1_Click(object sender, EventArgs e)
{
testlabel.LabelBelt[0].OpenTime_Full = DateTime.Now.AddHours(3);
testlabel.LabelBelt[0].StartLocation = 123;
if (testlabel.LabelBelt[0].OpenTime_Full.CompareTo(DateTime.Now) > 0)
{
MessageBox.Show("大于当前时间!");
}
if (testlabel.LabelBelt[0].StartLocation.ToString().Trim() == "123")
{
MessageBox.Show("文本是123!");
}
}
}
public class MyLabel : Label
{
public int StartLocation;
public DateTime OpenTime_Full;
}
public static class testlabel
{
public static MyLabel[] LabelBelt = new MyLabel[3];
}
}
private void button1_Click(object sender, EventArgs e)
{