关于屏幕的显示问题
下面这一小段代码,我本想实现在自己选择播放一部电影时,他就可以自动全盘播放选择的电影,并且只有中间的圆形区域显示,其他部分显示黑色。可是事与愿违,一旦执行圆形程序代码时,偶的背景就不是WindowsMediaPlayer所播放的内容了,而是桌面,我该怎么办,请赐教。
if(OpenDialog1->Execute())
{
Button1->Visible=false;
Form1->Left=0;
Form1->Top=0;
Form1->Width=GetSystemMetrics(SM_CXSCREEN);
Form1->Height=GetSystemMetrics(SM_CYSCREEN);
WindowsMediaPlayer1->URL=OpenDialog1->FileName;//这样可以自动全盘播放选择的电影
this->BorderStyle = bsNone;
this->Width = Screen->Width;
this->Height = Screen->Height;
this->FormStyle = fsStayOnTop;
this->Color = clBlack;
int step = (this->Width-this->Height)/2;
HRGN EllRect = CreateEllipticRgn(step,0,this->Height+step,this->Height);
HRGN Rect = CreateRectRgn(0,0,this->Width,this->Height);
CombineRgn(Rect,EllRect,Rect,RGN_XOR);
SetWindowRgn(this->Handle,Rect,TRUE);
}
[解决办法]
把SetWindowRgn(this->Handle,Rect,TRUE);改成WindowsMediaPlayer1的Canvas的Handle试试