我想删除一些在圆角的对话框窗口中可见的像素,我无法在c ++中找到任何解决方案
这是我使用的代码,就我搜索而言,我认为我需要在WS_EX_LAYERED窗口中使用UpdateLayeredWindow函数而不是SetLayeredWindowAttributes,但我无法找到实现它的方法。
有谁知道如何从对话框的圆角中删除这些像素?
代码:
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)的颜色,它不是在闪光灯内部使用的颜色,否则它也会擦除闪光灯播放器内部的颜色。
提前致谢