首页 \ 问答 \ 如何控制DateTimePicker中的时间间隔(How to contol the time interval in a DateTimePicker)

如何控制DateTimePicker中的时间间隔(How to contol the time interval in a DateTimePicker)

我有一个DateTimePicker控件的窗体指定如下所示:

dtpEntry.Format = DateTimePickerFormat.Custom;
dtpEntry.CustomFormat = "dd/MM/yyyy hh:mm:ss";
dtpEntry.ShowUpDown = true;

我希望用户只能以5分钟的增量递增或递减时间。

有关如何完成此任务的任何建议?


I have a DateTimePicker control on a form specified like so:

dtpEntry.Format = DateTimePickerFormat.Custom;
dtpEntry.CustomFormat = "dd/MM/yyyy hh:mm:ss";
dtpEntry.ShowUpDown = true;

I would like the user to only be able to increment or decrement the time by 5 minute increments.

Any suggestions on how one would accomplish this?


原文:https://stackoverflow.com/questions/1846068
更新时间:2021-11-26 19:11

最满意答案

LI中的锚标签按钮在左侧有额外的填充以为图像腾出空间,因此,为了隐藏图像,调整填充:

@media all and (max-width: 30em) {
    .list-breakpoint img { display: none; }
    .list-breakpoint a.ui-btn { padding-left: 1em !important; }
}

DEMO


The anchor tag button in the LI has extra padding on the left to make room for the image, so as well as hiding the image, adjust the padding:

@media all and (max-width: 30em) {
    .list-breakpoint img { display: none; }
    .list-breakpoint a.ui-btn { padding-left: 1em !important; }
}

DEMO

相关问答

更多
  • 尝试将图像的宽度明确设置为父级的100%。 像这样: .item img { position:relative; width: 100%; } 编辑:不是类,实际的图像标记。 Try to set the width of the images explicitly to 100% of the parent. Like so: .item img { position:relative; width: 100%; } Edit: Not the class, the ...
  • 无论您使用DIV还是无序甚至有序列表都无关紧要。 我倾向于为这种情况选择一个无序列表,因为它在语义上适合我。 但是布局魔术发生在你的样式表中。 我使用列表的一个原因是,它通常会派上用场,以获得层次结构 名单 项目 内容 因此,您可以使用列表项大小相关的容器列表(在您的情况下为20%),而每个列表项的内容可以相对于其列表项父项布局。 你可以只列出列表中的列表项(所以不要忘记通过以下方式清除浮点数:后面的伪元素)或将显示设置为内联块(然后你必须取出列表中的LI标签之间的任何空格来防止任何差距)。 提示:由于相对 ...
  • 看看这个例子并添加你想要的任何东西。 这不是您的全部要求,但可以在此基础上进行。 这是原始的例子 。
  • Message 1
  • 现在很容 ...
  • 对基本结构进行了一些快速更改,以帮助您开始正确的轨道。 Code: http://jsfiddle.net/purplenurple/YCcNY/29/ 有很多不必要的CSS。 要小心,不要过于复杂化。 CSS就像有时候,你认为你需要添加一些东西来解决问题,但实际上你需要删除原本不明显的问题。 注意:没有JavaScript就不可能将它垂直居中,因为模态盒和容器都没有固定的高度。 您必须通过脚本获取高度并相应地设置框的位置。 我没有为您实现任何JavaScript,因为StackOverflow的目的不是 ...
  • LI中的锚标签按钮在左侧有额外的填充以为图像腾出空间,因此,为了隐藏图像,调整填充: @media all and (max-width: 30em) { .list-breakpoint img { display: none; } .list-breakpoint a.ui-btn { padding-left: 1em !important; } } DEMO The anchor tag button in the LI has extra padding on the left ...
  • 你可以使用JQuery,如下面的例子。 var cw = $('。child')。width(); $( '孩子 ')的CSS({' 高度 ':CW +' 像素'}); I thinks the answer is adding .resize as follow: