从TSpeedButton中删除闪烁

时间:2018-05-28 13:16:35

标签: delphi

重现的步骤:

  1. TPanel添加到新的VCL表单并设置Align = alClient
  2. TSpeedButton添加到面板,并将一些bmp图像分配给Glyph属性。 (可选但更清晰:Flat = True
  3. 运行应用程序,抓住表单的右下角并移动它。 TSpeedButton中的图片会闪烁。
  4. 我阅读了很多关于消除闪烁的内容,但这些建议似乎都不适用于TSpeedButton

    • 没有DoubleBuffered属性
    • WS_EX_COMPOSITED无法设置,因为它不是TWinControl而是TGraphicControl
    • WM_ERASEBKGND消息未收到

    如果它具有任何重要性,我实际上正在使用TPngSpeedButton,但由于实际问题在TSpeedButton内,我在示例中使用了它。< / p>

    有没有解决方案?

    编辑:由于某种原因,目前为止没有人能够重现这一点,所以为了确保它不是我的描述,这里是dfm:

    object Form1: TForm1
      Left = 0
      Top = 0
      Caption = 'Form1'
      ClientHeight = 337
      ClientWidth = 635
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      PixelsPerInch = 96
      TextHeight = 13
      object Panel1: TPanel
        Left = 0
        Top = 0
        Width = 635
        Height = 337
        Align = alClient
        Caption = 'Panel1'
        TabOrder = 0
        object SpeedButton1: TSpeedButton
          Left = 64
          Top = 56
          Width = 32
          Height = 32
          Flat = True
          Glyph.Data = {
            360C0000424D360C000000000000360000002800000020000000200000000100
            180000000000000C000000000000000000000000000000000000FFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FCC483FCC483FCC483F241CED241CED241CED241CED241CEDCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FCC483FCC483FCC483F241CED241CED241CED241CED241CEDCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FCC483FCC483FCC483F241CED241CED241CED241CED241CEDCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FCC483FCC483FCC483F241CED241CED241CED241CED241CEDCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FCC483FCC483FCC483F241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FFFFFFFFFFFFFFFFFFF241CED241CED241CED241CED241CED241C
            ED241CED241CED241CED241CED241CED241CED241CED241CED241CED241CED24
            1CED241CED241CED241CED241CED241CED241CED241CED241CEDCC483FCC483F
            CC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC483F
            CC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC483F
            CC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC483F
            CC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC483F
            CC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC483F
            CC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC483FCC483F
            CC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC483FCC48
            3FCC483FCC483FCC483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
        end
      end
    end
    

    And this is how it looks。实际上它的速度要快一些,但捕获的视频和gif转换速度会慢下来。

1 个答案:

答案 0 :(得分:9)

我实际上能够在Windows 7上使用Delphi 10.2.3 Tokyo重现它。 我经常遇到类似的问题,从那以后我一直在为所有TPanel及其后代使用这个设置,这也适用于这种情况。

Panel1.DoubleBuffered := True;
Panel1.ParentBackground := False;