C 从对话框圆角中删除像素

c++ remove pixels from dialog round corners

本文关键字:删除 像素 圆角 对话框      更新时间:2023-10-16

我想删除一些在圆角的对话框窗口中可见的像素,我在C

中找不到任何解决方案

这是我使用的代码,就我搜索而言,我认为我需要使用updateLayeredWindow函数,而不是WS_EX_LAYERED窗口中的SetLayereredWindowAttributes,但我找不到方法。

>

有人知道如何从对话框的圆角上删除此像素吗?

代码:

INT_PTR CALLBACK WinProc(HWND hh,UINT mm,WPARAM ww,LPARAM)
    {
    HWND hX = GetDlgItem(hh,123);
    switch(mm)
        {
        case WM_INITDIALOG:
            {
            // No Dialog Title Bar 
            SetWindowLong(hh, GWL_STYLE, 0); // With no border around the window 
            // Transparent Dialog In Selected Color
            LONG ExtendedStyle = GetWindowLong(hh, GWL_EXSTYLE);
            SetWindowLong(hh, GWL_EXSTYLE, ExtendedStyle | WS_EX_LAYERED);
            SetLayeredWindowAttributes(hh, RGB(255, 128, 255), 0, LWA_COLORKEY);
            //UpdateLayeredWindow(hh, NULL, NULL, NULL, NULL, NULL, RGB(255, 128, 255), 0, ULW_COLORKEY);
            // Load the swf from our resources, extract first to temp path
            TCHAR dx[1000] = {0};
            GetTempPath(1000,dx);
            TCHAR df[1000] = {0};
            GetTempFileName(dx,L"swf",0,df);
            DeleteFile(df);
            wcscat_s(df,1000,L".swf");
            DeleteFile(df);
            ExtractDefaultFile(df,L"flash",0,0,L"data");
            SendMessage(hX,AX_INPLACE,1,0);
            SendMessage(hh,WM_SIZE,0,0);
            // Set the object
            IShockwaveFlash* p = 0;
            CLSID iidx = __uuidof(IShockwaveFlash);
            HRESULT hr = (HRESULT)SendMessage(hX,AX_QUERYINTERFACE,(WPARAM)&iidx,(LPARAM)&p);
            if (p)
                {
                _bstr_t x(df);
                hr = p->put_WMode(L"transparent");
                hr = p->put_BackgroundColor(RGB(255,128,255));
                hr = p->put_Movie(x);
                // Notification
                AX* iax = (AX*)SendMessage(hX,AX_GETAXINTERFACE,0,0);
                if (iax)
                    {
                    axCookie = AXConnectObject(iax->OleObject,__uuidof(_IShockwaveFlashEvents),(IUnknown*)&fn,&cpc,&cp);
                    }

                p->Release();
                }
            break;
            }
        case WM_SIZE:
            {
            RECT rc;
            GetClientRect(hh,&rc);
            SetWindowPos(hX,0,0,0,rc.right,rc.bottom,SWP_SHOWWINDOW);
            return 0;
            }
        case WM_CLOSE:
            {
            EndDialog(hh,0);
            return 0;
            }
        }
    return 0;
    }
int __stdcall WinMain( HINSTANCE hInstance,HINSTANCE,LPSTR,int)
    {
    OleInitialize(0);
    AXRegister();
    DialogBox(hInstance,L"DIALOG_MAIN",0,WinProc);
    return 0;
    }

我正在使用RGB的颜色(255、128、255),该颜色在闪光灯内不使用,否则它也从闪光灯播放器内部擦除了颜色。

预先感谢

  1. 创建一个win32功能的区域。即CreateLipticRegion,CreatectRgn ...
  2. 您必须使用setWindowRgn。

这是纯Win32讨论的链接。在这里,指向MFC样本的链接。将其转移到Winapi Pure

应该很容易