CDateTimeCtr border

Deeptha S 1 Reputation point
2020-08-27T14:07:24.103+00:00

Hi ,

Iam using CDateTimeCtrl datepicker in MFC c++ while creation it has 3D borders ,but i like to set it to normal border .How can i do so?

iam creating datepicker as
DTPicker.Create(WS_CHILD | WS_VISIBLE| DTS_UPDOWN| WS_BORDER,
CRect(400,0,400,12), this, 3);

it creates a picker control with 3D border by default i like to change the border .

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,753 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. RLWA32 45,691 Reputation points
    2020-08-27T14:26:25.587+00:00

    Your question is too vague.

    Is your application manifested to use the V6 common controls?

    What styles did you set on the control?

    Don't make us guess.

    0 comments No comments

  2. RLWA32 45,691 Reputation points
    2020-08-27T15:11:32.967+00:00

    I suspect that your application is not manifested to use the V6 common controls. Earlier versions of the common controls will draw the datetimepicker with the 3d look.

    A typical MFC application created by the Visual Studio new MFC Application template will include a #pragma directive so that the application is properly manifested for the V6 common controls.

    I would include the #pragma directive but for some reason this site will not accept the text.

    0 comments No comments

  3. Jeanine Zhang-MSFT 9,766 Reputation points Microsoft Vendor
    2020-08-28T01:34:37.26+00:00

    Hi,

    According to your description, does the CDateTimeCtr display as shown below:

    20997-8282.png

    And if you want the CDateTimeCtr to display as shown below:

    21081-8281.png

    If so, I suggest you could try to enable Visual Styles.

    You could add the following compiler directive to your source code:

    #pragma comment(linker,"\"/manifestdependency:type='win32' \  
    name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \  
    processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")  
    

    For more details, I suggest you could refer to the Doc:Enabling Visual Styles.

    Best Regards,

    Jeanine Zhang


  4. RLWA32 45,691 Reputation points
    2020-09-09T15:57:44.527+00:00

    Its hard to tell what your issues are since using the V6 manifest should work.

    I suggest you start clean with a brand new MFC dialog application created by the new project wizard. It will properly insert the V6 common control manifest. Make sure you build for UNICODE.

    You should be able to instantiate a DateTimeCtrl without a 3d border in that application.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.