5

我正在开发一个大型 delphi 应用程序,其中包含大量正在转换为 xe2 的遗留代码。我正在实现 vcl 样式,并且在大多数情况下没有问题。

但是,在某些表单上,特别是在我有一个 tpanel 的地方,上面有一个页面控件和标签页,标签页有时无法正确绘制。它们显示标签页所在区域之前的任何图像。因此,当表单首次显示时,它将是我计算机上的背景屏幕,但如果我更改选项卡,选项卡背景/标签/组件似乎会重叠。

这仅在我使用 vcl 样式时发生,如果我不应用该样式,一切似乎都正常显示。

它仅出现在某些选项卡上。我试图隔离可能导致此问题的特定属性或方法调用(或缺少它),但我真的很挣扎,特别是考虑到此代码中调用的方法的纯大小(在某些形式下,触发的方法选项卡上的更改超过 1000 行代码)。

我去拍摄一些屏幕截图来演示这种情况,但屏幕截图上的表单都正确呈现。这向我表明,我所看到的与实际“那里”之间存在某种脱节。

任何建议将不胜感激。

4

2 回答 2

2

也许您应该使用Vcl Styles Utils来纠正 delphi 中的许多样式错误。如果我没记错的话,TTabSheets 的绘制默认是不正确的——除非你把它放到 TPanel/etc 中。

于 2015-04-13T22:30:31.257 回答
0

我能够在 Windows XP PC 上重现我认为相同的问题,
Windows 8.1 似乎可以在相同的 exe 上正常工作

我正在运行 Delphi XE 5

启动新的 VCL 表单应用程序

将以下代码复制到剪贴板

单击新项目中的主窗体并粘贴

然后转到项目>选项>应用程序>外观>“选择任何样式,例如Luna”

运行项目,选项卡“ts3”的背景是之前的任何内容。

按照上面 Elissa 的建议,在面板上将 DoubleBuffered 设置为 true 确实使它打印得更好

还将 DBEdit15、DBEdit16 和 DBEdit18 设置为可见 false 使其打印效果更好 - 但我无法确定原因

object pgc1: TPageControl
  Left = 0
  Top = 0
  Width = 635
  Height = 299
  ActivePage = ts3
  Align = alClient
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  ParentFont = False
  TabOrder = 0
  object ts3: TTabSheet
    Caption = 'ts3'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    ImageIndex = 2
    ParentFont = False
    object pTotals: TPanel
      Left = 3
      Top = 36
      Width = 486
      Height = 237
      BevelOuter = bvNone
      DoubleBuffered = False
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentDoubleBuffered = False
      ParentFont = False
      TabOrder = 0
      object Label19: TLabel
        Left = 3
        Top = -4
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object Label21: TLabel
        Left = 3
        Top = 59
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object Label22: TLabel
        Left = 3
        Top = 115
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object Label23: TLabel
        Left = 3
        Top = 167
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label24: TLabel
        Left = 233
        Top = 216
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
        Visible = False
      end
      object Label29: TLabel
        Left = 343
        Top = 145
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object Label30: TLabel
        Left = 343
        Top = 165
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object Label48: TLabel
        Left = 3
        Top = 21
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object Label53: TLabel
        Left = 319
        Top = 91
        Width = 8
        Height = 13
        Caption = 'llll'
      end
      object Label54: TLabel
        Left = 3
        Top = 139
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object Label64: TLabel
        Left = 343
        Top = 185
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object lbCons: TLabel
        Left = 3
        Top = 81
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
        Visible = False
      end
      object lPeriod_1: TLabel
        Left = 343
        Top = -4
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object lPeriod_2: TLabel
        Left = 343
        Top = 16
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object lPeriod_3: TLabel
        Left = 343
        Top = 39
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object lPeriod_4: TLabel
        Left = 343
        Top = 60
        Width = 8
        Height = 13
        Alignment = taRightJustify
        Caption = 'llll'
      end
      object btnPayHist: TButton
        Left = 15
        Top = 200
        Width = 121
        Height = 25
        Caption = 'btn'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
        TabOrder = 0
      end
      object btnRefreshTotals: TBitBtn
        Left = 355
        Top = 112
        Width = 121
        Height = 25
        Caption = 'btn'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
        ParentShowHint = False
        ShowHint = True
        TabOrder = 1
      end
      object DBEdit13: TDBEdit
        Left = 23
        Top = 0
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ParentShowHint = False
        ReadOnly = True
        ShowHint = False
        TabOrder = 2
      end
      object DBEdit14: TDBEdit
        Left = 23
        Top = 25
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ParentShowHint = False
        ReadOnly = True
        ShowHint = False
        TabOrder = 3
      end
      object DBEdit15: TDBEdit
        Left = 23
        Top = 119
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 4
      end
      object DBEdit16: TDBEdit
        Left = 23
        Top = 171
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 5
      end
      object DBEdit17: TDBEdit
        Left = 249
        Top = 213
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        DataField = 'Last_Statement'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 6
        Visible = False
      end
      object DBEdit18: TDBEdit
        Left = 23
        Top = 143
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 7
      end
      object DBEdit19: TDBEdit
        Left = 23
        Top = 63
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 8
      end
      object DBEdit20: TDBEdit
        Left = 23
        Top = 87
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 9
        Visible = False
      end
      object DBEdit21: TDBEdit
        Left = 363
        Top = 0
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 10
      end
      object DBEdit22: TDBEdit
        Left = 357
        Top = 16
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 11
      end
      object DBEdit23: TDBEdit
        Left = 363
        Top = 43
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 12
      end
      object DBEdit24: TDBEdit
        Left = 363
        Top = 64
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 13
      end
      object DBEdit25: TDBEdit
        Left = 363
        Top = 150
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 14
      end
      object DBEdit26: TDBEdit
        Left = 363
        Top = 170
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 15
      end
      object DBEdit27: TDBEdit
        Left = 355
        Top = 182
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 16
      end
      object DBEdit28: TDBEdit
        Left = 363
        Top = 96
        Width = 121
        Height = 21
        TabStop = False
        Color = clBtnFace
        Ctl3D = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clBlack
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentCtl3D = False
        ParentFont = False
        ReadOnly = True
        TabOrder = 17
      end
    end
    object Panel2: TPanel
      Left = 0
      Top = 0
      Width = 627
      Height = 30
      Align = alTop
      BevelOuter = bvNone
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      TabOrder = 1
      object pDisp2: TPanel
        Left = 69
        Top = 4
        Width = 473
        Height = 21
        BevelOuter = bvNone
        Caption = 'pDisp2'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
        TabOrder = 0
        object Label18: TLabel
          Left = 1
          Top = 4
          Width = 8
          Height = 13
          Caption = 'llll'
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -11
          Font.Name = 'Tahoma'
          Font.Style = []
          ParentFont = False
        end
        object DBEdit29: TDBEdit
          Left = 51
          Top = 0
          Width = 421
          Height = 21
          TabStop = False
          Color = clBtnFace
          Ctl3D = True
          DataField = 'Name'
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -11
          Font.Name = 'MS Sans Serif'
          Font.Style = []
          ParentCtl3D = False
          ParentFont = False
          ReadOnly = True
          TabOrder = 0
        end
      end
    end
  end
  object ts1: TTabSheet
    Caption = 'ts1'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    object shp1: TShape
      Left = 48
      Top = 32
      Width = 521
      Height = 201
    end
    object Shape1: TShape
      Left = 120
      Top = 104
      Width = 377
      Height = 81
    end
  end
end
于 2015-04-20T07:41:40.153 回答