none
Problem with Windows 7 Radiobuttons text labels

    Question

  • We have noticed that since going to VS 2010 running under Windows 7 that the text alignment within Radiobuttons seems to have changed.  When we have a text label on the right side of a horizontal radiobutton, the text label is not aligned immediately after the button (to the left) , but to the right.  I suspect Visual Themes may have something to do with this.  We are a C/C++ shop and any suggestions would be appreciated.

    - Thanks

    Friday, February 19, 2016 10:20 PM

Answers

All replies

  • Hi D Criley,

    I have no VS2010 windows 7 Environment, but I have the VS2010 in one windows 10 machine.

    One issue is that how I can repro this issue in my side, could you share us the detailed steps with screen shots about this issue?

    For example, which kind of app did you really create, MFC or others?

    >>When we have a text label on the right side of a horizontal radiobutton, the text label is not aligned immediately after the button (to the left) , but to the right.

    How can I set it "When we have a text label on the right side of a horizontal radiobutton"? Which control property did you set it? 

    Could you share me a screen shot about the result "the text label is not aligned immediately after the button (to the left) , but to the right."?

    Thanks,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 22, 2016 8:24 AM
    Moderator
  • This what we see when we use Common Controls 6 vs. Common Controls 5:

    Difference_Radio_Between_Control6_Control5.png

    This is purely a win32 application (not MFC, etc.)


    Monday, February 22, 2016 9:36 PM
  • The RadioBox's  properties are:

    WS_CHILDWINDOW, WS_VISIBLE, WS_CLIPSIBLINGS

    WS_EX_LEFT, WS_EX_LTRREADING, WS_EX_RIGHTSCROLLBAR

    The RadioButton's properties are:

    WS_CHILDWINDOW, WS_VISIBLE, WS_CLIPSIBLINGS, BS_RADIOBUTTON

    WS_EX_LEFT, WS_EX_LTRREADING, WS_EX_RIGHTSCROLLBAR


    • Edited by D Criley Monday, February 22, 2016 9:43 PM
    Monday, February 22, 2016 9:39 PM
  • The RadioButton label text is drawn as follows:

            /*
            ** Determine where the text resides within the radiofield button
            */
            GetRadiobuttonTextPosition( self, custDraw->hdc, custDraw->hdr.hwndFrom, custDraw->rc, buttonText, &xPos, &yPos );

            /*
            ** Write the text to the radiobutton's DC
            */
            SetRect( &r, xPos, yPos, 1, 1);
            DrawText(custDraw->hdc, buttonText, -1, &r, DT_CALCRECT | DT_EXPANDTABS);
            DrawText(custDraw->hdc, buttonText, -1, &r, DT_EXPANDTABS | DT_NOCLIP);

    The "r" rectangle's left attribute is 4 characters after the checkbox, yet the text is written much further to the right


     


    • Edited by D Criley Monday, February 22, 2016 9:44 PM
    Monday, February 22, 2016 9:39 PM
  • Also for some strange reason disabling visual themes "seems" to correct this problem.  Visual themes, as documented,  does not change things like individual control behavior.
    Monday, February 22, 2016 10:44 PM
  • Hi D Criley,

    Sorry for that we couldn't see the screen shot shared by you:

    To really repro this issue, could you share us a simple sample using one drive? So I could download and repro it in my side, you could also upload the screen shot in your sample.

    >>Also for some strange reason disabling visual themes "seems" to correct this problem. 

    Does it mean that it works well if you disable the Visual themes? One issue is that how you disable this Visual themes, is it related to the following extension tool? 

    https://visualstudiogallery.msdn.microsoft.com/20cd93a2-c435-4d00-a797-499f16402378

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 23, 2016 7:46 AM
    Moderator