TToolBar上的鬼线文物

时间:2017-07-19 23:01:22

标签: delphi toolbar delphi-10.1-berlin

TToolbar有时会产生奇怪的神秘文物:

enter image description here

在这种情况下,我在TJvPanel上的两个工具按钮之间插入TToolBar,因为我需要一个透明对象来创建这两个按钮之间的距离。< / p>

正如你所看到的那样,在TJvPanel的左侧会产生一条神秘的鬼线。

如何避免这种鬼线?

以下是项目文件:

Unit2.dfm

ToolbarArtefact.dpr

Unit2.pas

以下是最小的项目来源:

Unit2.dfm:

object Form2: TForm2
  Left = 0
  Top = 0
  Caption = 'Form2'
  ClientHeight = 366
  ClientWidth = 606
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -13
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  PixelsPerInch = 120
  TextHeight = 16
  object tlbTest: TToolBar
    AlignWithMargins = True
    Left = 0
    Top = 3
    Width = 606
    Margins.Left = 0
    Margins.Right = 0
    Margins.Bottom = 0
    AutoSize = True
    ButtonHeight = 30
    ButtonWidth = 31
    Color = clBtnFace
    Ctl3D = False
    DoubleBuffered = True
    DrawingStyle = dsGradient
    EdgeInner = esNone
    EdgeOuter = esNone
    Flat = False
    Images = ilToolbar
    Indent = 5
    List = True
    ParentColor = False
    ParentDoubleBuffered = False
    TabOrder = 0
    Transparent = False
    object btnAirplane: TToolButton
      Left = 5
      Top = 0
      Hint = 'Show Recent Documents'
      AutoSize = True
      Caption = 'Most recently used'
      Grouped = True
      ImageIndex = 0
      Style = tbsCheck
    end
    object btnAutobus: TToolButton
      Left = 40
      Top = 0
      Hint = 'Show Favorite Documents'
      AutoSize = True
      Caption = 'Favorites'
      Down = True
      Grouped = True
      ImageIndex = 1
      Style = tbsCheck
    end
    object pnlTlbMruFavSep1a: TJvPanel
      Left = 75
      Top = 0
      Width = 16
      Height = 30
      Transparent = True
      FlatBorderColor = clNone
      ArrangeSettings.HorizontalAlignment = asCenter
      BevelEdges = []
      BevelOuter = bvNone
      ParentBackground = False
      TabOrder = 0
    end
    object btnSum: TToolButton
      Left = 91
      Top = 0
      Hint = 'View Thumbnails'
      AutoSize = True
      Caption = 'Thumbnails'
      Down = True
      Grouped = True
      ImageIndex = 2
      Style = tbsCheck
    end
    object RzSpacer1: TRzSpacer
      Left = 126
      Top = 0
      Width = 25
      Height = 30
    end
  end
  object ilToolbar: TImageList
    ColorDepth = cd32Bit
    Height = 24
    Width = 24
    Left = 296
    Top = 192
  end
end

ToolbarArtefact.dpr:

program ToolbarArtefact;

uses
  Vcl.Forms,
  Unit2 in 'Unit2.pas' {Form2};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.

Unit2.pas:

unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
  Vcl.ExtCtrls,
  JvExExtCtrls, JvExtComponent, JvPanel, Vcl.ComCtrls,
  System.ImageList, Vcl.ImgList, Vcl.ToolWin, JvExControls, JvButton,
  JvTransparentButton, RzPanel;

type
  TForm2 = class(TForm)
    tlbTest: TToolBar;
    btnAirplane: TToolButton;
    btnAutobus: TToolButton;
    pnlTlbMruFavSep1a: TJvPanel;
    btnSum: TToolButton;
    ilToolbar: TImageList;
    RzSpacer1: TRzSpacer;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

end.

0 个答案:

没有答案