• 界面方面的备忘


    1. 透明panel

    unit uWnTransparentPanel;

    interface

    uses
      Windows,Classes,StdCtrls,ExtCtrls,Messages,Forms;

    type
      TWnTransparentPanel = class(TPanel)
      private
        FTransparentPercent: Integer;
        procedure SetTransparentPercent(const Value: Integer);
      protected
        procedure WMPaint(var message : TMessage); message WM_Paint;
      public
        procedure StepShow(const ALeft,ATop,HStet,VStep:Integer);
      published
        property TransparentPercent: Integer read FTransparentPercent write SetTransparentPercent;
      end;

    implementation

    { TWnTransparentPanel }

    procedure TWnTransparentPanel.SetTransparentPercent(const Value: Integer);
    begin
      FTransparentPercent := Value;
    end;

    procedure TWnTransparentPanel.StepShow(const ALeft, ATop,HStet, VStep: Integer);
    var
      I: Integer;
    begin
      Visible := True;
      Left := ALeft;
      Top := ATop+VStep*10  ;
      for I := 0 to 9 do
      begin
        Top := ATop +(9-I)*VStep;
        Self.Parent.Update;
        Self.Repaint;
        Sleep(100);
        Application.HandleMessage;
      end;
    end;

    procedure TWnTransparentPanel.WMPaint(var message: TMessage);
      procedure AlphaBlendTabControl;
      var
      MemBitmap, OldBitmap: HBITMAP;
      BF: BLENDFUNCTION;
      MemDC, DC: HDC;
      begin
        if (Parent = nilor not Parent.HandleAllocated then
        Exit;
        DC := GetDC(0);
        MemBitmap := CreateCompatibleBitmap(DC, Parent.Width, Parent.Height);
        ReleaseDC(0, DC);
        MemDC := CreateCompatibleDC(0);
        OldBitmap := SelectObject(MemDC, MemBitmap);
        try
          Parent.Perform(WM_ERASEBKGND, MemDC, MemDC);
          Parent.Perform(WM_PAINT, MemDC, 0);

          BF.SourceConstantAlpha := TransparentPercent;
          BF.AlphaFormat := 0;
          BF.BlendOp := AC_SRC_OVER;
          BF.BlendFlags := 0;
          Windows.AlphaBlend(Canvas.Handle, 00, Width, Height, MemDC, Left, Top, Width, Height, BF);
        finally
          SelectObject(MemDC, OldBitmap);
          DeleteDC(MemDC);
          DeleteObject(MemBitmap);
        end;
      end;
    begin
      inherited;
      AlphaBlendTabControl;
    end;

    end.

    2. 设计的时候,panel可以用Anchors = [akLeft, akTop, akRight, akBottom] 加上Align = alCustom达到自动预留边框的目的,就可以避免panel用Align = alClient的时候panel贴边的问题

    3. Grid载入数据的时候界面频刷的问题,主要是要Grid paint之初就要设定好高宽,而不是边画边设高宽

  • 相关阅读:
    Java AJAX开发系列 5,ZK参考资料
    现代浏览器客户端Web开发 Project Silk
    Java AJAX开发系列 2,项目中使用ZK
    Java性能分析点滴
    Java AJAX开发系列 4,ZK应用实例
    Java AJAX开发系列 3, ZK MVC
    大型网站如何架构 网页资料集
    Google Analytics 进行网站流量分析
    ALM TFS/VSTS工具 的Java集成
    系统各层关注的内容【DDDD笔记】
  • 原文地址:https://www.cnblogs.com/enli/p/2241087.html
Copyright © 2020-2023  润新知