异型窗体。。。。。。。。。。。。。。。。。。。。。。。。。。。。。急急急。。。。。。。。。。。。。。。。。。。

changkai 2004-03-31 02:43:52
想做异形窗体
SUISKIN的SUISKINFORM有这功能,可以随便选一张图片做窗体
但,窗体总是正正方方的,边角的地方去不掉

我的图片是BMP格式的
如果是用IMAGE显示的话,
STRETCH:=TRUE边角的地方就会没了

但SUISKINFORM没这属性,
怎么办????

各位有没好的建议
...全文
44 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
changkai 2004-03-31
  • 打赏
  • 举报
回复
还有其他方法吗?
changkai 2004-03-31
  • 打赏
  • 举报
回复
上面的函数我研究一下先
changkai 2004-03-31
  • 打赏
  • 举报
回复
自己再顶一下
stanely 2004-03-31
  • 打赏
  • 举报
回复
任何有twincontrol的子类都可以使用此函数,参数canvas是你需要的异形窗体的形状画布,你可以传入imageX.canvas;maskcolor就是你要抠去的点的颜色。
stanely 2004-03-31
  • 打赏
  • 举报
回复
不用控件,函数多好!

procedure DrawAnyShapeControl(ControlHandle:THandle;Canvas:TCanvas;MaskColor:TColor);
var
dc:hdc;
rgn:hrgn;
x,y,w,h:integer;
coord:tpoint;
line:boolean;
color:tcolor;
begin
dc:=getwindowdc(controlhandle);
beginpath(dc);
w:=canvas.cliprect.Right;
h:=canvas.ClipRect.Bottom;
for x:=0 to w-1 do
begin
line:=false;
for y:=0 to h-1 do
begin
color:=canvas.Pixels[x,y];
if color<>maskcolor then
begin
if not line then
begin
line:=true;
coord.X:=x;
coord.Y:=y;
end;
end;
if (color=maskcolor) or (y=h -1) then
begin
if line then
begin
line:=false;
movetoex(dc,coord.X,coord.Y,nil);
lineto(dc,coord.x,y);
lineto(dc,coord.x+1,y);
lineto(dc,coord.X+1,coord.Y);
closefigure(dc);
end;
end;
end;
end;

endpath(dc);
rgn:=pathtoregion(dc);
releasedc(controlhandle,dc);
//////////////////////
if rgn<>0 then
begin
setwindowrgn(controlhandle,rgn,true) ;
end;

end;
changkai 2004-03-31
  • 打赏
  • 举报
回复
最好不要用API,
有什么好的控件能直接用最好

5,391

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧