コード例 #1
0
        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...
            }
        }
コード例 #2
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);
 }
コード例 #3
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);
        }