• delphi 控件背景透明代码


    procedure DrawParentBackground(Control: TControl; DC: HDC; R: PRect = nil; bDrawErasebkgnd: Boolean = False);
    var
      SaveIndex: Integer;
      MemDC: HDC;
      MemBmp: HBITMAP;
    begin
      if R <> nil then
      begin
        MemDC := CreateCompatibleDC(DC);
        MemBmp := CreateCompatibleBitmap(DC, Control.Width, Control.Height);
        SelectObject(MemDC, MemBmp);
        try
          with Control.BoundsRect.TopLeft do
            SetWindowOrgEx(MemDC, X, Y, nil);
          if bDrawErasebkgnd then
            Control.Parent.Perform(WM_ERASEBKGND, Integer(MemDC), Integer(MemDC));
          Control.Parent.Perform(WM_PAINT, Integer(MemDC), Integer(MemDC));
          with Control.BoundsRect.TopLeft do
            BitBlt(DC, R^.Left, R^.Top, R^.Right - R^.Left, R^.Bottom - R^.Top, MemDC, X + R^.Left, Y + R^.Top, SRCCOPY);
        finally
          DeleteObject(MemBmp);
          DeleteDC(MemDC);
        end;
        Exit;
      end;
      SaveIndex := SaveDC(DC);
      try
        with Control.BoundsRect.TopLeft do
          SetWindowOrgEx(DC, X, Y, nil);
        if bDrawErasebkgnd then
          Control.Parent.Perform(WM_ERASEBKGND, Integer(DC), Integer(DC));
        Control.Parent.Perform(WM_PAINT, Integer(DC), Integer(DC));
      finally
        RestoreDC(DC, SaveIndex);
      end;
    end;
  • 相关阅读:
    Django集成CAS
    JAVA命名规范
    Mybatis(5)——动态SQL
    Mybatis(4)——ResultMap
    Mybatis(3)——参数处理
    Mybatis(2)——Mapper映射文件
    Mybatis(1)——配置文件
    Gson(http://www.jianshu.com/p/e740196225a4)
    Gson中fromJson方法
    SessionAttributes和ModelAttribute
  • 原文地址:https://www.cnblogs.com/blogpro/p/11339119.html
Copyright © 2020-2023  润新知