Delphi:功能区快速访问工具栏 - 小图像不显示

发布于 2024-11-18 19:14:42 字数 267 浏览 2 评论 0原文

我不知道为什么,但是使用 Delphi 2009 的功能区控件,快速访问工具栏中的小图像不显示。

我有一个图像列表,其中图像设置为 16x16 像素,当我将它们用作常规图像列表时,它不起作用,只显示菜单标题。如果我切换到使用大图像列表,它可以工作,但会增加额外的填充并且看起来很糟糕。

在此处输入图像描述

知道发生了什么吗?需要配置哪些众多选项才能让这个东西按预期运行?

I have no idea why, but using Delphi 2009's ribbon control, the small images in the quick access toolbar don't show up.

I've got an image list with images set to 16x16 pixels and when I use them as the regular image list, it doesn't work, just shows the menu caption. If I switch to use the large image list it works, but adds extra padding and looks bad.

enter image description here

Any idea what is going on? Which of the multitudinous options needs to be configured to get this thing to act as expected?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初吻给了烟 2024-11-25 19:14:42

在Delphi 2010和XE中,步骤是:

  1. 将TRibbon、ImageList和ActionManager添加到空白表单中。将 ImageList 链接到 ActionManager。
  2. 添加一些虚拟操作,例如“编辑”->“复制”,它将自动获取用于测试的图像。
  3. 右键单击,添加 QuickAccessToolbar,然后右键单击并添加应用程序菜单。
  4. 设置 Form.DoubleBuffered true,Form.GlassFrame.Enabled true。

  5. 双击 ActionManager。这将打开“操作管理器属性”对话框。转到“工具栏”选项卡,然后单击或双击“RibbonQuickAccessToolbar1”以将焦点放在该工具栏上。这一步很重要,除非您这样做,否则似乎很难添加项目。

  6. 在“操作管理器属性”对话框中,转到“操作”页面,然后将操作列表中具有可见图像的“复制/粘贴”操作拖到表单上的选定区域。

  7. 将第二个带有图像的项目添加到 QAT 似乎比添加第一个项目更容易。

让我知道这是否适合 2009 年的您。

这是 DFM 内容减去图像列表内容:

object Form5: TForm5
  Left = 0
  Top = 0
  Caption = 'Form5'
  ClientHeight = 337
  ClientWidth = 527
  Color = clBtnFace
  DoubleBuffered = True
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  GlassFrame.Enabled = True
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Ribbon1: TRibbon
    Left = 0
    Top = 0
    Width = 527
    Height = 143
    ActionManager = ActionManager1
    ApplicationMenu.Menu = RibbonApplicationMenuBar1
    Caption = 'Ribbon1'
    QuickAccessToolbar.ActionBar = RibbonQuickAccessToolbar1
    ExplicitLeft = 272
    ExplicitTop = 120
    ExplicitWidth = 0
    StyleName = 'Ribbon - Luna'
    object RibbonQuickAccessToolbar1: TRibbonQuickAccessToolbar
      Left = 49
      Top = 1
      Width = 99
      Height = 24
      ActionManager = ActionManager1
    end
    object RibbonApplicationMenuBar1: TRibbonApplicationMenuBar
      ActionManager = ActionManager1
      OptionItems = <>
      RecentItems = <>
    end
  end
  object ImageList1: TImageList
    Left = 288
    Top = 184
    Bitmap = {
      494C010105000800080010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
      ....
      }
  end
  object ActionManager1: TActionManager
    ActionBars = <
      item
        Items = <
          item
            Action = EditCopy1
            ImageIndex = 1
            ShowCaption = False
            ShortCut = 16451
          end
          item
            Action = EditCopy1
            ImageIndex = 1
            ShowCaption = False
            ShortCut = 16451
          end
          item
            Action = EditPaste1
            ImageIndex = 2
            ShowCaption = False
            ShortCut = 16470
          end>
        ActionBar = RibbonQuickAccessToolbar1
        AutoSize = False
      end
      item
        Items = <
          item
            ChangesAllowed = [caModify]
            Items = <
              item
                Action = EditCopy1
                ImageIndex = 1
                ShortCut = 16451
              end
              item
                Caption = 'ActionClientItem1'
              end>
            Caption = 'ActionClientItem0'
            KeyTip = 'F'
          end>
        ActionBar = RibbonApplicationMenuBar1
        AutoSize = False
      end>
    Images = ImageList1
    Left = 288
    Top = 120
    StyleName = 'Ribbon - Luna'
    object EditCut1: TEditCut
      Category = 'Edit'
      Caption = 'Cu&t'
      Hint = 'Cut|Cuts the selection and puts it on the Clipboard'
      ImageIndex = 0
      ShortCut = 16472
    end
    object EditCopy1: TEditCopy
      Category = 'Edit'
      Caption = '&Copy'
      Hint = 'Copy|Copies the selection and puts it on the Clipboard'
      ImageIndex = 1
      ShortCut = 16451
    end
    object EditPaste1: TEditPaste
      Category = 'Edit'
      Caption = '&Paste'
      Hint = 'Paste|Inserts Clipboard contents'
      ImageIndex = 2
      ShortCut = 16470
    end
    object EditSelectAll1: TEditSelectAll
      Category = 'Edit'
      Caption = 'Select &All'
      Hint = 'Select All|Selects the entire document'
      ShortCut = 16449
    end
    object EditUndo1: TEditUndo
      Category = 'Edit'
      Caption = '&Undo'
      Hint = 'Undo|Reverts the last action'
      ImageIndex = 3
      ShortCut = 16474
    end
    object EditDelete1: TEditDelete
      Category = 'Edit'
      Caption = '&Delete'
      Hint = 'Delete|Erases the selection'
      ImageIndex = 4
      ShortCut = 46
    end
  end
end

这是运行时的样子:

在此处输入图像描述

In Delphi 2010, and XE, the steps are:

  1. add TRibbon, ImageList, and ActionManager to a blank form. Link ImageList to ActionManager.
  2. add some dummy actions like Edit->Copy which will automatically gain an image for testing.
  3. right click, add QuickAccessToolbar then right click and Add Application Menu.
  4. set Form.DoubleBuffered true, and Form.GlassFrame.Enabled true.

  5. Double click ActionManager. This opens On the Action manager properties dialog. Go to Toolbars tab and click or double-click "RibbonQuickAccessToolbar1" to get focus on that toolbar. This step is important, it seems difficult to get items added unless you do this.

  6. On the Action manager properties dialog, go to Actions page, and drag an action like Copy/Paste that has an image visible in the actions list, to the selected area on the form.

  7. It seems easier to add a second item with an image to the QAT, than to add the initial one.

Let me know if that works for you in 2009.

Here is the DFM content MINUS THE IMAGE LIST CONTENT:

object Form5: TForm5
  Left = 0
  Top = 0
  Caption = 'Form5'
  ClientHeight = 337
  ClientWidth = 527
  Color = clBtnFace
  DoubleBuffered = True
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  GlassFrame.Enabled = True
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Ribbon1: TRibbon
    Left = 0
    Top = 0
    Width = 527
    Height = 143
    ActionManager = ActionManager1
    ApplicationMenu.Menu = RibbonApplicationMenuBar1
    Caption = 'Ribbon1'
    QuickAccessToolbar.ActionBar = RibbonQuickAccessToolbar1
    ExplicitLeft = 272
    ExplicitTop = 120
    ExplicitWidth = 0
    StyleName = 'Ribbon - Luna'
    object RibbonQuickAccessToolbar1: TRibbonQuickAccessToolbar
      Left = 49
      Top = 1
      Width = 99
      Height = 24
      ActionManager = ActionManager1
    end
    object RibbonApplicationMenuBar1: TRibbonApplicationMenuBar
      ActionManager = ActionManager1
      OptionItems = <>
      RecentItems = <>
    end
  end
  object ImageList1: TImageList
    Left = 288
    Top = 184
    Bitmap = {
      494C010105000800080010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
      ....
      }
  end
  object ActionManager1: TActionManager
    ActionBars = <
      item
        Items = <
          item
            Action = EditCopy1
            ImageIndex = 1
            ShowCaption = False
            ShortCut = 16451
          end
          item
            Action = EditCopy1
            ImageIndex = 1
            ShowCaption = False
            ShortCut = 16451
          end
          item
            Action = EditPaste1
            ImageIndex = 2
            ShowCaption = False
            ShortCut = 16470
          end>
        ActionBar = RibbonQuickAccessToolbar1
        AutoSize = False
      end
      item
        Items = <
          item
            ChangesAllowed = [caModify]
            Items = <
              item
                Action = EditCopy1
                ImageIndex = 1
                ShortCut = 16451
              end
              item
                Caption = 'ActionClientItem1'
              end>
            Caption = 'ActionClientItem0'
            KeyTip = 'F'
          end>
        ActionBar = RibbonApplicationMenuBar1
        AutoSize = False
      end>
    Images = ImageList1
    Left = 288
    Top = 120
    StyleName = 'Ribbon - Luna'
    object EditCut1: TEditCut
      Category = 'Edit'
      Caption = 'Cu&t'
      Hint = 'Cut|Cuts the selection and puts it on the Clipboard'
      ImageIndex = 0
      ShortCut = 16472
    end
    object EditCopy1: TEditCopy
      Category = 'Edit'
      Caption = '&Copy'
      Hint = 'Copy|Copies the selection and puts it on the Clipboard'
      ImageIndex = 1
      ShortCut = 16451
    end
    object EditPaste1: TEditPaste
      Category = 'Edit'
      Caption = '&Paste'
      Hint = 'Paste|Inserts Clipboard contents'
      ImageIndex = 2
      ShortCut = 16470
    end
    object EditSelectAll1: TEditSelectAll
      Category = 'Edit'
      Caption = 'Select &All'
      Hint = 'Select All|Selects the entire document'
      ShortCut = 16449
    end
    object EditUndo1: TEditUndo
      Category = 'Edit'
      Caption = '&Undo'
      Hint = 'Undo|Reverts the last action'
      ImageIndex = 3
      ShortCut = 16474
    end
    object EditDelete1: TEditDelete
      Category = 'Edit'
      Caption = '&Delete'
      Hint = 'Delete|Erases the selection'
      ImageIndex = 4
      ShortCut = 46
    end
  end
end

Here's what it looks like at runtime:

enter image description here

看轻我的陪伴 2024-11-25 19:14:42

不要创建链接到操作管理器的操作列表,只需使用功能区自动执行所有操作。

如果您在列表中没有看到图标,则您将不会在应用程序中看到它们。

Don't create an action list to link to the action manager, just use the ribbon to do everything automatically.

If you don't see icons in the list, you won't see them in your app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文