国产探花免费观看_亚洲丰满少妇自慰呻吟_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文件中提取、存取圖標完整程序

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

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

新聞熱點

疑難解答

圖片精選

網友關注

主站蜘蛛池模板: 禄劝| 姜堰市| 古田县| 屏东县| 元氏县| 巍山| 庆城县| 博罗县| 景宁| 柳江县| 伊金霍洛旗| 汤阴县| 巍山| 灵川县| 嵊州市| 仙居县| 绥滨县| 东海县| 兴隆县| 行唐县| 萨嘎县| 板桥市| 南皮县| 闻喜县| 广平县| 满洲里市| 定边县| 盐城市| 伊金霍洛旗| 明星| 华坪县| 布尔津县| 天门市| 安仁县| 浮梁县| 城固县| 沙洋县| 西丰县| 东源县| 宁强县| 双鸭山市|