高分寻:窗体透明的设置方法。 各位大虾:在delphi7中是否能设置Form的两个属性使得Form透明??谢了!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 No body know this??????????????????????????????????????????????????Help me please!!!!!!!!!!!!!!!!1 Delphi中可以这样做: procedure TForm1.FormCreate(Sender: TObject); begin Brush.Style := bsClear; BorderStyle := bsNone end; 好像有一种方法 在Form中有一个属性要设定为True???各位知道吗???? TransParentColorTransParentColorValue form的borderStyle设为bsNone;在窗体启动创建事件中写 self.Brush.Style :=bsClear;D5中通过,D7没试过,应该没问题 alphablend属性alphablendvalue设置范围0~255之间不过注意这样设置以后窗体上的控件也跟着透明 ..... public procedure CreateParams(var Params: TCreateParams); override; { Public declarations }......procedure TForm1.CreateParams(var Params: TCreateParams);begin inherited CreateParams(Params); Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;end; 你可以用alphablend函数用代码写 你可以设置窗体的TransparentColor属性为True,同时将TransparentColorValue设置成你目前窗体的颜色,它的功能就是将当前为TransparentColorValue的颜色透明。但这个属性只在Win2000或者以上版本好使,在win98下不好使:( 可以,但只在WIN2000以上有效.WIN98下无效. 我知道有三种方法,第一种: Color :=clWhite; TransparentColor :=True; TransparentColorValue :=clWhite;第二种: procedure CreateParams(var Params: TCreateParams); override; procedure TForm1.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT; end;第三种: AlphaBlendValue :=0; AlphaBlend :=True; 代码是vc写的也许你有用BOOL CALLBACK EnumChildFunc(HWND hwnd, LPARAM lParam){ CRgn *pRgn = (CRgn*)lParam; CRect rcChild; ::GetWindowRect(hwnd, rcChild); CRgn rgnChild; CRgn rgnCopy; rgnCopy.CreateRectRgn(0, 0, 1, 1); rgnCopy.CopyRgn(pRgn); rgnChild.CreateRectRgn(rcChild.left, rcChild.top, rcChild.right, rcChild.bottom); pRgn->CombineRgn(&rgnCopy, &rgnChild, RGN_OR); return TRUE;}int SetBackTransparent(CWnd *pWnd, BOOL bClientOnly = TRUE){ CRgn rgn; if(bClientOnly) { CRgn rgnWindow, rgnClient; CRect rcWindow, rcClient, rcRgn; pWnd->GetWindowRect(rcWindow); pWnd->GetClientRect(rcClient); pWnd->ClientToScreen(rcClient); rgnWindow.CreateRectRgn(rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom); rgnClient.CreateRectRgn(rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); rgn.CreateRectRgn(0, 0, 1, 1); rgn.CombineRgn(&rgnWindow, &rgnClient, RGN_DIFF); } else { rgn.CreateRectRgn(0, 0, 0, 0); } ::EnumChildWindows(pWnd->GetSafeHwnd(), (WNDENUMPROC)EnumChildFunc,(LPARAM)&rgn); return pWnd->SetWindowRgn(rgn, TRUE);}调用办法:在CYourDialog::OnInitDialog里加上SetBackTransparent(this);如果要连非客户区都透明,用SetBackTransparent(this, FALSE); 新手提问,关于数据库的一个语句错误 共享修改问题 如何计算两日期的天数差,在线等待。 怎么样才能使 richedit 透明? 100 分 为什么是死循环? 麻烦大家帮我看看! Query1.sql.add('??????????');要添加控件的属性怎么办?? 如何给adostoreprocedure的参数类型为timestamp的参数赋值? 哪位朋友有过用Delphi处理Excel2000文件的经验? 如何读出TWebbrowser中的INPUT框里的内容? (包括滚动文本框和下拉框) 连接数据出现错误 能否在宏中判断一台电脑上是否安装了摄像头? 怎样把FORM上的东西居中呢?
procedure TForm1.FormCreate(Sender: TObject);
begin
Brush.Style := bsClear;
BorderStyle := bsNone
end;
各位知道吗????
TransParentColorValue
在窗体启动创建事件中写 self.Brush.Style :=bsClear;D5中通过,D7没试过,应该没问题
.....
public
procedure CreateParams(var Params: TCreateParams); override;
{ Public declarations }
......procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;
end;
Color :=clWhite;
TransparentColor :=True;
TransparentColorValue :=clWhite;
第二种:
procedure CreateParams(var Params: TCreateParams); override; procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;
end;
第三种:
AlphaBlendValue :=0;
AlphaBlend :=True;
{
CRgn *pRgn = (CRgn*)lParam;
CRect rcChild;
::GetWindowRect(hwnd, rcChild);
CRgn rgnChild;
CRgn rgnCopy;
rgnCopy.CreateRectRgn(0, 0, 1, 1);
rgnCopy.CopyRgn(pRgn);
rgnChild.CreateRectRgn(rcChild.left, rcChild.top,
rcChild.right, rcChild.bottom);
pRgn->CombineRgn(&rgnCopy, &rgnChild, RGN_OR);
return TRUE;
}int SetBackTransparent(CWnd *pWnd, BOOL bClientOnly = TRUE)
{
CRgn rgn;
if(bClientOnly)
{
CRgn rgnWindow, rgnClient;
CRect rcWindow, rcClient, rcRgn;
pWnd->GetWindowRect(rcWindow);
pWnd->GetClientRect(rcClient);
pWnd->ClientToScreen(rcClient);
rgnWindow.CreateRectRgn(rcWindow.left, rcWindow.top,
rcWindow.right, rcWindow.bottom);
rgnClient.CreateRectRgn(rcClient.left, rcClient.top,
rcClient.right, rcClient.bottom);
rgn.CreateRectRgn(0, 0, 1, 1);
rgn.CombineRgn(&rgnWindow, &rgnClient, RGN_DIFF);
}
else
{
rgn.CreateRectRgn(0, 0, 0, 0);
}
::EnumChildWindows(pWnd->GetSafeHwnd(), (WNDENUMPROC)EnumChildFunc,(LPARAM)&rgn);
return pWnd->SetWindowRgn(rgn, TRUE);
}
调用办法:
在CYourDialog::OnInitDialog里加上
SetBackTransparent(this);
如果要连非客户区都透明,用
SetBackTransparent(this, FALSE);