locked
CToolbar under 64-bit Windows 7

    Question

  •  

    Hello,

     

    I have converted a VC++ 6.0 project to VC++ 2010 project. Then while running the application the tool bars (Ctoolbar) looks fine. But if the tool bars are repositioned at run time, sometimes toolbars and it's background are not painted properly under 64-bit Windows 7. If the main window(parent window of toolbars) is minimized and maximized then toolbars and its' background are repainted properly.

     

    Is there a way to repaint toolbars and it's background properly during or after repositioning?

     

    Thanking you

    Ashlee

     

    Thursday, November 25, 2010 6:57 PM

All replies

  • Is this working fine in Windows 32bit version?

     


    मनोज कुमार जांगिड skype - jangid
    Friday, November 26, 2010 9:37 AM
  • MS developers changed a lot of code that deals with resizing and docking in CToolBar since VS 2008. I can't remember exactly what I had to do make the old VC6 toolbars work, but I still didn't get it 100% right - I gave up due to other important things.

    This might help:

    When creating toolbar don't add TBSTYLE_FLAT and TBSTYLE_TRANSPARENT flags in Create call. After you create toolbar, call m_toolbar.ModifyStyle (0, TBSTYLE_FLAT|TBSTYLE_TRANSPARENT);

    Another thing that I did was to set borders to 3 for top and bottom and 2 for left and right. But I'm not sure if this was to fix re-drawing or just to make buttons look better.

    I am still seeing occasional cutoffs or extra space for the last button and occasional re-drawing artifacts for empty space around toolbar strip on Windows Vista and 7.

    Hope this helps,

    Damir

    Thursday, December 02, 2010 5:56 PM
  • Hello Damir,

    Thank you for the reply.

    Removing TBSTYLE_FLAT|TBSTYLE_TRANSPARENT from CToolBar
    results in "theme color" painting of tool bar. The painting problem still remains.

    "Removing TBSTYLE_FLAT|TBSTYLE_TRANSPARENT" stuff was new to me. it was helpful, Thank you.

    Ashlee

    Friday, December 03, 2010 2:22 PM
  • Ashlee,

     

    Can you post a screenshot that illustrates the kind of painting problem you have?

    In my case I automatically reposition toolbars when user resizes the main window and I have noticed that it sometimes it produces artifact lines in the background of the toolbar area.

    The way I deal with it is that right after repositioning toolbars, I get a window handle to the parent of any toolbar (which is the CControlBar that holds all the toolbars when they are docked) and I call Invalidate on it. That seems to get rid of my drawing problem.

     

    Regards,

    Damir

    Friday, December 03, 2010 5:30 PM
  • Hello Damir,

    Can you post a screenshot that illustrates the kind of painting problem you have?

    Please see the link

    http://connect.microsoft.com/VisualStudio/feedback/details/624674/ctoolbar-under-64-bit-windows-7 - expand

    Thank you
    Ashlee

    Monday, December 06, 2010 8:29 AM
  • Ashlee,

     

    I see what is happening now - you are using toolbar with gripper. This problem has been there since Windows XP. Once you apply visual style to your app the gripper would not draw properly. There's a KB for that http://support.microsoft.com/kb/843490, but it only works for VC 6.

    I would get rid of gripper altogether because it seems to be the cause of problem. I doubt MS is going to do anything about this bug - they moved on long ago with their Feature Pack (which in my opinion is a downgrade from the VC6 MFC).

    So, if you get rid of gripper and flat styles in Create call and then add flat and transparent styles with ModifyStyle call, your toolbar should look alright.

    Damir

    Monday, December 06, 2010 3:29 PM