首页 > 解决方案 > Delphi 10.3 中的 TCoolBar 带调整问题

问题描述

我将一个TCoolBar组件放入一个全新的项目中Delphi 10.3。有一些乐队连续出现。当我调整一个波段的大小时,同一行中右侧的其他波段也会调整大小。我可以减少或增加乐队的大小,右边的其他人总是随着差异而增长。如果我调整表格的大小,所有乐队都会变得疯狂。他们都增加了他们的大小。

如果我通过乐队编辑器创建乐队,则不会发生错误。当我将一些内容TActionToolBar放入TCoolBar.

CoolBar AutoSize 未设置。乐队或 TActionToolBar 没有这样的属性。

帕斯文件:

unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ToolWin, Vcl.ComCtrls,
  Vcl.PlatformDefaultStyleActnCtrls, System.Actions, Vcl.ActnList, Vcl.ActnMan,
  Vcl.ActnCtrls;

type
  TForm2 = class(TForm)
    ActionManager1: TActionManager;
    CoolBar1: TCoolBar;
    ActionToolBar1: TActionToolBar;
    ActionToolBar2: TActionToolBar;
    ActionToolBar3: TActionToolBar;
    ActionToolBar4: TActionToolBar;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

end.

.dpr 文件:

object Form2: TForm2
  Left = 0
  Top = 0
  Caption = 'Form2'
  ClientHeight = 405
  ClientWidth = 635
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object CoolBar1: TCoolBar
    Left = 0
    Top = 0
    Width = 635
    Height = 65
    Bands = <
      item
        Control = ActionToolBar1
        ImageIndex = -1
        Width = 148
      end
      item
        Break = False
        Control = ActionToolBar2
        ImageIndex = -1
        Width = 477
      end
      item
        Control = ActionToolBar3
        ImageIndex = -1
        Width = 146
      end
      item
        Break = False
        Control = ActionToolBar4
        ImageIndex = -1
        Width = 479
      end>
    FixedSize = True
    object ActionToolBar1: TActionToolBar
      Left = 11
      Top = 0
      Width = 135
      Height = 25
      Caption = 'ActionToolBar1'
      Color = clMenuBar
      ColorMap.DisabledFontColor = 7171437
      ColorMap.HighlightColor = clWhite
      ColorMap.BtnSelectedFont = clBlack
      ColorMap.UnusedColor = clWhite
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBlack
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      Spacing = 0
    end
    object ActionToolBar2: TActionToolBar
      Left = 163
      Top = 0
      Width = 468
      Height = 25
      Caption = 'ActionToolBar2'
      Color = clMenuBar
      ColorMap.DisabledFontColor = 7171437
      ColorMap.HighlightColor = clWhite
      ColorMap.BtnSelectedFont = clBlack
      ColorMap.UnusedColor = clWhite
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBlack
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      Spacing = 0
    end
    object ActionToolBar3: TActionToolBar
      Left = 11
      Top = 27
      Width = 133
      Height = 25
      Caption = 'ActionToolBar3'
      Color = clMenuBar
      ColorMap.DisabledFontColor = 7171437
      ColorMap.HighlightColor = clWhite
      ColorMap.BtnSelectedFont = clBlack
      ColorMap.UnusedColor = clWhite
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBlack
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      Spacing = 0
    end
    object ActionToolBar4: TActionToolBar
      Left = 161
      Top = 27
      Width = 470
      Height = 25
      Caption = 'ActionToolBar4'
      Color = clMenuBar
      ColorMap.DisabledFontColor = 7171437
      ColorMap.HighlightColor = clWhite
      ColorMap.BtnSelectedFont = clBlack
      ColorMap.UnusedColor = clWhite
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBlack
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      Spacing = 0
    end
  end
  object ActionManager1: TActionManager
    Left = 248
    Top = 160
    StyleName = 'Platform Default'
  end
end

这个问题有什么解决办法吗?

标签: delphivcl

解决方案


推荐阅读