在 Delphi 11 Alexandria 中的 Windows 10 中运行 32 位 VCL 应用程序时,最初看起来不错(除了 Mainmenu 被隐藏):
但是一旦窗口失去焦点,TTitleBarPanel
OVERLAPS pnlHeader(嵌套TPanel
在 a 中TCard
):
但我已经按照文档所说的那样做了:将除 之外的所有内容TTitleBarPanel
放在与客户端对齐的面板上。
如何避免这种重叠?
这里是单位:
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.Menus,
Vcl.TitleBarCtrls, Vcl.WinXPanels;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
menuitemOptions: TMenuItem;
menuitemPreferences: TMenuItem;
menuitemAbout: TMenuItem;
pnlHeader: TPanel;
TitleBarPanel1: TTitleBarPanel;
CardPanel1: TCardPanel;
Card1: TCard;
Panel1: TPanel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
这是表格:
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 294
ClientWidth = 515
Color = clSilver
CustomTitleBar.Control = TitleBarPanel1
CustomTitleBar.Enabled = True
CustomTitleBar.Height = 34
CustomTitleBar.BackgroundColor = clWhite
CustomTitleBar.ForegroundColor = 65793
CustomTitleBar.InactiveBackgroundColor = clWhite
CustomTitleBar.InactiveForegroundColor = 10066329
CustomTitleBar.ButtonForegroundColor = 65793
CustomTitleBar.ButtonBackgroundColor = clWhite
CustomTitleBar.ButtonHoverForegroundColor = 65793
CustomTitleBar.ButtonHoverBackgroundColor = 16053492
CustomTitleBar.ButtonPressedForegroundColor = 65793
CustomTitleBar.ButtonPressedBackgroundColor = 15395562
CustomTitleBar.ButtonInactiveForegroundColor = 10066329
CustomTitleBar.ButtonInactiveBackgroundColor = clWhite
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
GlassFrame.Enabled = True
GlassFrame.Top = 34
Menu = MainMenu1
Position = poScreenCenter
StyleElements = [seFont, seClient]
PixelsPerInch = 96
TextHeight = 15
object TitleBarPanel1: TTitleBarPanel
Left = 0
Top = 0
Width = 515
Height = 34
CustomButtons = <>
ExplicitWidth = 608
end
object Panel1: TPanel
Left = 0
Top = 34
Width = 515
Height = 260
Align = alClient
BevelOuter = bvNone
TabOrder = 1
ExplicitTop = 33
ExplicitWidth = 608
ExplicitHeight = 296
object CardPanel1: TCardPanel
Left = 0
Top = 0
Width = 515
Height = 260
Align = alClient
ActiveCard = Card1
BevelOuter = bvNone
Caption = 'CardPanel1'
TabOrder = 0
ExplicitTop = 34
ExplicitWidth = 608
ExplicitHeight = 355
object Card1: TCard
Left = 0
Top = 0
Width = 515
Height = 260
Caption = 'Card1'
CardIndex = 0
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 0
ExplicitWidth = 608
ExplicitHeight = 355
object pnlHeader: TPanel
Left = 0
Top = 0
Width = 515
Height = 32
Margins.Left = 100
Margins.Top = 0
Margins.Right = 150
Margins.Bottom = 0
Align = alTop
Alignment = taLeftJustify
BevelOuter = bvNone
Color = 16443110
Font.Charset = DEFAULT_CHARSET
Font.Color = clGrayText
Font.Height = -19
Font.Name = 'Segoe UI'
Font.Style = []
ParentBackground = False
ParentFont = False
TabOrder = 0
ExplicitWidth = 608
end
end
end
end
object MainMenu1: TMainMenu
Left = 320
Top = 192
object menuitemOptions: TMenuItem
Caption = 'Options'
object menuitemPreferences: TMenuItem
Caption = 'Toggle Preferences'
ShortCut = 123
end
object menuitemAbout: TMenuItem
Caption = 'About'
ShortCut = 121
end
end
end
end