Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use DT_CALCRECT in func DrawTextEx2, the text will be drawed #6

Closed
steprun opened this issue Mar 1, 2018 · 3 comments
Closed

use DT_CALCRECT in func DrawTextEx2, the text will be drawed #6

steprun opened this issue Mar 1, 2018 · 3 comments

Comments

@steprun
Copy link

steprun commented Mar 1, 2018

I think DT_CALCRECT maybe only calculate the rect for the string. But in DrawTextEx2, the text will be drawed.

@VincentWei
Copy link
Owner

Really? Please show me the code.

@steprun
Copy link
Author

steprun commented Mar 7, 2018

if button dwStyle add BS_CENTER.
in paint_content_focus

/*draw focus frame*/
if (BUTTON_STATUS(pctrl) & BST_FOCUS)
{
    focus_rc = *prc_cont;

    if (!BUTTON_IS_PUSHBTN(pctrl) && 
        !(pctrl->dwStyle & BS_PUSHLIKE) && 
        is_get_fmt)
    {
        dt_fmt |= DT_CALCRECT;
        DrawText (hdc, pctrl->spCaption, -1, &focus_rc, dt_fmt);
    }

    if (!is_get_fg)
        fg_color = GetWindowElementAttr((HWND)pctrl, WE_FGC_THREED_BODY);
    win_rdr->draw_focus_frame(hdc, &focus_rc, fg_color);
}

Calculate text size format will add DT_CENTER

And in DrawTextEx2

If style have DT_CENTER, ctxt.only_extent = FALSE in while loop. And the text will be draw again.

@VincentWei
Copy link
Owner

This is a bug and have fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants