国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

全透明窗體(效果比較好)

2019-11-18 18:43:20
字體:
來源:轉載
供稿:網友
全透明窗體(效果比較好)
uses里加上ExtCtrls
PRocedure tform1.setformtransparent;
var
  I: Integer;
  FullRgn,
  ClientRgn,
  ControlRgn: THandle;
  Margin,
  MarginX,
  MarginY,
  X,
  Y: Integer;
  W,H,S :Integer;
  bX,bY :Integer;
  c     :TColor;
begin
  Margin := (Width - ClientWidth) div 2;
  FullRgn := CreateRectRgn(0, 0, Width, Height);
  MarginX := Margin;
  MarginY := Height - ClientHeight - Margin;
  ClientRgn := CreateRectRgn(MarginX, MarginY, MarginX + ClientWidth, MarginY + ClientHeight);
  CombineRgn(FullRgn, FullRgn, ClientRgn, RGN_DIFF);
  DeleteObject(ClientRgn);
  for I:=0 to ControlCount-1 do
  begin
    X := MarginX + Controls[I].Left;
    Y := MarginY + Controls[I].Top;
    W:=Controls[I].Width;
    H:=Controls[I].Height;
{}
    if controls[i] is timage then begin
      with controls[i] as tImage do begin
        c:=Picture.Bitmap.Canvas.Pixels[0,0];
        for bX:=0 to Picture.Bitmap.Width-1 do begin
          for bY:=0 to Picture.Bitmap.Height-1 do begin
            if Picture.Bitmap.Canvas.Pixels[bX,bY]<>c then begin
              ControlRgn := CreateRectRgn(X+bX, Y+bY, X + bX+1, Y + bY+1);
              CombineRgn(FullRgn, FullRgn, ControlRgn, RGN_OR);
              DeleteObject(ControlRgn);
            end;
          end;
        end;
      end;
    end else
{}
    if controls[i] is tShape then begin
      if W < H then S := W else S := H;
      if (Controls[i] as tshape).Shape in [stSquare, stRoundSquare, stCircle] then
      begin
        Inc(X, (W - S) div 2);
        Inc(Y, (H - S) div 2);
        W := S;
        H := S;
      end;
      Inc(W); Inc(H); Inc(S);
      case (controls[i] as tshape).Shape of
        stRectangle, stSquare:
          ControlRgn := CreateRectRgn(X, Y, X + W, Y + H);
        stRoundRect, stRoundSquare:
          ControlRgn := CreateRoundRectRgn(X, Y, X + W, Y + H, S div 4, S div 4);
        stCircle, stEllipse:
          ControlRgn:=CreateEllipticRgn(X, Y, X + W, Y + H);
      else
        ControlRgn := CreateRectRgn(X, Y, X + W, Y + H);
      end;
      CombineRgn(FullRgn, FullRgn, ControlRgn, RGN_OR);
      DeleteObject(ControlRgn);
    end else
{}
    begin
      ControlRgn := CreateRectRgn(X, Y, X + W, Y + H);
      CombineRgn(FullRgn, FullRgn, ControlRgn, RGN_OR);
      DeleteObject(ControlRgn);
    end;
  end;
  SetWindowRgn(Handle, FullRgn, True);
  DeleteObject(FullRgn);
end;

procedure TForm1.FormResize(Sender: TObject);
begin
        setformtransparent;
end;

//rock
//轉載請保留此信息


上一篇:一個從EXE、DLL文件中提取、存取圖標完整程序

下一篇:如何控制其他程序窗體上的窗口控件:中

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
學習交流
熱門圖片

新聞熱點

疑難解答

圖片精選

網友關注

主站蜘蛛池模板: 慈利县| 大港区| 玉门市| 兴仁县| 申扎县| 吉木萨尔县| 顺平县| 巴南区| 板桥市| 沙坪坝区| 姚安县| 寻甸| 徐汇区| 文安县| 中卫市| 巧家县| 寿宁县| 广宗县| 晋江市| 舟山市| 屏东县| 含山县| 油尖旺区| 汝州市| 丽江市| 独山县| 廊坊市| 邢台市| 梓潼县| 犍为县| 凯里市| 金川县| 湘潭县| 西宁市| 威信县| 敦化市| 六枝特区| 台中市| 石林| 缙云县| 民县|