想做异形窗体
SUISKIN的SUISKINFORM有这功能,可以随便选一张图片做窗体
但,窗体总是正正方方的,边角的地方去不掉我的图片是BMP格式的
如果是用IMAGE显示的话,
STRETCH:=TRUE边角的地方就会没了但SUISKINFORM没这属性,
怎么办????各位有没好的建议

解决方案 »

  1.   

    最好不要用API,
    有什么好的控件能直接用最好
      

  2.   

    不用控件,函数多好!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;
      

  3.   

    任何有twincontrol的子类都可以使用此函数,参数canvas是你需要的异形窗体的形状画布,你可以传入imageX.canvas;maskcolor就是你要抠去的点的颜色。