windows API函数编程实现异形窗口问题
时间:2011-12-16
来源:互联网
求指导异形窗口的实现,用windows API函数编程,不要C++的。
异形区域,我老是画不出来~~
异形区域,我老是画不出来~~
作者: s58420411 发布时间: 2011-12-16
我按照搜到的资料,做了一个,只能实现无边框,无标题,并不能实现不规则的窗体~~以下是个人做的WM_CREATE消息部分,得到的区域还是四方的,不是按照window.bmp内德图片轮廓的区域,什么地方不对,求指导。
//window.bmp背景是白色的
...
case WM_CREATE:
dwStyle=GetWindowLong(hwnd,GWL_STYLE);
dwStyle=WS_CHILD;
SetWindowLong(hwnd,GWL_STYLE,dwStyle);
hpicture=(HBITMAP)LoadImage(hInstance,
"window.bmp",
IMAGE_BITMAP,
cxClient,//客户坐标
cyClient,//same
LR_LOADFROMFILE|LR_LOADTRANSPARENT);
GetObject(hpicture,sizeof(BITMAP),&picture);
hmedc=CreateCompatibleDC(hdc);
SelectObject(hmedc,&hpicture);
hrgnpicture=CreateRectRgn(0,0,picture.bmWidth,picture.bmHeight);
for(x=0;x<=picture.bmWidth;x++)
for(y=0;y<=picture.bmHeight;y++)
{
pixelcolor=GetPixel(hmedc,x,y);
if(pixelcolor==backgroundcr)//backgroundcr=RGB(255,255,255)
{
hsmall=CreateRectRgn(x,y,x+1,y+1);
CombineRgn(hrgnpicture,hrgnpicture,hsmall,RGN_XOR);
DeleteObject(hsmall);
}
}
SelectObject(hmedc,&hpicture);
SetWindowRgn(hwnd,hrgnpicture,TRUE);//完成异形区域?!
DeleteDC(hmedc);
DeleteObject(hpicture);
...
//window.bmp背景是白色的
...
case WM_CREATE:
dwStyle=GetWindowLong(hwnd,GWL_STYLE);
dwStyle=WS_CHILD;
SetWindowLong(hwnd,GWL_STYLE,dwStyle);
hpicture=(HBITMAP)LoadImage(hInstance,
"window.bmp",
IMAGE_BITMAP,
cxClient,//客户坐标
cyClient,//same
LR_LOADFROMFILE|LR_LOADTRANSPARENT);
GetObject(hpicture,sizeof(BITMAP),&picture);
hmedc=CreateCompatibleDC(hdc);
SelectObject(hmedc,&hpicture);
hrgnpicture=CreateRectRgn(0,0,picture.bmWidth,picture.bmHeight);
for(x=0;x<=picture.bmWidth;x++)
for(y=0;y<=picture.bmHeight;y++)
{
pixelcolor=GetPixel(hmedc,x,y);
if(pixelcolor==backgroundcr)//backgroundcr=RGB(255,255,255)
{
hsmall=CreateRectRgn(x,y,x+1,y+1);
CombineRgn(hrgnpicture,hrgnpicture,hsmall,RGN_XOR);
DeleteObject(hsmall);
}
}
SelectObject(hmedc,&hpicture);
SetWindowRgn(hwnd,hrgnpicture,TRUE);//完成异形区域?!
DeleteDC(hmedc);
DeleteObject(hpicture);
...
作者: s58420411 发布时间: 2011-12-16
mark,同等解答.....
作者: mdbsdn 发布时间: 2011-12-16
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28