在DateTimePicker中添加周次,要求如下:1. 当DropDown事件发生时,周次要显示在日期的左边,并且周次的最上面显示“周次”(与“星期日”水平对齐)
2. 周次要从某个日期算起,假设就从MinDate算起。
3. 在日期的下方要显示Value和当前日期的周次和日期。效果可以参考:
急啊!!!

解决方案 »

  1.   

    我参考了codeproject:http://www.codeproject.com/KB/miscctrl/ExtendedDateTimePicker.aspx
    但是还是不行,对周次添加很是繁琐,不知道各位大侠有啥办法啊。
    急!!!
      

  2.   

    看看这个呢?
    http://msdn.microsoft.com/zh-cn/vbasic/0xah4ckt.aspx
    这个是Microsoft Visual Studio 2008里的,不知道你的项目是哪个版本
      

  3.   

    不知道这个你能不能用得上
    select   datepart(week,getdate())
      

  4.   

    请熟悉VC的高手来看看啊
    这个控件是采用User32.dll发送消息,来改变下拉datetimepicker的显示的!
    急啊!
      

  5.   

    看看这个呢? 
    http://msdn.microsoft.com/zh-cn/vbasic/0xah4ckt.aspx 
    这个是Microsoft Visual Studio 2008里的,不知道你的项目是哪个版本
      

  6.   

    自己做个控件,放上月历控件和panel什么的自己组合绘画把
    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自己算好画出来(第一周、第二周)
     
      

  7.   

    谢谢这位wartim英雄,除了你所说的方法外,真的没有别的方法了吗?
    急啊!