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

圆角阴影窗口有黑边 #364

Open
huycode opened this issue Nov 23, 2021 · 3 comments
Open

圆角阴影窗口有黑边 #364

huycode opened this issue Nov 23, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@huycode
Copy link

huycode commented Nov 23, 2021

问题现象

带阴影的窗口圆角是黑边,有没有好的解决办法啊?
——阴影图片已做了圆角,窗口属性roundcorner和顶层box的属性borderround都已经设置。
去掉阴影是可以圆角的,但是去掉阴影的圆角感觉有锯齿,不够圆滑,不像Windows11的窗口圆角那么圆滑。

1FD55200D637BD9BC3C6F429101C501B

预期结果

重现步骤

@huycode huycode changed the title 圆角阴影窗口 圆角阴影窗口有黑边 Nov 23, 2021
@nmgwddj
Copy link
Collaborator

nmgwddj commented Nov 25, 2021

这个要看下你使用的阴影方案是什么类型,是使用层窗口方式还是使用单独窗口阴影的方案。
圆角毛糙的问题的确存在,目前尚未安排计划来优化该问题,如果您有好的优化方案,欢迎发起 PR 一起帮大家优化。

@hurryerman
Copy link

hurryerman commented Dec 24, 2021

异形窗口可能可以达到你想要的效果:
CString strPathImg = _T("c:\1.bmp");
HBITMAP hBitmap = NULL;
Gdiplus::Bitmap* image = new Gdiplus::Bitmap(strPathImg);
if (NULL != image)
{
image->GetHBITMAP(NULL, &hBitmap);

        if (NULL != hBitmap)
        {
            HRGN hRgn = BitmapToRegion(hBitmap, RGB(245, 245, 245), RGB(10, 10, 10));
            SetWindowRgn(m_hWnd, hRgn, TRUE);
        }

        delete image;

        DeleteObject(hBitmap);
    }

image

@nmgwddj nmgwddj added the bug Something isn't working label Feb 12, 2022
@chaome
Copy link

chaome commented Jun 13, 2022

这个问题出现的原因是因为AlphaFix的时候造成的,如图所示:
无标题

如果愿意修复,可以考虑下这样修复:
无标题2

但修复之后,需要注意在这个窗口区域内的alpha显示问题,注意不要在这个区域内显示文本,否则可能会是透明的。
无标题3

效果如下:
无标题3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants