当前日期和选择日期之间的时差显示
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 GoldCubePos.App
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ToolStripControlHost dateTimeCal;
dateTimeCal = new ToolStripControlHost(new DateTimePicker());
((DateTimePicker)dateTimeCal.Control).ValueChanged += delegate { toolStripLabel1.Text = ((DateTimePicker)dateTimeCal.Control).Value.Subtract(DateTime.Now).ToString(); };
dateTimeCal.Width = 200;
toolStrip1.Width = 250;
dateTimeCal.DisplayStyle = ToolStripItemDisplayStyle.Text;
toolStrip1.Items.Add(dateTimeCal);
}
}
}