Exemplo n.º 1
0
        /// <summary>
        /// Sets the 'pressed' state on the menu item corresponding to the current application theme.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnThemeCommandStateQuery(
            object sender,
            CommandStateQueryEventArgs e)
        {
            C1Command c = (C1Command)sender;

            e.Pressed = C1ThemeController.ApplicationTheme == (string)c.UserData;
        }
Exemplo n.º 2
0
        private void AddCommandMenuItem(C1CommandMenu menu, string text)
        {
            C1Command c = new C1Command();

            c.Text     = text;
            c.UserData = s_rbnInsertTextTag;
            chMain.Commands.Add(c);
            menu.CommandLinks.Add(new C1CommandLink(c));
        }
Exemplo n.º 3
0
        private void AddMenuItem(C1CommandMenu cm, string caption)
        {
            C1Command c = new C1Command();

            c.Text = caption;
            chMain.Commands.Add(c);

            cm.CommandLinks.Add(new C1CommandLink(c));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sets the application theme.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnThemeClick(object sender, EventArgs e)
        {
            C1Command c     = (C1Command)sender;
            string    theme = (string)c.UserData;

            // reset Form.Font to default first
            this.Font = new Font("Segoe UI", 8F);

            C1ThemeController.ApplicationTheme = theme;
            ccmTheme.Text = string.Format("Theme: {0}", theme);
        }
Exemplo n.º 5
0
        private void c1Command_NavBarNormal_Click(object sender, ClickEventArgs e)
        {
            //toggle checked menu items so only 1 is checked at all times
            c1Command_NavBarNormal.Checked    = false;
            c1Command_NavBarMinimized.Checked = false;
            c1Command_NavBarOff.Checked       = false;

            C1Command c = (C1Command)sender;

            c.Checked = true;
        }
Exemplo n.º 6
0
        private void c1Command_AlignCenter_Click(object sender, ClickEventArgs e)
        {
            //toggle checked buttons so only 1 is checked at all times
            c1Command_AlignCenter.Checked = false;
            c1Command_AlignLeft.Checked   = false;
            c1Command_AlignRight.Checked  = false;
            c1Command_Justify.Checked     = false;

            C1Command c = (C1Command)sender;

            c.Checked = true;
        }
Exemplo n.º 7
0
        private void chMain_CommandClick(object sender, CommandClickEventArgs e)
        {
            if (e.Command == cUndo)
            {
                txtScript.Undo();
            }
            else if (e.Command == cRedo)
            {
                txtScript.Redo();
            }
            else if (e.Command == cCut)
            {
                txtScript.Cut();
            }
            else if (e.Command == cCopy)
            {
                txtScript.Copy();
            }
            else if (e.Command == cPaste)
            {
                txtScript.Paste();
            }
            else if (e.Command == cDelete)
            {
                txtScript.SelectedText = string.Empty;
            }
            else if (e.Command == cSelectAll)
            {
                txtScript.SelectAll();
            }
            else
            {
                // insert menu text
                C1Command item = e.Command;
                txtScript.SelectedText = item.Text;

                // position cursor
                int openPar  = item.Text.IndexOf("(");
                int asterisk = item.Text.IndexOf("*");
                if (openPar > -1)
                {
                    txtScript.SelectionStart -= (item.Text.Length - openPar - 1);
                }
                else if (asterisk > -1)
                {
                    txtScript.SelectionStart -= (item.Text.Length - asterisk);
                    txtScript.SelectionLength = 1;
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Handles the file open command.
        /// <para>
        /// The passed C1Command can be used to pass parameters:
        /// If command.UserData is a pair of strings, the pair.First
        /// is considered to be the file name, and pair.Second,
        /// if not null, is considered to be the name of a report in that file.
        /// If report name is specified, that report is loaded from the file.
        /// Otherwise (if no report name given), the file is opened as a
        /// previously saved C1 document or multi-document.
        /// </para>
        /// <para>
        /// If command.UserData is null or not a pair, the method
        /// shows a file open dialog and allows the user to choose a file to open.
        /// </para>
        /// <para>
        /// The opened report or document is added to the recent documents' list.
        /// The window title is updated.
        /// </para>
        /// </summary>
        /// <param name="command">The command that can be used to pass parameters.</param>
        protected void FileOpen(C1Command command)
        {
            // check whether we were called with parameters (from the recent docs list):
            var pair = command.UserData as Pair <string, string>;

            // reset user data for future calls:
            command.UserData = null;
            if (pair != null)
            {
                FileOpen(pair.First, pair.Second);
            }
            else
            {
                FileOpen();
            }
        }
Exemplo n.º 9
0
        private void CreateCommandButton(IList<MenuDTO> mainMenu, MenuDTO parentMenu, C1ToolBar c1ToolBar)
        {
            mainMenu.Where(x => x.Parent == parentMenu && x.MenuType == MenuType.Form)
                .Distinct()
                .OrderBy(x => x.OrderId)
                .ToList()
                .ForEach(x =>
                {
                    string commandButtonId = x.Id.ToString();

                    C1Command commandButton = new C1Command()
                    {
                        Name = commandButtonId,
                        Text = string.IsNullOrWhiteSpace(x.Name) ? commandButtonId : x.Name,
                        Image = GetImage(x.IconPath),
                        UserData = x,
                    };

                    commandButton.Click += new ClickEventHandler(this.commandButton_ClickEventHandler);
                    c1ToolBar.CommandLinks.Add(new C1CommandLink(commandButton));
                });
        }
Exemplo n.º 10
0
        private void FillItems(
            C1CommandMenu cm,
            Type type,
            ClickEventHandler commandClick,
            CommandStateQueryEventHandler commandStateQuery)
        {
            Array values = Enum.GetValues(type);

            string[] names = Enum.GetNames(type);

            cm.CommandLinks.Clear();
            for (int i = 0; i < values.Length; i++)
            {
                C1Command cmd = new C1Command();
                cmd.Text               = names[i];
                cmd.UserData           = values.GetValue(i);
                cmd.CommandStateQuery += commandStateQuery;
                cmd.Click             += commandClick;
                C1CommandLink cl = new C1CommandLink(cmd);
                cm.CommandLinks.Add(cl);
            }
        }
        // our window menu will contain dynamic items (an entry for each open window)
        // in addition to static entries. We use UserData on commands to filter our
        // dynamically created commands
        private void mnuWindow_Popup(object sender, System.EventArgs e)
        {
            // delete old entries (we start at the bottom, and can not use foreach,
            // because we will be deleting entries from the list)
            for (int i = mnuWindow.CommandLinks.Count - 1; i >= 0; --i)
            {
                C1CommandLink cl = mnuWindow.CommandLinks[i];
                Editor        ed = cl.Command.UserData as Editor;
                if (ed != null)
                {
                    c1CommandHolder1.Commands.Remove(cl.Command);
                    mnuWindow.CommandLinks.RemoveAt(i);
                }
            }
            // add new entries for all open windows
            bool first = true;

            foreach (C1DockingTabPage p in tabMain.TabPages)
            {
                C1Command cmd = new C1Command();
                cmd.Text     = p.Text;
                cmd.UserData = p.Tag; // page.Tag is set by the Editor ctor
                if (p.Visible)
                {
                    cmd.Checked = true;
                }
                cmd.Click += new ClickEventHandler(WindowSelectHandler);
                C1CommandLink cl = new C1CommandLink(cmd);
                if (first)
                {
                    cl.Delimiter = true;
                    first        = false;
                }
                mnuWindow.CommandLinks.Add(cl);
            }
        }
Exemplo n.º 12
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(RegexDocument));
     this.cmdMultiline = new C1.Win.C1Command.C1Command();
     this.cmdSingleLine = new C1.Win.C1Command.C1Command();
     this.cmdMatch = new C1.Win.C1Command.C1Command();
     this.cmdIgnoreCase = new C1.Win.C1Command.C1Command();
     this.cmdExplicitCapture = new C1.Win.C1Command.C1Command();
     this.panel1 = new System.Windows.Forms.Panel();
     this.tabSctInputPart = new System.Windows.Forms.TabControl();
     this.tabInputText = new System.Windows.Forms.TabPage();
     this.c1ToolBar1 = new C1.Win.C1Command.C1ToolBar();
     this.c1CommandHolder1 = new C1.Win.C1Command.C1CommandHolder();
     this.cmdReplace = new C1.Win.C1Command.C1Command();
     this.cmdCancelAction = new C1.Win.C1Command.C1Command();
     this.cmdECMAScript = new C1.Win.C1Command.C1Command();
     this.cmdRightToLeft = new C1.Win.C1Command.C1Command();
     this.cmdIgnoreWS = new C1.Win.C1Command.C1Command();
     this.mnuInputFile = new C1.Win.C1Command.C1CommandControl();
     this.txtInputFilename = new System.Windows.Forms.TextBox();
     this.cmdmnuSelectInputFile = new C1.Win.C1Command.C1Command();
     this.cmdmnuRefreshFromInputFile = new C1.Win.C1Command.C1Command();
     this.c1CommandLink1 = new C1.Win.C1Command.C1CommandLink();
     this.c1CommandLink2 = new C1.Win.C1Command.C1CommandLink();
     this.c1CommandLink3 = new C1.Win.C1Command.C1CommandLink();
     this.txtInput = new System.Windows.Forms.RichTextBox();
     this.tabReplaceWith = new System.Windows.Forms.TabPage();
     this.txtReplaceWith = new Regulator.Ctl.RegexEditor();
     this.splitter2 = new System.Windows.Forms.Splitter();
     this.tabControl1 = new System.Windows.Forms.TabControl();
     this.tabMatches = new System.Windows.Forms.TabPage();
     this.Tree = new System.Windows.Forms.TreeView();
     this.imglstTree = new System.Windows.Forms.ImageList(this.components);
     this.tabOutput = new System.Windows.Forms.TabPage();
     this.txtOutputReplace = new System.Windows.Forms.RichTextBox();
     this.tabSplits = new System.Windows.Forms.TabPage();
     this.lvSplits = new System.Windows.Forms.ListView();
     this.Index = new System.Windows.Forms.ColumnHeader();
     this.text = new System.Windows.Forms.ColumnHeader();
     this.panel3 = new System.Windows.Forms.Panel();
     this.panel2 = new System.Windows.Forms.Panel();
     this.txtRegex = new Regulator.Ctl.RegexEditor();
     this.splitter1 = new System.Windows.Forms.Splitter();
     this.QuickRegexContexMenu = new System.Windows.Forms.ContextMenu();
     this.mnuNewAdd = new System.Windows.Forms.MenuItem();
     this.Tooltip = new System.Windows.Forms.ToolTip(this.components);
     this.dlgInputFileSelection = new System.Windows.Forms.OpenFileDialog();
     this.panel1.SuspendLayout();
     this.tabSctInputPart.SuspendLayout();
     this.tabInputText.SuspendLayout();
     this.c1ToolBar1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.c1CommandHolder1)).BeginInit();
     this.tabReplaceWith.SuspendLayout();
     this.tabControl1.SuspendLayout();
     this.tabMatches.SuspendLayout();
     this.tabOutput.SuspendLayout();
     this.tabSplits.SuspendLayout();
     this.panel3.SuspendLayout();
     this.panel2.SuspendLayout();
     this.SuspendLayout();
     //
     // cmdMultiline
     //
     this.cmdMultiline.CheckAutoToggle = true;
     this.cmdMultiline.Image = ((System.Drawing.Image)(resources.GetObject("cmdMultiline.Image")));
     this.cmdMultiline.Name = "cmdMultiline";
     this.cmdMultiline.Text = "Multiline";
     //
     // cmdSingleLine
     //
     this.cmdSingleLine.CheckAutoToggle = true;
     this.cmdSingleLine.Image = ((System.Drawing.Image)(resources.GetObject("cmdSingleLine.Image")));
     this.cmdSingleLine.Name = "cmdSingleLine";
     this.cmdSingleLine.Text = "Single line";
     //
     // cmdMatch
     //
     this.cmdMatch.Image = ((System.Drawing.Image)(resources.GetObject("cmdMatch.Image")));
     this.cmdMatch.Name = "cmdMatch";
     this.cmdMatch.Shortcut = System.Windows.Forms.Shortcut.CtrlM;
     this.cmdMatch.Text = "Match";
     //
     // cmdIgnoreCase
     //
     this.cmdIgnoreCase.CheckAutoToggle = true;
     this.cmdIgnoreCase.Image = ((System.Drawing.Image)(resources.GetObject("cmdIgnoreCase.Image")));
     this.cmdIgnoreCase.Name = "cmdIgnoreCase";
     this.cmdIgnoreCase.Text = "seperator";
     //
     // cmdExplicitCapture
     //
     this.cmdExplicitCapture.CheckAutoToggle = true;
     this.cmdExplicitCapture.Image = ((System.Drawing.Image)(resources.GetObject("cmdExplicitCapture.Image")));
     this.cmdExplicitCapture.Name = "cmdExplicitCapture";
     this.cmdExplicitCapture.Text = "Explicit capture";
     //
     // panel1
     //
     this.panel1.Controls.Add(this.tabSctInputPart);
     this.panel1.Controls.Add(this.splitter2);
     this.panel1.Controls.Add(this.tabControl1);
     this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
     this.panel1.Location = new System.Drawing.Point(0, 282);
     this.panel1.Name = "panel1";
     this.panel1.Size = new System.Drawing.Size(552, 171);
     this.panel1.TabIndex = 6;
     //
     // tabSctInputPart
     //
     this.tabSctInputPart.Appearance = System.Windows.Forms.TabAppearance.FlatButtons;
     this.tabSctInputPart.Controls.Add(this.tabInputText);
     this.tabSctInputPart.Controls.Add(this.tabReplaceWith);
     this.tabSctInputPart.Dock = System.Windows.Forms.DockStyle.Fill;
     this.tabSctInputPart.Location = new System.Drawing.Point(272, 0);
     this.tabSctInputPart.Name = "tabSctInputPart";
     this.tabSctInputPart.SelectedIndex = 0;
     this.tabSctInputPart.Size = new System.Drawing.Size(280, 171);
     this.tabSctInputPart.TabIndex = 0;
     this.tabSctInputPart.Enter += new System.EventHandler(this.tabSctInputPart_Enter);
     //
     // tabInputText
     //
     this.tabInputText.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.tabInputText.Controls.Add(this.c1ToolBar1);
     this.tabInputText.Controls.Add(this.txtInput);
     this.tabInputText.Location = new System.Drawing.Point(4, 25);
     this.tabInputText.Name = "tabInputText";
     this.tabInputText.Size = new System.Drawing.Size(272, 142);
     this.tabInputText.TabIndex = 0;
     this.tabInputText.Text = "Input";
     //
     // c1ToolBar1
     //
     this.c1ToolBar1.AutoSize = false;
     this.c1ToolBar1.CommandHolder = this.c1CommandHolder1;
     this.c1ToolBar1.CommandLinks.Add(this.c1CommandLink1);
     this.c1ToolBar1.CommandLinks.Add(this.c1CommandLink2);
     this.c1ToolBar1.CommandLinks.Add(this.c1CommandLink3);
     this.c1ToolBar1.Controls.Add(this.txtInputFilename);
     this.c1ToolBar1.Dock = System.Windows.Forms.DockStyle.Top;
     this.c1ToolBar1.Location = new System.Drawing.Point(0, 0);
     this.c1ToolBar1.Name = "c1ToolBar1";
     this.c1ToolBar1.Size = new System.Drawing.Size(270, 24);
     this.c1ToolBar1.Text = "c1ToolBar1";
     this.c1ToolBar1.Click += new System.EventHandler(this.c1ToolBar1_Click);
     this.c1ToolBar1.Enter += new System.EventHandler(this.c1ToolBar1_Enter);
     //
     // c1CommandHolder1
     //
     this.c1CommandHolder1.Commands.Add(this.cmdReplace);
     this.c1CommandHolder1.Commands.Add(this.cmdMatch);
     this.c1CommandHolder1.Commands.Add(this.cmdCancelAction);
     this.c1CommandHolder1.Commands.Add(this.cmdIgnoreCase);
     this.c1CommandHolder1.Commands.Add(this.cmdMultiline);
     this.c1CommandHolder1.Commands.Add(this.cmdSingleLine);
     this.c1CommandHolder1.Commands.Add(this.cmdExplicitCapture);
     this.c1CommandHolder1.Commands.Add(this.cmdECMAScript);
     this.c1CommandHolder1.Commands.Add(this.cmdRightToLeft);
     this.c1CommandHolder1.Commands.Add(this.cmdIgnoreWS);
     this.c1CommandHolder1.Commands.Add(this.mnuInputFile);
     this.c1CommandHolder1.Commands.Add(this.cmdmnuSelectInputFile);
     this.c1CommandHolder1.Commands.Add(this.cmdmnuRefreshFromInputFile);
     this.c1CommandHolder1.Owner = this;
     //
     // cmdReplace
     //
     this.cmdReplace.Image = ((System.Drawing.Image)(resources.GetObject("cmdReplace.Image")));
     this.cmdReplace.Name = "cmdReplace";
     this.cmdReplace.Shortcut = System.Windows.Forms.Shortcut.CtrlR;
     this.cmdReplace.Text = "Replace";
     //
     // cmdCancelAction
     //
     this.cmdCancelAction.Image = ((System.Drawing.Image)(resources.GetObject("cmdCancelAction.Image")));
     this.cmdCancelAction.Name = "cmdCancelAction";
     this.cmdCancelAction.Shortcut = System.Windows.Forms.Shortcut.F9;
     this.cmdCancelAction.Text = "&Cancel action";
     //
     // cmdECMAScript
     //
     this.cmdECMAScript.CheckAutoToggle = true;
     this.cmdECMAScript.Image = ((System.Drawing.Image)(resources.GetObject("cmdECMAScript.Image")));
     this.cmdECMAScript.Name = "cmdECMAScript";
     this.cmdECMAScript.Text = "ECMA script";
     //
     // cmdRightToLeft
     //
     this.cmdRightToLeft.CheckAutoToggle = true;
     this.cmdRightToLeft.Image = ((System.Drawing.Image)(resources.GetObject("cmdRightToLeft.Image")));
     this.cmdRightToLeft.Name = "cmdRightToLeft";
     this.cmdRightToLeft.Text = "Right to left";
     //
     // cmdIgnoreWS
     //
     this.cmdIgnoreWS.CheckAutoToggle = true;
     this.cmdIgnoreWS.Image = ((System.Drawing.Image)(resources.GetObject("cmdIgnoreWS.Image")));
     this.cmdIgnoreWS.Name = "cmdIgnoreWS";
     this.cmdIgnoreWS.Text = "Ignore pattern whitespace";
     //
     // mnuInputFile
     //
     this.mnuInputFile.Control = this.txtInputFilename;
     this.mnuInputFile.Name = "mnuInputFile";
     this.mnuInputFile.Text = "Input file";
     //
     // txtInputFilename
     //
     this.txtInputFilename.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(239)), ((System.Byte)(239)));
     this.txtInputFilename.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.txtInputFilename.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
     this.txtInputFilename.Location = new System.Drawing.Point(4, 2);
     this.txtInputFilename.Name = "txtInputFilename";
     this.txtInputFilename.Size = new System.Drawing.Size(204, 21);
     this.txtInputFilename.TabIndex = 1;
     this.txtInputFilename.TabStop = false;
     this.txtInputFilename.Text = "Input file";
     this.Tooltip.SetToolTip(this.txtInputFilename, "Input file for this document");
     this.txtInputFilename.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtInputFilename_KeyDown);
     this.txtInputFilename.MouseDown += new System.Windows.Forms.MouseEventHandler(this.txtInputFilename_MouseDown);
     this.txtInputFilename.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtInputFilename_KeyPress);
     this.txtInputFilename.TextChanged += new System.EventHandler(this.txtInputFilename_TextChanged);
     this.txtInputFilename.Enter += new System.EventHandler(this.txtInputFilename_Enter);
     //
     // cmdmnuSelectInputFile
     //
     this.cmdmnuSelectInputFile.Image = ((System.Drawing.Image)(resources.GetObject("cmdmnuSelectInputFile.Image")));
     this.cmdmnuSelectInputFile.Name = "cmdmnuSelectInputFile";
     this.cmdmnuSelectInputFile.ShowTextAsToolTip = false;
     this.cmdmnuSelectInputFile.Text = "Select input file...";
     this.cmdmnuSelectInputFile.ToolTipText = "Select input file...";
     this.cmdmnuSelectInputFile.Click += new C1.Win.C1Command.ClickEventHandler(this.cmdmnuSelectInputFile_Click);
     //
     // cmdmnuRefreshFromInputFile
     //
     this.cmdmnuRefreshFromInputFile.Image = ((System.Drawing.Image)(resources.GetObject("cmdmnuRefreshFromInputFile.Image")));
     this.cmdmnuRefreshFromInputFile.Name = "cmdmnuRefreshFromInputFile";
     this.cmdmnuRefreshFromInputFile.Text = "Refresh current input from input file";
     this.cmdmnuRefreshFromInputFile.Click += new C1.Win.C1Command.ClickEventHandler(this.cmdmnuRefreshFromInputFile_Click);
     //
     // c1CommandLink1
     //
     this.c1CommandLink1.Command = this.mnuInputFile;
     //
     // c1CommandLink2
     //
     this.c1CommandLink2.Command = this.cmdmnuSelectInputFile;
     //
     // c1CommandLink3
     //
     this.c1CommandLink3.Command = this.cmdmnuRefreshFromInputFile;
     //
     // txtInput
     //
     this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
         | System.Windows.Forms.AnchorStyles.Left)
         | System.Windows.Forms.AnchorStyles.Right)));
     this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.txtInput.DetectUrls = false;
     this.txtInput.Font = new System.Drawing.Font("Verdana", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
     this.txtInput.HideSelection = false;
     this.txtInput.Location = new System.Drawing.Point(0, 24);
     this.txtInput.Name = "txtInput";
     this.txtInput.Size = new System.Drawing.Size(272, 120);
     this.txtInput.TabIndex = 1;
     this.txtInput.Text = "Input text";
     this.txtInput.TextChanged += new System.EventHandler(this.txtInput_TextChanged);
     //
     // tabReplaceWith
     //
     this.tabReplaceWith.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.tabReplaceWith.Controls.Add(this.txtReplaceWith);
     this.tabReplaceWith.Location = new System.Drawing.Point(4, 25);
     this.tabReplaceWith.Name = "tabReplaceWith";
     this.tabReplaceWith.Size = new System.Drawing.Size(272, 142);
     this.tabReplaceWith.TabIndex = 1;
     this.tabReplaceWith.Text = "Replace with";
     this.tabReplaceWith.Visible = false;
     //
     // txtReplaceWith
     //
     this.txtReplaceWith.Dirty = false;
     this.txtReplaceWith.Dock = System.Windows.Forms.DockStyle.Fill;
     this.txtReplaceWith.Location = new System.Drawing.Point(0, 0);
     this.txtReplaceWith.Name = "txtReplaceWith";
     this.txtReplaceWith.NamedGroupsMode = true;
     this.txtReplaceWith.ReadOnly = false;
     this.txtReplaceWith.Size = new System.Drawing.Size(270, 140);
     this.txtReplaceWith.TabIndex = 2;
     this.txtReplaceWith.Updated += new System.EventHandler(this.txtReplaceWith_Updated);
     //
     // splitter2
     //
     this.splitter2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
     this.splitter2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.splitter2.Location = new System.Drawing.Point(264, 0);
     this.splitter2.Name = "splitter2";
     this.splitter2.Size = new System.Drawing.Size(8, 171);
     this.splitter2.TabIndex = 1;
     this.splitter2.TabStop = false;
     //
     // tabControl1
     //
     this.tabControl1.Appearance = System.Windows.Forms.TabAppearance.FlatButtons;
     this.tabControl1.Controls.Add(this.tabMatches);
     this.tabControl1.Controls.Add(this.tabOutput);
     this.tabControl1.Controls.Add(this.tabSplits);
     this.tabControl1.Dock = System.Windows.Forms.DockStyle.Left;
     this.tabControl1.Location = new System.Drawing.Point(0, 0);
     this.tabControl1.Name = "tabControl1";
     this.tabControl1.SelectedIndex = 0;
     this.tabControl1.Size = new System.Drawing.Size(264, 171);
     this.tabControl1.TabIndex = 1;
     //
     // tabMatches
     //
     this.tabMatches.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
     this.tabMatches.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.tabMatches.Controls.Add(this.Tree);
     this.tabMatches.Location = new System.Drawing.Point(4, 25);
     this.tabMatches.Name = "tabMatches";
     this.tabMatches.Size = new System.Drawing.Size(256, 142);
     this.tabMatches.TabIndex = 0;
     this.tabMatches.Text = "Matches";
     //
     // Tree
     //
     this.Tree.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.Tree.Dock = System.Windows.Forms.DockStyle.Fill;
     this.Tree.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(177)));
     this.Tree.ImageList = this.imglstTree;
     this.Tree.Location = new System.Drawing.Point(0, 0);
     this.Tree.Name = "Tree";
     this.Tree.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
                                                                      new System.Windows.Forms.TreeNode("Matches")});
     this.Tree.Size = new System.Drawing.Size(254, 140);
     this.Tree.TabIndex = 0;
     this.Tree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.Tree_AfterSelect);
     //
     // imglstTree
     //
     this.imglstTree.ImageSize = new System.Drawing.Size(16, 16);
     this.imglstTree.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imglstTree.ImageStream")));
     this.imglstTree.TransparentColor = System.Drawing.Color.Transparent;
     //
     // tabOutput
     //
     this.tabOutput.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
     this.tabOutput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.tabOutput.Controls.Add(this.txtOutputReplace);
     this.tabOutput.Location = new System.Drawing.Point(4, 25);
     this.tabOutput.Name = "tabOutput";
     this.tabOutput.Size = new System.Drawing.Size(256, 142);
     this.tabOutput.TabIndex = 1;
     this.tabOutput.Text = "Replace output";
     this.tabOutput.Visible = false;
     //
     // txtOutputReplace
     //
     this.txtOutputReplace.BackColor = System.Drawing.Color.White;
     this.txtOutputReplace.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.txtOutputReplace.DetectUrls = false;
     this.txtOutputReplace.Dock = System.Windows.Forms.DockStyle.Fill;
     this.txtOutputReplace.Font = new System.Drawing.Font("Verdana", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
     this.txtOutputReplace.Location = new System.Drawing.Point(0, 0);
     this.txtOutputReplace.Name = "txtOutputReplace";
     this.txtOutputReplace.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
     this.txtOutputReplace.Size = new System.Drawing.Size(254, 140);
     this.txtOutputReplace.TabIndex = 0;
     this.txtOutputReplace.Text = "Replace output";
     //
     // tabSplits
     //
     this.tabSplits.Controls.Add(this.lvSplits);
     this.tabSplits.Location = new System.Drawing.Point(4, 25);
     this.tabSplits.Name = "tabSplits";
     this.tabSplits.Size = new System.Drawing.Size(256, 142);
     this.tabSplits.TabIndex = 2;
     this.tabSplits.Text = "Splits";
     //
     // lvSplits
     //
     this.lvSplits.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(231)), ((System.Byte)(245)), ((System.Byte)(252)));
     this.lvSplits.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.lvSplits.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                                                                                this.Index,
                                                                                this.text});
     this.lvSplits.Dock = System.Windows.Forms.DockStyle.Fill;
     this.lvSplits.FullRowSelect = true;
     this.lvSplits.GridLines = true;
     this.lvSplits.Location = new System.Drawing.Point(0, 0);
     this.lvSplits.Name = "lvSplits";
     this.lvSplits.Size = new System.Drawing.Size(256, 142);
     this.lvSplits.TabIndex = 0;
     this.lvSplits.View = System.Windows.Forms.View.Details;
     //
     // Index
     //
     this.Index.Text = "index";
     this.Index.Width = 44;
     //
     // text
     //
     this.text.Text = "text";
     this.text.Width = 204;
     //
     // panel3
     //
     this.panel3.Controls.Add(this.panel2);
     this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
     this.panel3.Location = new System.Drawing.Point(0, 0);
     this.panel3.Name = "panel3";
     this.panel3.Size = new System.Drawing.Size(552, 276);
     this.panel3.TabIndex = 7;
     //
     // panel2
     //
     this.panel2.Controls.Add(this.txtRegex);
     this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
     this.panel2.Location = new System.Drawing.Point(0, 0);
     this.panel2.Name = "panel2";
     this.panel2.Size = new System.Drawing.Size(552, 276);
     this.panel2.TabIndex = 0;
     this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint_1);
     //
     // txtRegex
     //
     this.txtRegex.Dirty = false;
     this.txtRegex.Location = new System.Drawing.Point(24, 8);
     this.txtRegex.Name = "txtRegex";
     this.txtRegex.NamedGroupsMode = false;
     this.txtRegex.ReadOnly = false;
     this.txtRegex.Size = new System.Drawing.Size(424, 184);
     this.txtRegex.TabIndex = 1;
     //
     // splitter1
     //
     this.splitter1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
     this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom;
     this.splitter1.Location = new System.Drawing.Point(0, 276);
     this.splitter1.Name = "splitter1";
     this.splitter1.Size = new System.Drawing.Size(552, 6);
     this.splitter1.TabIndex = 8;
     this.splitter1.TabStop = false;
     //
     // QuickRegexContexMenu
     //
     this.QuickRegexContexMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                          this.mnuNewAdd});
     //
     // mnuNewAdd
     //
     this.mnuNewAdd.Index = 0;
     this.mnuNewAdd.Text = "test new add";
     //
     // dlgInputFileSelection
     //
     this.dlgInputFileSelection.Filter = "*.*|*.*";
     //
     // RegexDocument
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
     this.ClientSize = new System.Drawing.Size(552, 453);
     this.Controls.Add(this.panel3);
     this.Controls.Add(this.splitter1);
     this.Controls.Add(this.panel1);
     this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
     this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name = "RegexDocument";
     this.Text = "RegexDocument";
     this.Closing += new System.ComponentModel.CancelEventHandler(this.RegexDocument_Closing);
     this.Load += new System.EventHandler(this.RegexDocument_Load);
     this.Activated += new System.EventHandler(this.RegexDocument_Activated);
     this.panel1.ResumeLayout(false);
     this.tabSctInputPart.ResumeLayout(false);
     this.tabInputText.ResumeLayout(false);
     this.c1ToolBar1.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.c1CommandHolder1)).EndInit();
     this.tabReplaceWith.ResumeLayout(false);
     this.tabControl1.ResumeLayout(false);
     this.tabMatches.ResumeLayout(false);
     this.tabOutput.ResumeLayout(false);
     this.tabSplits.ResumeLayout(false);
     this.panel3.ResumeLayout(false);
     this.panel2.ResumeLayout(false);
     this.ResumeLayout(false);
 }
Exemplo n.º 13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\ComponentOne Samples\Common\";

            if (File.Exists(path + "c1nwind.mdb"))
            {
                AppDomain.CurrentDomain.SetData("DataDirectory", path);
            }

            // TODO: This line of code loads data into the 'c1NWINDDataSet.Employees' table. You can move, or remove it, as needed.
            this.employeesTableAdapter.Fill(this.c1NWINDDataSet.Employees);

            //
            // initialize C1Schedule
            //
            csMain.ShowReminderForm = false;

            DateTime    now = DateTime.Now;
            Appointment app = csMain.DataStorage.AppointmentStorage.Appointments.Add(new DateTime(now.Year, now.Month, now.Day, now.Hour, 0, 0), TimeSpan.FromHours(1));

            app.Subject  = "test appointment";
            app.Location = "test location";
            app.Categories.Add(csMain.DataStorage.CategoryStorage.Categories[0]);

            app             = csMain.DataStorage.AppointmentStorage.Appointments.Add(new DateTime(now.Year, now.Month, now.Day).AddDays(1), TimeSpan.FromHours(24));
            app.Subject     = "test event";
            app.AllDayEvent = true;
            app.Location    = "test location";
            app.Categories.Add(csMain.DataStorage.CategoryStorage.Categories[0]);

            //
            // initialize C1TrueDBGrid
            //
            _trueGridOptions.ShowCaption     = true;
            _trueGridOptions.ShowFilterBar   = true;
            _trueGridOptions.ShowGroupByArea = true;
            _trueGridOptions.DataView        = C1.Win.C1TrueDBGrid.DataViewEnum.Normal;

            //
            // initialize C1FlexGrid
            //
            _flexGridOptions.ViewMode       = FlexViewModeEnum.Normal;
            _flexGridOptions.FrozenColCount = 3;

            //
            FillItems(ccmCFGSelectionMode, typeof(C1.Win.C1FlexGrid.SelectionModeEnum), SelectionModeCommandClick, SelectionModeCommandStateQuery);
            FillItems(ccmCFGFocusRect, typeof(C1.Win.C1FlexGrid.FocusRectEnum), FocusRectCommandClick, FocusRectCommandStateQuery);
            FillItems(csbSelectionMode, typeof(SelectionModeEnum));
            FillItems(csbFocusRect, typeof(FocusRectEnum));

            //
            UpdateControls();

            //
            c1DockingTab2_SelectedTabChanged(null, EventArgs.Empty);

            // fill list of themes
            string[] themes = C1ThemeController.GetThemes();
            ccmTheme.CommandLinks.Clear();
            for (int i = 0; i < themes.Length; i++)
            {
                C1Command cmd = new C1Command();
                cmd.Text               = themes[i];
                cmd.UserData           = themes[i];
                cmd.CommandStateQuery += OnThemeCommandStateQuery;
                cmd.Click             += OnThemeClick;
                C1CommandLink cl = new C1CommandLink(cmd);
                ccmTheme.CommandLinks.Add(cl);
            }
            ccmTheme.Text = string.Format("Theme: {0}", C1ThemeController.ApplicationTheme);
        }
        private void button1_Click(object sender, System.EventArgs e)
        {
            try
            {
                // Create the command holder. This is essential for all C1Command operation
                C1CommandHolder ch = C1CommandHolder.CreateCommandHolder(this);
                // Use the pre-built image list
                ch.ImageList = this.imageList1;

                // Create and set up the Cut command
                C1Command cmdCut = ch.CreateCommand();
                cmdCut.Text               = "C&ut";
                cmdCut.Shortcut           = Shortcut.CtrlX;
                cmdCut.ImageIndex         = 0;
                cmdCut.Click             += new C1.Win.C1Command.ClickEventHandler(clickCut);
                cmdCut.CommandStateQuery += new C1.Win.C1Command.CommandStateQueryEventHandler(queryCut);

                // Create and set up the Copy command
                C1Command cmdCopy = ch.CreateCommand();
                cmdCopy.Text               = "&Copy";
                cmdCopy.Shortcut           = Shortcut.CtrlC;
                cmdCopy.ImageIndex         = 1;
                cmdCopy.Click             += new C1.Win.C1Command.ClickEventHandler(clickCopy);
                cmdCopy.CommandStateQuery += new C1.Win.C1Command.CommandStateQueryEventHandler(queryCopy);

                // Create and set up the Paste command
                C1Command cmdPaste = ch.CreateCommand();
                cmdPaste.Text               = "&Paste";
                cmdPaste.Shortcut           = Shortcut.CtrlV;
                cmdPaste.ImageIndex         = 2;
                cmdPaste.Click             += new C1.Win.C1Command.ClickEventHandler(clickPaste);
                cmdPaste.CommandStateQuery += new C1.Win.C1Command.CommandStateQueryEventHandler(queryPaste);

                // Create and set up the Undo command
                C1Command cmdUndo = ch.CreateCommand();
                cmdUndo.Text               = "&Undo";
                cmdUndo.Shortcut           = Shortcut.CtrlZ;
                cmdUndo.ImageIndex         = -1;
                cmdUndo.Click             += new C1.Win.C1Command.ClickEventHandler(clickUndo);
                cmdUndo.CommandStateQuery += new C1.Win.C1Command.CommandStateQueryEventHandler(queryUndo);

                // Create the context menu to hold other commands
                C1ContextMenu cm = ch.CreateCommand(typeof(C1ContextMenu)) as C1ContextMenu;
                // Fill it with the links to the commands
                cm.CommandLinks.Add(new C1CommandLink(cmdCut));
                cm.CommandLinks.Add(new C1CommandLink(cmdCopy));
                cm.CommandLinks.Add(new C1CommandLink(cmdPaste));
                C1CommandLink cl = new C1CommandLink(cmdUndo);
                // This will show a delimiter before the Undo link.
                // Another option is to create a separate empty link with the text "-".
                cl.Delimiter = true;
                cm.CommandLinks.Add(cl);

                // Assign the new context menu to the text box
                ch.SetC1ContextMenu(textBox1, cm);
            }
            catch
            {
                // Not the best way to code, but used here to illustrate a point:
                // It is impossible to create more than one command holder for a form.
                // The 2nd attempt will fail with an exception. Here we catch and ignore
                // it...
            }
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
     System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("A:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode1
     });
     System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("C:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode3
     });
     System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("D:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode5
     });
     System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("E:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode7
     });
     System.Windows.Forms.TreeNode treeNode9  = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("F:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode9
     });
     System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode12 = new System.Windows.Forms.TreeNode("G:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode11
     });
     System.Windows.Forms.TreeNode treeNode13 = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode14 = new System.Windows.Forms.TreeNode("U:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode13
     });
     System.Windows.Forms.TreeNode treeNode15 = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode16 = new System.Windows.Forms.TreeNode("W:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode15
     });
     System.Windows.Forms.TreeNode treeNode17 = new System.Windows.Forms.TreeNode("...");
     System.Windows.Forms.TreeNode treeNode18 = new System.Windows.Forms.TreeNode("X:", 0, 4, new System.Windows.Forms.TreeNode[] {
         treeNode17
     });
     this.c1MainMenu1          = new C1.Win.C1Command.C1MainMenu();
     this.c1CommandHolder1     = new C1.Win.C1Command.C1CommandHolder();
     this.mnuFile              = new C1.Win.C1Command.C1CommandMenu();
     this.c1CommandLink8       = new C1.Win.C1Command.C1CommandLink();
     this.cmdFileNew           = new C1.Win.C1Command.C1Command();
     this.c1CommandLink9       = new C1.Win.C1Command.C1CommandLink();
     this.cmdFileOpen          = new C1.Win.C1Command.C1Command();
     this.c1CommandLink11      = new C1.Win.C1Command.C1CommandLink();
     this.cmdFileSave          = new C1.Win.C1Command.C1Command();
     this.c1CommandLink3       = new C1.Win.C1Command.C1CommandLink();
     this.cmdExit              = new C1.Win.C1Command.C1Command();
     this.mnuEdit              = new C1.Win.C1Command.C1CommandMenu();
     this.c1CommandLink5       = new C1.Win.C1Command.C1CommandLink();
     this.mnuWindow            = new C1.Win.C1Command.C1CommandMenu();
     this.c1CommandLink7       = new C1.Win.C1Command.C1CommandLink();
     this.cmdWindowCloseAll    = new C1.Win.C1Command.C1Command();
     this.c1CommandMenuOptions = new C1.Win.C1Command.C1CommandMenu();
     this.c1CommandLink14      = new C1.Win.C1Command.C1CommandLink();
     this.c1CommandVS2005      = new C1.Win.C1Command.C1Command();
     this.imageList1           = new System.Windows.Forms.ImageList(this.components);
     this.c1CommandLink1       = new C1.Win.C1Command.C1CommandLink();
     this.c1CommandLink4       = new C1.Win.C1Command.C1CommandLink();
     this.c1CommandLink13      = new C1.Win.C1Command.C1CommandLink();
     this.c1CommandLink6       = new C1.Win.C1Command.C1CommandLink();
     this.dockToolbar          = new C1.Win.C1Command.C1CommandDock();
     this.c1ToolBar1           = new C1.Win.C1Command.C1ToolBar();
     this.c1CommandLink2       = new C1.Win.C1Command.C1CommandLink();
     this.c1CommandLink10      = new C1.Win.C1Command.C1CommandLink();
     this.c1CommandLink12      = new C1.Win.C1Command.C1CommandLink();
     this.dockSidebar          = new C1.Win.C1Command.C1CommandDock();
     this.tabSidebar           = new C1.Win.C1Command.C1DockingTab();
     this.c1DockingTabPage2    = new C1.Win.C1Command.C1DockingTabPage();
     this.dirView              = new MdiTabs.DirView();
     this.c1DockingTabPage1    = new C1.Win.C1Command.C1DockingTabPage();
     this.listOpenFiles        = new System.Windows.Forms.ListBox();
     this.dockTray             = new C1.Win.C1Command.C1CommandDock();
     this.tabTray              = new C1.Win.C1Command.C1DockingTab();
     this.c1DockingTabPage3    = new C1.Win.C1Command.C1DockingTabPage();
     this.textLog              = new System.Windows.Forms.TextBox();
     this.tabMain              = new C1.Win.C1Command.C1DockingTab();
     this.openFileDialog1      = new System.Windows.Forms.OpenFileDialog();
     this.saveFileDialog1      = new System.Windows.Forms.SaveFileDialog();
     ((System.ComponentModel.ISupportInitialize)(this.c1CommandHolder1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.dockToolbar)).BeginInit();
     this.dockToolbar.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dockSidebar)).BeginInit();
     this.dockSidebar.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.tabSidebar)).BeginInit();
     this.tabSidebar.SuspendLayout();
     this.c1DockingTabPage2.SuspendLayout();
     this.c1DockingTabPage1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dockTray)).BeginInit();
     this.dockTray.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.tabTray)).BeginInit();
     this.tabTray.SuspendLayout();
     this.c1DockingTabPage3.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.tabMain)).BeginInit();
     this.SuspendLayout();
     //
     // c1MainMenu1
     //
     this.c1MainMenu1.AccessibleName = "Menu Bar";
     this.c1MainMenu1.CommandHolder  = this.c1CommandHolder1;
     this.c1MainMenu1.CommandLinks.AddRange(new C1.Win.C1Command.C1CommandLink[] {
         this.c1CommandLink1,
         this.c1CommandLink4,
         this.c1CommandLink13,
         this.c1CommandLink6
     });
     this.c1MainMenu1.Dock            = System.Windows.Forms.DockStyle.Top;
     this.c1MainMenu1.Location        = new System.Drawing.Point(0, 0);
     this.c1MainMenu1.Name            = "c1MainMenu1";
     this.c1MainMenu1.Size            = new System.Drawing.Size(760, 21);
     this.c1MainMenu1.VisualStyleBase = C1.Win.C1Command.VisualStyle.OfficeXP;
     //
     // c1CommandHolder1
     //
     this.c1CommandHolder1.Commands.Add(this.mnuFile);
     this.c1CommandHolder1.Commands.Add(this.mnuEdit);
     this.c1CommandHolder1.Commands.Add(this.mnuWindow);
     this.c1CommandHolder1.Commands.Add(this.cmdExit);
     this.c1CommandHolder1.Commands.Add(this.cmdFileNew);
     this.c1CommandHolder1.Commands.Add(this.cmdFileOpen);
     this.c1CommandHolder1.Commands.Add(this.cmdFileSave);
     this.c1CommandHolder1.Commands.Add(this.cmdWindowCloseAll);
     this.c1CommandHolder1.Commands.Add(this.c1CommandMenuOptions);
     this.c1CommandHolder1.Commands.Add(this.c1CommandVS2005);
     this.c1CommandHolder1.ImageList             = this.imageList1;
     this.c1CommandHolder1.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1CommandHolder1.Owner = this;
     //
     // mnuFile
     //
     this.mnuFile.CommandLinks.AddRange(new C1.Win.C1Command.C1CommandLink[] {
         this.c1CommandLink8,
         this.c1CommandLink9,
         this.c1CommandLink11,
         this.c1CommandLink3
     });
     this.mnuFile.Name            = "mnuFile";
     this.mnuFile.Text            = "&File";
     this.mnuFile.VisualStyleBase = C1.Win.C1Command.VisualStyle.OfficeXP;
     //
     // c1CommandLink8
     //
     this.c1CommandLink8.Command = this.cmdFileNew;
     //
     // cmdFileNew
     //
     this.cmdFileNew.ImageIndex = 1;
     this.cmdFileNew.Name       = "cmdFileNew";
     this.cmdFileNew.Text       = "&New";
     this.cmdFileNew.Click     += new C1.Win.C1Command.ClickEventHandler(this.cmdFileNew_Click);
     //
     // c1CommandLink9
     //
     this.c1CommandLink9.Command = this.cmdFileOpen;
     //
     // cmdFileOpen
     //
     this.cmdFileOpen.ImageIndex = 0;
     this.cmdFileOpen.Name       = "cmdFileOpen";
     this.cmdFileOpen.Text       = "&Open";
     this.cmdFileOpen.Click     += new C1.Win.C1Command.ClickEventHandler(this.cmdFileOpen_Click);
     //
     // c1CommandLink11
     //
     this.c1CommandLink11.Command = this.cmdFileSave;
     //
     // cmdFileSave
     //
     this.cmdFileSave.ImageIndex         = 2;
     this.cmdFileSave.Name               = "cmdFileSave";
     this.cmdFileSave.Text               = "&Save";
     this.cmdFileSave.CommandStateQuery += new C1.Win.C1Command.CommandStateQueryEventHandler(this.cmdFileSave_CommandStateQuery);
     this.cmdFileSave.Click             += new C1.Win.C1Command.ClickEventHandler(this.cmdFileSave_Click);
     //
     // c1CommandLink3
     //
     this.c1CommandLink3.Command   = this.cmdExit;
     this.c1CommandLink3.Delimiter = true;
     //
     // cmdExit
     //
     this.cmdExit.Name   = "cmdExit";
     this.cmdExit.Text   = "E&xit";
     this.cmdExit.Click += new C1.Win.C1Command.ClickEventHandler(this.cmdExit_Click);
     //
     // mnuEdit
     //
     this.mnuEdit.CommandLinks.AddRange(new C1.Win.C1Command.C1CommandLink[] {
         this.c1CommandLink5
     });
     this.mnuEdit.HideNonRecentLinks = false;
     this.mnuEdit.Name            = "mnuEdit";
     this.mnuEdit.Text            = "&Edit";
     this.mnuEdit.VisualStyleBase = C1.Win.C1Command.VisualStyle.OfficeXP;
     //
     // c1CommandLink5
     //
     this.c1CommandLink5.Text = "[TBD]";
     //
     // mnuWindow
     //
     this.mnuWindow.CommandLinks.AddRange(new C1.Win.C1Command.C1CommandLink[] {
         this.c1CommandLink7
     });
     this.mnuWindow.HideNonRecentLinks = false;
     this.mnuWindow.Name            = "mnuWindow";
     this.mnuWindow.Text            = "&Window";
     this.mnuWindow.VisualStyleBase = C1.Win.C1Command.VisualStyle.OfficeXP;
     this.mnuWindow.Popup          += new System.EventHandler(this.mnuWindow_Popup);
     //
     // c1CommandLink7
     //
     this.c1CommandLink7.Command = this.cmdWindowCloseAll;
     //
     // cmdWindowCloseAll
     //
     this.cmdWindowCloseAll.Name = "cmdWindowCloseAll";
     this.cmdWindowCloseAll.Text = "Close &All";
     this.cmdWindowCloseAll.CommandStateQuery += new C1.Win.C1Command.CommandStateQueryEventHandler(this.cmdWindowCloseAll_CommandStateQuery);
     this.cmdWindowCloseAll.Click             += new C1.Win.C1Command.ClickEventHandler(this.cmdWindowCloseAll_Click);
     //
     // c1CommandMenuOptions
     //
     this.c1CommandMenuOptions.CommandLinks.AddRange(new C1.Win.C1Command.C1CommandLink[] {
         this.c1CommandLink14
     });
     this.c1CommandMenuOptions.HideNonRecentLinks = false;
     this.c1CommandMenuOptions.Name            = "c1CommandMenuOptions";
     this.c1CommandMenuOptions.Text            = "O&ptions";
     this.c1CommandMenuOptions.VisualStyleBase = C1.Win.C1Command.VisualStyle.OfficeXP;
     //
     // c1CommandLink14
     //
     this.c1CommandLink14.Command = this.c1CommandVS2005;
     //
     // c1CommandVS2005
     //
     this.c1CommandVS2005.CheckAutoToggle = true;
     this.c1CommandVS2005.Checked         = true;
     this.c1CommandVS2005.Name            = "c1CommandVS2005";
     this.c1CommandVS2005.Text            = "VS2005 Docking";
     this.c1CommandVS2005.CheckedChanged += new C1.Win.C1Command.CheckedChangedEventHandler(this.c1CommandVS2005_CheckedChanged);
     //
     // imageList1
     //
     this.imageList1.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
     this.imageList1.TransparentColor = System.Drawing.Color.Magenta;
     this.imageList1.Images.SetKeyName(0, "");
     this.imageList1.Images.SetKeyName(1, "");
     this.imageList1.Images.SetKeyName(2, "");
     //
     // c1CommandLink1
     //
     this.c1CommandLink1.Command = this.mnuFile;
     //
     // c1CommandLink4
     //
     this.c1CommandLink4.Command   = this.mnuEdit;
     this.c1CommandLink4.SortOrder = 1;
     //
     // c1CommandLink13
     //
     this.c1CommandLink13.Command   = this.c1CommandMenuOptions;
     this.c1CommandLink13.SortOrder = 2;
     //
     // c1CommandLink6
     //
     this.c1CommandLink6.Command   = this.mnuWindow;
     this.c1CommandLink6.SortOrder = 3;
     //
     // dockToolbar
     //
     this.dockToolbar.Controls.Add(this.c1ToolBar1);
     this.dockToolbar.Id       = 1;
     this.dockToolbar.Location = new System.Drawing.Point(0, 21);
     this.dockToolbar.Name     = "dockToolbar";
     this.dockToolbar.Size     = new System.Drawing.Size(760, 24);
     //
     // c1ToolBar1
     //
     this.c1ToolBar1.CommandHolder = this.c1CommandHolder1;
     this.c1ToolBar1.CommandLinks.AddRange(new C1.Win.C1Command.C1CommandLink[] {
         this.c1CommandLink2,
         this.c1CommandLink10,
         this.c1CommandLink12
     });
     this.c1ToolBar1.Location        = new System.Drawing.Point(0, 0);
     this.c1ToolBar1.Name            = "c1ToolBar1";
     this.c1ToolBar1.Size            = new System.Drawing.Size(77, 24);
     this.c1ToolBar1.Text            = "c1ToolBar1";
     this.c1ToolBar1.VisualStyleBase = C1.Win.C1Command.VisualStyle.OfficeXP;
     //
     // c1CommandLink2
     //
     this.c1CommandLink2.Command = this.cmdFileNew;
     //
     // c1CommandLink10
     //
     this.c1CommandLink10.Command = this.cmdFileOpen;
     //
     // c1CommandLink12
     //
     this.c1CommandLink12.Command = this.cmdFileSave;
     //
     // dockSidebar
     //
     this.dockSidebar.BackColor = System.Drawing.SystemColors.ControlDark;
     this.dockSidebar.Controls.Add(this.tabSidebar);
     this.dockSidebar.Dock     = System.Windows.Forms.DockStyle.Right;
     this.dockSidebar.Id       = 3;
     this.dockSidebar.Location = new System.Drawing.Point(592, 45);
     this.dockSidebar.Name     = "dockSidebar";
     this.dockSidebar.Size     = new System.Drawing.Size(168, 504);
     //
     // tabSidebar
     //
     this.tabSidebar.Alignment    = System.Windows.Forms.TabAlignment.Bottom;
     this.tabSidebar.BorderStyle  = System.Windows.Forms.BorderStyle.None;
     this.tabSidebar.CanAutoHide  = true;
     this.tabSidebar.CanCloseTabs = true;
     this.tabSidebar.CanMoveTabs  = true;
     this.tabSidebar.Controls.Add(this.c1DockingTabPage2);
     this.tabSidebar.Controls.Add(this.c1DockingTabPage1);
     this.tabSidebar.Location        = new System.Drawing.Point(0, 0);
     this.tabSidebar.Name            = "tabSidebar";
     this.tabSidebar.ShowCaption     = true;
     this.tabSidebar.Size            = new System.Drawing.Size(168, 504);
     this.tabSidebar.TabIndex        = 0;
     this.tabSidebar.TabSizeMode     = C1.Win.C1Command.TabSizeModeEnum.Fit;
     this.tabSidebar.TabsSpacing     = 0;
     this.tabSidebar.VisualStyleBase = C1.Win.C1Command.VisualStyle.OfficeXP;
     //
     // c1DockingTabPage2
     //
     this.c1DockingTabPage2.Controls.Add(this.dirView);
     this.c1DockingTabPage2.Location = new System.Drawing.Point(3, 0);
     this.c1DockingTabPage2.Name     = "c1DockingTabPage2";
     this.c1DockingTabPage2.Size     = new System.Drawing.Size(165, 480);
     this.c1DockingTabPage2.TabIndex = 0;
     this.c1DockingTabPage2.Text     = "Directory Listing";
     //
     // dirView
     //
     this.dirView.Dock   = System.Windows.Forms.DockStyle.Fill;
     this.dirView.Filter = new string[] {
         "*.rtf",
         "*.txt"
     };
     this.dirView.ImageIndex       = 0;
     this.dirView.Location         = new System.Drawing.Point(0, 20);
     this.dirView.Name             = "dirView";
     treeNode1.Name                = "";
     treeNode1.Tag                 = ((object)(resources.GetObject("treeNode1.Tag")));
     treeNode1.Text                = "...";
     treeNode2.ImageIndex          = 0;
     treeNode2.Name                = "";
     treeNode2.SelectedImageIndex  = 4;
     treeNode2.Tag                 = ((object)(resources.GetObject("treeNode2.Tag")));
     treeNode2.Text                = "A:";
     treeNode3.Name                = "";
     treeNode3.Tag                 = ((object)(resources.GetObject("treeNode3.Tag")));
     treeNode3.Text                = "...";
     treeNode4.ImageIndex          = 0;
     treeNode4.Name                = "";
     treeNode4.SelectedImageIndex  = 4;
     treeNode4.Tag                 = ((object)(resources.GetObject("treeNode4.Tag")));
     treeNode4.Text                = "C:";
     treeNode5.Name                = "";
     treeNode5.Tag                 = ((object)(resources.GetObject("treeNode5.Tag")));
     treeNode5.Text                = "...";
     treeNode6.ImageIndex          = 0;
     treeNode6.Name                = "";
     treeNode6.SelectedImageIndex  = 4;
     treeNode6.Tag                 = ((object)(resources.GetObject("treeNode6.Tag")));
     treeNode6.Text                = "D:";
     treeNode7.Name                = "";
     treeNode7.Tag                 = ((object)(resources.GetObject("treeNode7.Tag")));
     treeNode7.Text                = "...";
     treeNode8.ImageIndex          = 0;
     treeNode8.Name                = "";
     treeNode8.SelectedImageIndex  = 4;
     treeNode8.Tag                 = ((object)(resources.GetObject("treeNode8.Tag")));
     treeNode8.Text                = "E:";
     treeNode9.Name                = "";
     treeNode9.Tag                 = ((object)(resources.GetObject("treeNode9.Tag")));
     treeNode9.Text                = "...";
     treeNode10.ImageIndex         = 0;
     treeNode10.Name               = "";
     treeNode10.SelectedImageIndex = 4;
     treeNode10.Tag                = ((object)(resources.GetObject("treeNode10.Tag")));
     treeNode10.Text               = "F:";
     treeNode11.Name               = "";
     treeNode11.Tag                = ((object)(resources.GetObject("treeNode11.Tag")));
     treeNode11.Text               = "...";
     treeNode12.ImageIndex         = 0;
     treeNode12.Name               = "";
     treeNode12.SelectedImageIndex = 4;
     treeNode12.Tag                = ((object)(resources.GetObject("treeNode12.Tag")));
     treeNode12.Text               = "G:";
     treeNode13.Name               = "";
     treeNode13.Tag                = ((object)(resources.GetObject("treeNode13.Tag")));
     treeNode13.Text               = "...";
     treeNode14.ImageIndex         = 0;
     treeNode14.Name               = "";
     treeNode14.SelectedImageIndex = 4;
     treeNode14.Tag                = ((object)(resources.GetObject("treeNode14.Tag")));
     treeNode14.Text               = "U:";
     treeNode15.Name               = "";
     treeNode15.Tag                = ((object)(resources.GetObject("treeNode15.Tag")));
     treeNode15.Text               = "...";
     treeNode16.ImageIndex         = 0;
     treeNode16.Name               = "";
     treeNode16.SelectedImageIndex = 4;
     treeNode16.Tag                = ((object)(resources.GetObject("treeNode16.Tag")));
     treeNode16.Text               = "W:";
     treeNode17.Name               = "";
     treeNode17.Tag                = ((object)(resources.GetObject("treeNode17.Tag")));
     treeNode17.Text               = "...";
     treeNode18.ImageIndex         = 0;
     treeNode18.Name               = "";
     treeNode18.SelectedImageIndex = 4;
     treeNode18.Tag                = ((object)(resources.GetObject("treeNode18.Tag")));
     treeNode18.Text               = "X:";
     this.dirView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
         treeNode2,
         treeNode4,
         treeNode6,
         treeNode8,
         treeNode10,
         treeNode12,
         treeNode14,
         treeNode16,
         treeNode18
     });
     this.dirView.SelectedImageIndex = 0;
     this.dirView.Size      = new System.Drawing.Size(165, 460);
     this.dirView.TabIndex  = 0;
     this.dirView.EditFile += new MdiTabs.DirView.EditFileEventHandler(this.dirView_EditFile);
     //
     // c1DockingTabPage1
     //
     this.c1DockingTabPage1.Controls.Add(this.listOpenFiles);
     this.c1DockingTabPage1.Location = new System.Drawing.Point(3, 0);
     this.c1DockingTabPage1.Name     = "c1DockingTabPage1";
     this.c1DockingTabPage1.Size     = new System.Drawing.Size(165, 480);
     this.c1DockingTabPage1.TabIndex = 1;
     this.c1DockingTabPage1.Text     = "Open Files";
     //
     // listOpenFiles
     //
     this.listOpenFiles.Dock         = System.Windows.Forms.DockStyle.Fill;
     this.listOpenFiles.Location     = new System.Drawing.Point(0, 20);
     this.listOpenFiles.Name         = "listOpenFiles";
     this.listOpenFiles.Size         = new System.Drawing.Size(165, 459);
     this.listOpenFiles.TabIndex     = 0;
     this.listOpenFiles.DoubleClick += new System.EventHandler(this.listOpenFiles_DoubleClick);
     //
     // dockTray
     //
     this.dockTray.BackColor = System.Drawing.SystemColors.Window;
     this.dockTray.Controls.Add(this.tabTray);
     this.dockTray.Dock     = System.Windows.Forms.DockStyle.Bottom;
     this.dockTray.Id       = 4;
     this.dockTray.Location = new System.Drawing.Point(0, 421);
     this.dockTray.Name     = "dockTray";
     this.dockTray.Size     = new System.Drawing.Size(592, 128);
     //
     // tabTray
     //
     this.tabTray.Alignment    = System.Windows.Forms.TabAlignment.Bottom;
     this.tabTray.BorderStyle  = System.Windows.Forms.BorderStyle.None;
     this.tabTray.CanAutoHide  = true;
     this.tabTray.CanCloseTabs = true;
     this.tabTray.CanMoveTabs  = true;
     this.tabTray.Controls.Add(this.c1DockingTabPage3);
     this.tabTray.Location        = new System.Drawing.Point(0, 0);
     this.tabTray.Name            = "tabTray";
     this.tabTray.ShowCaption     = true;
     this.tabTray.Size            = new System.Drawing.Size(592, 128);
     this.tabTray.TabIndex        = 0;
     this.tabTray.TabSizeMode     = C1.Win.C1Command.TabSizeModeEnum.Fit;
     this.tabTray.TabsSpacing     = 0;
     this.tabTray.VisualStyleBase = C1.Win.C1Command.VisualStyle.OfficeXP;
     //
     // c1DockingTabPage3
     //
     this.c1DockingTabPage3.Controls.Add(this.textLog);
     this.c1DockingTabPage3.Location = new System.Drawing.Point(0, 3);
     this.c1DockingTabPage3.Name     = "c1DockingTabPage3";
     this.c1DockingTabPage3.Size     = new System.Drawing.Size(592, 101);
     this.c1DockingTabPage3.TabIndex = 0;
     this.c1DockingTabPage3.Text     = "Log";
     //
     // textLog
     //
     this.textLog.Dock       = System.Windows.Forms.DockStyle.Fill;
     this.textLog.Location   = new System.Drawing.Point(0, 20);
     this.textLog.Multiline  = true;
     this.textLog.Name       = "textLog";
     this.textLog.ReadOnly   = true;
     this.textLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
     this.textLog.Size       = new System.Drawing.Size(592, 81);
     this.textLog.TabIndex   = 0;
     //
     // tabMain
     //
     this.tabMain.BackColor             = System.Drawing.SystemColors.AppWorkspace;
     this.tabMain.BorderStyle           = System.Windows.Forms.BorderStyle.FixedSingle;
     this.tabMain.CanCloseTabs          = true;
     this.tabMain.CanMoveTabs           = true;
     this.tabMain.Dock                  = System.Windows.Forms.DockStyle.Fill;
     this.tabMain.Location              = new System.Drawing.Point(0, 45);
     this.tabMain.Name                  = "tabMain";
     this.tabMain.Size                  = new System.Drawing.Size(592, 376);
     this.tabMain.TabIndex              = 5;
     this.tabMain.TabsSpacing           = 0;
     this.tabMain.VisualStyle           = C1.Win.C1Command.VisualStyle.Custom;
     this.tabMain.VisualStyleBase       = C1.Win.C1Command.VisualStyle.OfficeXP;
     this.tabMain.TabPageClosed        += new C1.Win.C1Command.TabPageEventHandler(this.tabMain_TabPageClosed);
     this.tabMain.SelectedIndexChanged += new System.EventHandler(this.tabMain_SelectedIndexChanged);
     this.tabMain.TabPageClosing       += new C1.Win.C1Command.TabPageCancelEventHandler(this.tabMain_TabPageClosing);
     this.tabMain.DoubleClick          += new System.EventHandler(this.tabMain_DoubleClick);
     //
     // openFileDialog1
     //
     this.openFileDialog1.CheckFileExists = false;
     this.openFileDialog1.Filter          = "Rich text files|*.rtf|Text files|*.txt|All files|*.*";
     //
     // saveFileDialog1
     //
     this.saveFileDialog1.Filter = "Rich text files|*.rtf|Text files|*.txt|All files|*.*";
     //
     // MainForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(760, 549);
     this.Controls.Add(this.tabMain);
     this.Controls.Add(this.dockTray);
     this.Controls.Add(this.dockSidebar);
     this.Controls.Add(this.dockToolbar);
     this.Controls.Add(this.c1MainMenu1);
     this.Name  = "MainForm";
     this.Text  = "MainForm";
     this.Load += new System.EventHandler(this.MainForm_Load);
     ((System.ComponentModel.ISupportInitialize)(this.c1CommandHolder1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.dockToolbar)).EndInit();
     this.dockToolbar.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.dockSidebar)).EndInit();
     this.dockSidebar.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.tabSidebar)).EndInit();
     this.tabSidebar.ResumeLayout(false);
     this.c1DockingTabPage2.ResumeLayout(false);
     this.c1DockingTabPage1.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.dockTray)).EndInit();
     this.dockTray.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.tabTray)).EndInit();
     this.tabTray.ResumeLayout(false);
     this.c1DockingTabPage3.ResumeLayout(false);
     this.c1DockingTabPage3.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.tabMain)).EndInit();
     this.ResumeLayout(false);
 }
Exemplo n.º 16
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            C1CommandHolder ch = C1CommandHolder.CreateCommandHolder(this);

            // In this sample, we use a single event handler for all commands,
            // and use a switch statement inside that handler to select the specific
            // action. Alternatively, each command can be assigned its own Click
            // event handler. Or, a mix of the two approaches is possible.
            ch.CommandClick += new CommandClickEventHandler(CommandClickHandler);
            // use the image list for command images
            ch.ImageList = this.imageList1;
            // modern look:
            ch.LookAndFeel = LookAndFeelEnum.Office2003;

            C1MainMenu mm = new C1MainMenu();

            this.Controls.Add(mm);
            // For the main menu, its CommandHolder property should be set
            // (this is not required for builds 1.0.20041.47 or later of C1Command).
            mm.CommandHolder = ch;

            // Main menu - File
            C1CommandMenu mFile = (C1CommandMenu)ch.CreateCommand(typeof(C1CommandMenu));

            mFile.Text = "&File";
            mm.CommandLinks.Add(new C1CommandLink(mFile));

            // create commands for file ops
            C1Command cNew = ch.CreateCommand();

            cNew.Text = "&New";
            // UserData is arbitrary data associated with commands;
            // In this example we use text labels to recognize specific commands
            // in the single command handler. Alternatively, we could have commands
            // as members of our class, and compare objects to recognize commands.
            cNew.UserData   = "file_new";
            cNew.Shortcut   = Shortcut.CtrlN;
            cNew.ImageIndex = 1;
            C1Command cOpen = ch.CreateCommand();

            cOpen.Text       = "&Open";
            cOpen.UserData   = "file_open";
            cOpen.Shortcut   = Shortcut.CtrlO;
            cOpen.ImageIndex = 0;
            C1Command cExit = ch.CreateCommand();

            cExit.Text     = "E&xit";
            cExit.UserData = "exit";
            cExit.Shortcut = Shortcut.CtrlX;

            mFile.CommandLinks.Add(new C1CommandLink(cNew));
            mFile.CommandLinks.Add(new C1CommandLink(cOpen));
            mFile.CommandLinks.Add(new C1CommandLink());
            mFile.CommandLinks[mFile.CommandLinks.Count - 1].Text = "-";
            mFile.CommandLinks.Add(new C1CommandLink(cExit));

            // Main menu - Window
            C1CommandMenu mWindow = (C1CommandMenu)ch.CreateCommand(typeof(C1CommandMenu));

            mWindow.Text = "&Window";
            mm.CommandLinks.Add(new C1CommandLink(mWindow));

            C1Command cNewWindow = ch.CreateCommand();

            cNewWindow.Text       = "New &Window";
            cNewWindow.UserData   = "window_new";
            cNewWindow.Shortcut   = Shortcut.CtrlW;
            cNewWindow.ImageIndex = 2;

            mWindow.CommandLinks.Add(new C1CommandLink(cNewWindow));

            // For toolbars to be dockable/floatable, we must put them
            // in a C1CommandDock:
            C1CommandDock dock = new C1CommandDock();

            this.Controls.Add(dock);
            dock.Dock = DockStyle.Top;
            // Add a toolbar, link it to the (already existing) commands:
            C1ToolBar tb = new C1ToolBar();

            // add file commands and the window menu to the toolbar
            tb.CommandLinks.Add(new C1CommandLink(cNew));
            tb.CommandLinks.Add(new C1CommandLink(cOpen));
            C1CommandLink cl;

            tb.CommandLinks.Add(cl = new C1CommandLink(mWindow));
            // because we did not provide an image for the window menu,
            // make it show as text
            cl.ButtonLook          = ButtonLookFlags.Text;
            tb.CommandLinks.Add(cl = new C1CommandLink(cExit));
            // ditto for the exit command
            cl.ButtonLook = ButtonLookFlags.Text;
            // add the new toolbar to the dock
            dock.Controls.Add(tb);
        }