首页 > 解决方案 > 如何在自定义 XML 功能区中水平集中控件

问题描述

在一个组内,我在第一行添加了一个带有标签 + 按钮的编辑框。下面,我添加了 4 个导航按钮。我需要的是在编辑框和绿色按钮下水平集中这 4 个导航按钮。

我尝试了很多方法。我最后一次尝试是在 4 个按钮之前放置一个空框,然后在之后放置一个空框,但未成功。在最后一次尝试中,发生的情况是 4 个导航按钮先出现,然后是空框,如下图所示。

在此处输入图像描述

我还想将所有控件(编辑框和绿色按钮 + 4 个导航按钮)放在功能区的底部。

我知道有一篇文章讨论了该属性的使用,boxStyle="horizontal"但是,我正在使用该属性,但没有成功。

代码:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <ribbon startFromScratch="true">
    <tabs>
      <tab id="tab0" label="Controles">
        <group id="grp0" label="Navegação">
            <box id="box0" boxStyle="vertical">
                <box id="box2" boxStyle="horizontal">
                  <editBox id="ebx13" label="Ir para" screentip="Campo Ir Para..." supertip="Digite o número ID do documento desejado e aperte o Botão ao lado."/>
                  <button id="btn14" size="normal" screentip="Botão Ir Para..." supertip="Carrega a tela com o documento desejado." imageMso="AnimationStartDropdown"/>
                </box>
                
                
            
                <box id="box4" boxStyle="horizontal">
                    <box id="box5"> </box>
                    <box id="box1" boxStyle="horizontal">                 
                      <button id="btn0" size="normal" screentip="Botão Ir para o Primeiro Registro" supertip="Carrega a tela com o primeiro registro salvo." imageMso="RewindLong"/>
                      <button id="btn1" size="normal" screentip="Botão Ir para o Registro Anterior" supertip="Carrega a tela com o registro anterior ao atual." imageMso="CatalogMergeGoToPreviousRecord"/>
                      <button id="btn2" size="normal" screentip="Botão Ir para o Próximo Registro" supertip="Carrega a tela com o próximo registro ao atual." imageMso="CatalogMergeGoToNextRecord"/>
                      <button id="btn3" size="normal" screentip="Botão Ir para o último Registro" supertip="Carrega a tela com o último registro salvo." imageMso="FastForwardLong"/>                 
                    </box>
                    <box id="box6"> </box>
                </box>
                
                

            </box>
        </group>
        <group id="grp2" label="Registros">
            <box id="box3" boxStyle="horizontal">
              <button id="btn4" size="large" label="Novo" screentip="Botão Novo Registro" supertip="Cria um novo documento." imageMso="AddAccount"/>
              <button id="btn5" size="large" label="Duplicar" screentip="Botão Duplicar Registro" supertip="Cria um novo documento aproveitando os dados do documento carregado na tela. O ID desse novo documento será; novo." imageMso="AdpStoredProcedureQuerySelect"/>
              <button id="btn6" size="large" label="Editar" screentip="Botão Editar Registro" supertip="Altera os dados do documento carregado na tela." imageMso="IconPencilTool"/>
              <button id="btn7" size="large" label="Excluir" screentip="Botão Excluir Registro" supertip="Exclui o documento carregado na tela." imageMso="ChangeToDeclineInvitation"/>
            </box>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

提前致谢。

标签: xmlms-access-2010

解决方案


几天前,我找到了一种水平集中控制的方法。我通过<labelControl id="label1" label=" "/>在要集中的控件之前插入 a 并在标签属性中尽可能多地写入空格来实现所需的结果。

    <box id="box2" boxStyle="horizontal">
        <labelControl id="label1" label="   "/>
        <box id="box3" boxStyle="horizontal">                 
          <button id="btn1" size="normal" screentip="Botão Ir para o Primeiro Registro" supertip="Carrega a tela com o primeiro registro salvo." imageMso="RewindLong"/>
          <button id="btn2" size="normal" screentip="Botão Ir para o Registro Anterior" supertip="Carrega a tela com o registro anterior ao atual." imageMso="CatalogMergeGoToPreviousRecord"/>
          <button id="btn3" size="normal" screentip="Botão Ir para o Próximo Registro" supertip="Carrega a tela com o próximo registro ao atual." imageMso="CatalogMergeGoToNextRecord"/>
          <button id="btn4" size="normal" screentip="Botão Ir para o último Registro" supertip="Carrega a tela com o último registro salvo." imageMso="FastForwardLong"/>                 
        </box>
    </box>

结果如下图所示:

在此处输入图像描述

也许有更好的方法来获得它。

谢谢。


推荐阅读