none
Add custom face to Visio 2013 RRS feed

  • Question

  • Hi Guys.

    I have an add-on (VSTO with C#). I used my ribbons with icons. But for the context menu of the shapes and pages apparently the only way to set icon is by FaceId and I don't know how to add custom face id (my own icon) in Visio 2013 and used it's face id in contex menu (Actions Row).

    Thanks you

    Danesh


    Monday, March 9, 2015 7:09 PM

Answers

  • Hi Danesh,

    Based on the description, you want to add the custom image for the controls on the contect menu and the image didn't appear. Would you mind sharing more detail the code you were developing?

    I try to reproduce the issue however failed, here are my steps for your reference:
    1. Add ribbon XML item in the VSTO project like below:

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load" loadImage="Image_Load"> 
      <ribbon>
        <tabs>
          <tab idMso="TabAddIns">
            <group id="MyGroup"
                   label="My Group">
            </group>
          </tab>
        </tabs>
      </ribbon>
      <contextMenus>
        <contextMenu idMso="ContextMenuShape">
          <button id="button1" label="button1" imageMso="HappyFace"/>
          <button id="button2"
                  label="button2"
                  image="un.jpg"/>
        </contextMenu>
      </contextMenus>
    </customUI>
    
    

    2. add the loadimage call back in the ribbon.cs

     public Bitmap Image_Load(string imageName)
            {
                Stream stream = File.Open(@"D:\" + imageName, FileMode.Open);
                return new Bitmap(stream);
            }

    Note: we need to load the custom image in the load image call back and this call back is used for all controls. More detail about this call back you can refer link below:
    Adding Custom Dynamic Menus to the Office Fluent User Interface

    Link below is also maybe helpful for learning Office UI customization:
    Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Daneshk Friday, March 13, 2015 5:09 PM
    Tuesday, March 10, 2015 3:38 AM
    Moderator

All replies

  • Hi Danesh,

    Based on the description, you want to add the custom image for the controls on the contect menu and the image didn't appear. Would you mind sharing more detail the code you were developing?

    I try to reproduce the issue however failed, here are my steps for your reference:
    1. Add ribbon XML item in the VSTO project like below:

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load" loadImage="Image_Load"> 
      <ribbon>
        <tabs>
          <tab idMso="TabAddIns">
            <group id="MyGroup"
                   label="My Group">
            </group>
          </tab>
        </tabs>
      </ribbon>
      <contextMenus>
        <contextMenu idMso="ContextMenuShape">
          <button id="button1" label="button1" imageMso="HappyFace"/>
          <button id="button2"
                  label="button2"
                  image="un.jpg"/>
        </contextMenu>
      </contextMenus>
    </customUI>
    
    

    2. add the loadimage call back in the ribbon.cs

     public Bitmap Image_Load(string imageName)
            {
                Stream stream = File.Open(@"D:\" + imageName, FileMode.Open);
                return new Bitmap(stream);
            }

    Note: we need to load the custom image in the load image call back and this call back is used for all controls. More detail about this call back you can refer link below:
    Adding Custom Dynamic Menus to the Office Fluent User Interface

    Link below is also maybe helpful for learning Office UI customization:
    Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Daneshk Friday, March 13, 2015 5:09 PM
    Tuesday, March 10, 2015 3:38 AM
    Moderator
  • Hi Regards & Fei

    Thank  you for your response.

    Right now I used the same way for my custom ribbon but for the context menu:

    - I used Actions Section of the Shape Sheet

    - I have lots of actions and I used formulas to define Checked, Visible,... cells

    - There are different context menu based on shape types and Shape Data

    - For customers that use Office 2007 I used command bar instead of ribbon but I have the same Actions solutions for shape context menu

    So replacing the current solution with the XML Context menu has these challenges for me:

    - Supporting customers with Visio 2007

    - Dynamically set Visible, Checked ,... attributes of context menu items. (Event if it's possible how about the latency, because all related data are in Shape Data cells)

    - Setting different context menu for different Shape Types.

    In my current solution there is a cell in Actions Section named "ButtonFace", by putting the faceId I see different icons that are already available in Visio but I don't know how to add custom Face and use the faceId in ButtonFace cell.

    Do you think I should totally migrate to XML based Context menu instead of Actions solution? (Maybe it's better for long term development?)

    Do you think there is a solution for custom Icons for the current solution?

    Regards

    Danesh

    Tuesday, March 10, 2015 3:06 PM
  • Hi Daneshk,

    >> Do you think I should totally migrate to XML based Context menu instead of Actions solution?
    I'm afraid this is more related to user experience design and I think it depends on the function of the feature.

    >> Supporting customers with Visio 2007
    I'm afraid the Visio 2007 did not support ribbon.

    >> Dynamically set Visible, Checked... attributes of context menu items. (Event if it's possible how about the latency, because all related data are in Shape Data cells)
    It is possible.

    Since the original question "Add custom face to Visio 2013" is already resolved. If you have other issues about Visio developing I suggest that you reopen a new thread. Becasuse it can involve more comunities and you would get more effective response.

    Thanks for your understanding.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 12, 2015 9:14 AM
    Moderator