首页 > 解决方案 > 在表格/图像上快速绘图时如何消除闪烁效果?

问题描述

每当我在表单/图像上绘图或更改元素(例如按钮)的位置时,表单会短暂闪烁,然后正确显示。这个错误发生在我制作的所有应用程序中,我还没有找到解决方案。

闪烁的错误

任何事情都会Button1.Left=100导致Form1.Canvas.Ellipse(10,10,40,40)这种效果发生。

我认为这与表格重新计算要显示的内容有关吗?

例子:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Imaging.GIFImg;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
Image1.Left:=Image1.Left+1;
end;

end.

这是一个简单的例子。当图像由于某种原因移动时,它会闪烁

标签: formsdelphi

解决方案


推荐阅读