非可视组件可以对控件进行分组,以便可以使用对齐方式?

问题描述

我什至都不知道该如何放置...我想水平和垂直对齐控件。我有3个控件垂直对齐(顶部,客户端,底部),该组我想使其水平向左对齐,而另一个相同的组向右对齐。现在,我使用TPanel对这3个控件进行分组,但这在重新绘制控件时会引起闪烁(先在控件上绘制面板,然后再在控件上绘制面板)。有没有一种方法可以将控件与无显示内容分组,所以我可以使用对齐方式?

enter image description here

只需将这些控件放在窗体上,就不需要代码。或使用此.dfm。然后运行程序并最小化窗口。恢复窗口时,有时但并非总是如此,在绘制控件之前,它会闪烁一些黑色背景...

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 388
  ClientWidth = 623
  Color = clBtnFace
  DoubleBuffered = True
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -15
  Font.Name = 'Tahoma'
  Font.Style = []
  Menu = MainMenu1
  OldCreateOrder = False
  Position = poScreenCenter
  PixelsPerInch = 134
  TextHeight = 18
  object GroupPanel1: TPanel
    Left = 0
    Top = 0
    Width = 623
    Height = 388
    Align = alClient
    UseDockManager = False
    ParentBackground = False
    TabOrder = 0
    ExplicitLeft = 232
    ExplicitTop = 200
    ExplicitWidth = 100
    ExplicitHeight = 41
    object Splitter1: TSplitter
      Left = 313
      Top = 0
      Height = 388
      ExplicitLeft = 376
      ExplicitTop = 208
      ExplicitHeight = 100
    end
    object LeftPanel: TPanel
      Left = 0
      Top = 0
      Width = 313
      Height = 388
      Align = alLeft
      UseDockManager = False
      ParentBackground = False
      TabOrder = 0
      ExplicitHeight = 464
      object Memo1: TMemo
        Left = 0
        Top = 41
        Width = 313
        Height = 328
        Align = alClient
        Lines.Strings = (
          'Memo1')
        TabOrder = 0
        ExplicitLeft = -3
        ExplicitTop = 42
        ExplicitHeight = 343
      end
      object StatusBar1: TStatusBar
        Left = 0
        Top = 369
        Width = 313
        Height = 19
        Panels = <>
        SimplePanel = True
        SimpleText = 'StatusBar1'
        ExplicitLeft = 112
        ExplicitTop = 368
        ExplicitWidth = 0
      end
      object Panel1: TPanel
        Left = 0
        Top = 0
        Width = 313
        Height = 41
        Align = alTop
        TabOrder = 2
        ExplicitLeft = 32
        ExplicitTop = 8
        ExplicitWidth = 185
        object Button1: TButton
          Left = 8
          Top = 10
          Width = 75
          Height = 25
          Caption = 'Button1'
          TabOrder = 0
        end
        object Button2: TButton
          Left = 89
          Top = 10
          Width = 75
          Height = 25
          Caption = 'Button2'
          TabOrder = 1
        end
        object Button3: TButton
          Left = 170
          Top = 10
          Width = 75
          Height = 25
          Caption = 'Button3'
          TabOrder = 2
        end
      end
    end
    object RightPanel: TPanel
      Left = 316
      Top = 0
      Width = 307
      Height = 388
      Align = alClient
      UseDockManager = False
      ParentBackground = False
      TabOrder = 1
      ExplicitLeft = 319
      object Memo2: TMemo
        Left = 0
        Top = 41
        Width = 307
        Height = 328
        Align = alClient
        Lines.Strings = (
          'Memo1')
        TabOrder = 0
        ExplicitTop = 34
        ExplicitHeight = 343
      end
      object StatusBar2: TStatusBar
        Left = 0
        Top = 369
        Width = 307
        Height = 19
        Panels = <>
        SimplePanel = True
        SimpleText = 'StatusBar1'
        ExplicitLeft = 112
        ExplicitTop = 368
        ExplicitWidth = 0
      end
      object Panel2: TPanel
        Left = 0
        Top = 0
        Width = 307
        Height = 41
        Align = alTop
        TabOrder = 2
        ExplicitTop = 8
        object Button4: TButton
          Left = 8
          Top = 10
          Width = 75
          Height = 25
          Caption = 'Button1'
          TabOrder = 0
        end
        object Button5: TButton
          Left = 89
          Top = 10
          Width = 75
          Height = 25
          Caption = 'Button2'
          TabOrder = 1
        end
        object Button6: TButton
          Left = 170
          Top = 10
          Width = 75
          Height = 25
          Caption = 'Button3'
          TabOrder = 2
        end
      end
    end
  end
  object MainMenu1: TMainMenu
    Left = 528
    Top = 72
    object File1: TMenuItem
      Caption = 'File'
    end
    object View1: TMenuItem
      Caption = 'View'
    end
    object Options1: TMenuItem
      Caption = 'Options'
    end
    object Help1: TMenuItem
      Caption = 'Help'
    end
  end
end

我在Windows 10和Delphi 10.3 Rio上进行了测试...在较旧的Delphi版本中,我没有遇到过这个问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...