Visio Guy

Visio Discussions => Programming & Code => Topic started by: Thomas Winkel on November 12, 2012, 05:12:07 PM

Title: Dockable Window
Post by: Thomas Winkel on November 12, 2012, 05:12:07 PM
Hi,

in order to separate Code and Documents I am planning to convert my VBA project to .NET (C#).
First I would like to start with the GUI (also to have a mock-up for presentations soon).
The functionality will be converted step by step.

There is one form which should dock to the bottom of the Visio Window instead of open in a separate window.
I tried lot of things with code from the internet, but only had crashes.

Could someone help me to start "frmExports" in a docked window, please?

Regards,
Thomas




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;

namespace Test
{
    public partial class RibbondSPACE
    {
        private void RibbondSPACE_Load(object sender, RibbonUIEventArgs e)
        {

        }

        private void buttonExports_Click(object sender, RibbonControlEventArgs e)
        {
            frmExports form = new frmExports();
            form.Show();
        }
    }
}
Title: Re: Dockable Window
Post by: Thomas Winkel on November 13, 2012, 07:52:03 AM
Ok, done.

In the Visio SDK is an example code "Anchor Bars Usage".
To make this work for my code I just had to:
1. slightly adapt (and rename) the class "AnchorBarsUsage"
2. add the method "ParentVisioApplication" to "frmExports".

This is the only modification in my original code from above:

private void buttonExports_Click(object sender, RibbonControlEventArgs e)
        {
            anchorBarExports anchorBarForm = new anchorBarExports();
            anchorBarForm.Show(Globals.ThisAddIn.Application, true);
        }


I don't understand what I'm doing, but it works  8)
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 48 (show)
Files included: 25 - 925KB. (show)
Memory used: 747KB.
Tokens: post-login.
Cache hits: 8: 0.00131s for 22,301 bytes (show)
Cache misses: 2: (show)
Queries used: 11.

[Show Queries]