本文介绍了包含毫秒的时间选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



好的,因此,在四处查看并尝试了不同的方法之后,我得出的结论是,尽管Microsoft文档提供了建议,但标准.Net DateTimePicker不支持毫秒级选择.我也未能在其他选择器的网络上找到提供毫秒选项的示例.因此,我的问题是这样的:

有谁知道一个支持拾音毫秒的TimePicker,还是我必须自己写一个?

非常感谢,

Ed

Hi,

Okay so after a lot of looking around and trying different things I have come to the conclusion that the standard .Net DateTimePicker doesn''t provide support for picking milliseconds...despite what Microsoft documentation would suggest. I have also failed to find an example on the web of a different picker that does provide milliseconds option. My question is therefore this:

Does anyone know of a TimePicker that supports picking milliseconds or do I have to write one myself?

Thanks very much,

Ed

推荐答案


namespace WindowsFormsApplication1
{
    public partial class DTMLPicker : System.Windows.Forms.DateTimePicker
    {// Its an usecontrol
        public DTMLPicker()
        {
            InitializeComponent();
            System.Windows.Forms.ComboBox Cmb = 
                       new System.Windows.Forms.ComboBox();
            this.Controls.Add(Cmb);
            Cmb.Name = "Cmb";
            Cmb.Top = 0;
            Cmb.Left = 0;
            Cmb.Width = 50;
            Cmb.BringToFront();
            for (int i = 1; i <= 1000; i++)
            {
                Cmb.Items.Add(i);
            } 
            int ms = Microsoft.VisualBasic.DateAndTime.Now.Millisecond ;
            Cmb.Text = ms.ToString("D2");
        }
    }
}


这篇关于包含毫秒的时间选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 17:23