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

时间:2011-07-06 19:45:16

标签: delphi delphi-2009 ribbon

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

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

enter image description here

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

2 个答案:

答案 0 :(得分:3)

在Delphi 2010和XE中,步骤如下:

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

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

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

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

  8. 请告诉我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
    

    以下是运行时的样子:

    enter image description here

答案 1 :(得分:0)

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

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