Table of Contents

Method LoadMenu

Namespace
vdControls
Assembly
vdFramedControl.dll

LoadMenu(string, string, bool, bool)

Loads the specified menu to the control.

public void LoadMenu(string path, string filename, bool unloadMenu = true, bool AddAfterCurrentMenu = true)

Parameters

path string

The directory where the menu text file is located.

filename string

The filename of the menu text file.

unloadMenu bool

Indicates whether to unload the current menu before loading the new one.Optional default value is true.

AddAfterCurrentMenu bool

If unloadMenu is false and you are adding additional menu to the existing , the additional menu will be added to the end of the current menu if this value is true..Optional default value is true.

Examples

Suppose you have a 'mymenu.txt' placed in your application folder with the following contents

MainMenu = Custom Objects SubButton = MyCommand1 , command1 , //add more SubButton here Also you need to append the commands for your menu Suppose you have a 'mycommands.txt' placed in your application folder with the following contents command1,, VDCAD TEST.dll,VDCAD_TEST.Commands,TestCommandMethod //add more commands here write a windows form application as follow
using vdControls;  
using VectorDraw.Professional.vdObjects;  
namespace VDCAD_TEST
{
    public partial class Form1 : Form
    {
        vdFramedControl vdraw = new vdFramedControl();
        public Form1()
        {
            InitializeComponent();
            this.WindowState = FormWindowState.Maximized;
            this.Controls.Add(vdraw);
            vdraw.Dock = DockStyle.Fill;
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            //merge your custom commands
            vdraw.CommandLine.MergeCommands("", "mycommands.txt");

            //add the new menu item at the left side of the exisiting default menu
            vdraw.LoadMenu("", "mymenu.txt", false , false);
            vdraw.ShowMenu(true);

            ////if you want to add it at the right side then right the following instead
            //vdraw.UnLoadMenu();
            //vdraw.LoadMenu("", "mymenu.txt", false, true);
            //vdraw.ShowMenu(true);
        }
    }

    public static class Commands
    {
        public static void TestCommandMethod(vdDocument doc)
        {
            doc.ZoomExtents();
            doc.Redraw(false);
        }
    }
}
See Also

LoadMenu(StreamReader, string, bool, bool)

Loads the specified menu to the control.

public void LoadMenu(StreamReader file, string ImagesPath, bool unloadMenu = true, bool AddAfterCurrentMenu = true)

Parameters

file StreamReader

A System.IO.StreamReader stream to load the menu from. This can be a text file in the resources of the project as the menu.txt that we provide.

ImagesPath string

The directory where the Images are for the icons of the menu.

unloadMenu bool

Indicates whether to unload the current menu before loading the new one.Optional default value is true.

AddAfterCurrentMenu bool

If unloadMenu is false and you are adding additional menu to the existing , the additional menu will be added to the end of the current menu if this value is true..Optional default value is true.

Examples

This code will Load the menu from a resources file of the project.

MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(Resources.Menu);
writer.Flush();
stream.Position = 0;
StreamReader Menu = new StreamReader(stream);
vdFramedControl1.LoadMenu (Menu,"C:\vdraw6\REDIS\AnyCPU\images"); */
see also LoadMenu(string, string, bool, bool)
See Also