zoukankan      html  css  js  c++  java
  • VCL控件透明

    代码
      TestPanel = class(Tpanel)
      
    public
        procedure Paint; 
    override;
      end;
      
     procedure TestPanel.Paint;
    var
      R: TRect;
    begin
      inherited;
      R :
    = ClientRect;
      DrawParentBackground(Self, Canvas.Handle, @R, True);  
    //透明 不透明则  DrawParentBackground(Self, Canvas.Handle)
    end;

    procedure DrawParentBackground(Control: TControl; DC: HDC; R: PRect 
    = nil;
      bDrawErasebkgnd: Boolean 
    = False);
    var
      LastOrigin: TPoint;
    begin
      GetWindowOrgEx(DC, LastOrigin);
      Control.Parent.Perform(WM_ERASEBKGND, Integer(DC), Integer(DC));
      Control.Parent.Perform(WM_PAINT, Integer(DC), Integer(DC));
      SetWindowOrgEx(DC, LastOrigin.X, LastOrigin.Y, nil);
    end;


    // 测试DEMO
    procedure TForm1.Button1Click(Sender: TObject);
    var
      T1: TestPanel;
    begin
      T1 :
    = TestPanel.Create(Self);
      T1.Left :
    = 100;
      T1.Caption :
    = 'dd';
      T1.Parent :
    = Self;
    end;
  • 相关阅读:
    CodeForces
    CodeForces
    sort自定义cmp函数
    The 2015 China Collegiate Programming Contest Sudoku
    G
    docker
    在容器内获取Pod信息(Downward API)
    k8s Pod定义详解
    Pod和容器的生命周期管理
    GoAccess日志分析工具
  • 原文地址:https://www.cnblogs.com/chengxin1982/p/1648675.html
Copyright © 2011-2022 走看看