在DateTimePicker中添加周次,要求如下:1. 当DropDown事件发生时,周次要显示在日期的左边,并且周次的最上面显示“周次”(与“星期日”水平对齐)
2. 周次要从某个日期算起,假设就从MinDate算起。
3. 在日期的下方要显示Value和当前日期的周次和日期。效果可以参考:
急啊!!!
2. 周次要从某个日期算起,假设就从MinDate算起。
3. 在日期的下方要显示Value和当前日期的周次和日期。效果可以参考:
急啊!!!
解决方案 »
- 用C#制作一个动画形式的窗体界面
- Page.RegisterStartupScript("", "<script>window.showModalDialog(' 对象不支持此属性或方法
- 一道简单的关于引用类型和值类型的题目
- 系统故障导致WndProc无法正常收到消息,该如何排查
- 关于代码编写习惯问题!!!
- 如何动态地得到当前Panel上的子panel
- 如何动态构建流程管理设计器
- SQLDMO能创建数据库吗?怎么创建?
- tooltip 闪烁
- TextBox添加内容后,如何使滚动条自动滚动到最底呢?
- 用C#操作word文档中不规则的表格,并可以替换表格中部分的数据!在线等,请大家帮帮忙!急用,晚了会出人命的!请各位高手帮帮吗!在此多谢了!
- DataTimeInput(DataTimePicker)没有赋值时,它的值是什么?
但是还是不行,对周次添加很是繁琐,不知道各位大侠有啥办法啊。
急!!!
http://msdn.microsoft.com/zh-cn/vbasic/0xah4ckt.aspx
这个是Microsoft Visual Studio 2008里的,不知道你的项目是哪个版本
select datepart(week,getdate())
这个控件是采用User32.dll发送消息,来改变下拉datetimepicker的显示的!
急啊!
http://msdn.microsoft.com/zh-cn/vbasic/0xah4ckt.aspx
这个是Microsoft Visual Studio 2008里的,不知道你的项目是哪个版本
c#自带的月历控件的源代码里说明了
/// <include file='doc\MonthCalendar.uex' path='docs/doc[@for="MonthCalendar"]/*' />
/// <devdoc>
/// This control is an encapsulateion of the Windows month calendar control.
/// A month calendar control implements a calendar-like user interface, that
/// provides the user with a very intuitive and recognizable method of entering
/// or selecting a date.
/// Users can also select which days bold. The most efficient way to add theMonthCalendar 只不过是windows自带的月历控件的封装(ps:源代码里居然有错别字encapsulateion -> encapsulation)
不是重新做的,有绘制方法什么的,所以效果并不是都能满足看这段
/// <include file='doc\MonthCalendar.uex' path='docs/doc[@for="MonthCalendar.CreateParams"]/*' />
/// <devdoc>
/// This is called when creating a window. Inheriting classes can ovveride
/// this to add extra functionality, but should not forget to first call
/// base.getCreateParams() to make sure the control continues to work
/// correctly.
/// </devdoc>
protected override CreateParams CreateParams {
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
get {
CreateParams cp = base.CreateParams;
cp.ClassName = NativeMethods.WC_MONTHCAL;
cp.Style |= NativeMethods.MCS_MULTISELECT | NativeMethods.MCS_DAYSTATE;
if (!showToday) cp.Style |= NativeMethods.MCS_NOTODAY;
if (!showTodayCircle) cp.Style |= NativeMethods.MCS_NOTODAYCIRCLE;
if (showWeekNumbers) cp.Style |= NativeMethods.MCS_WEEKNUMBERS;
if (RightToLeft == RightToLeft.Yes && RightToLeftLayout == true) {
//We want to turn on mirroring for Form explicitly.
cp.ExStyle |= NativeMethods.WS_EX_LAYOUTRTL;
//Don't need these styles when mirroring is turned on.
cp.ExStyle &= ~(NativeMethods.WS_EX_RTLREADING | NativeMethods.WS_EX_RIGHT | NativeMethods.WS_EX_LEFTSCROLLBAR);
} return cp;
}
}showWeekNumbers 显示周次的方法也只是控制样式参数让默认的周次显示出来而已,也无法自己定制所以,还是放个MonthCalendar后周次自己左边放一个panel自己算好画出来(第一周、第二周)
急啊!