コード例 #1
0
        /// <summary>
        /// Перейти на указанную строку
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuActionGoTo_Click(object sender, EventArgs e)
        {
            var gotoForm = new GoToForm(this, Convert.ToInt32(LineCount));

            gotoForm.ShowDialog();

            if (GoToLine < 1)
            {
                return;
            }
            GoToLine--;

            int max  = textWindow.Text.Length;
            int step = max / 10;
            int line = 0;
            int ind  = 0;

            while (line != GoToLine)
            {
                ind += step;
                line = textWindow.GetLineFromCharIndex(ind);
                if (line > GoToLine)
                {
                    ind  -= step;
                    step /= 10;
                    if (step == 0)
                    {
                        step++;
                    }
                }
            }

            textWindow.SelectionStart = textWindow.GetFirstCharIndexFromLine(line);
            textWindow.ScrollToCaret();
        }
コード例 #2
0
ファイル: NotepadForm.cs プロジェクト: makarstasia/Notepad
        private void перейтиToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GoToForm gotoform = new GoToForm();

            gotoform.Owner = this;
            gotoform.ShowDialog();
        }
コード例 #3
0
        private void mEditGo_Click(object sender, EventArgs e)
        {
            GoToForm gotoform = new GoToForm();

            gotoform.Owner         = this;
            gotoform.tbNum.Minimum = 0;
            gotoform.tbNum.Maximum = notebox.Lines.Count();
            gotoform.ShowDialog();
        }
コード例 #4
0
        public MainForm()
        {
            InitializeComponent();
            CommonFunction.RegisterMarkTargetDelegate(MarkTargetLine);
            ReplaceForm.RegisterReplaceTargetDelegate(ReplaceTarget);
            GoToForm.RegisterGoToLineDelegate(GoToLine);
            EncryptForm.RegisterEncryptDelegate(EncryptText);
            FontForm.RegisterFontDelegate(ChangeFont);
            ColorForm.RegisterColorDelegate(ChangeColor);

            ContextMenuStrip cms = new ContextMenuStrip();

            ToolStripMenuItem undo = new ToolStripMenuItem("Undo");

            undo.Name   = undo.Text;
            undo.Click += new EventHandler(toolStrip_Undo_Click);
            cms.Items.Add(undo);
            ToolStripMenuItem redo = new ToolStripMenuItem("Redo");

            redo.Name   = redo.Text;
            redo.Click += new EventHandler(toolStrip_Redo_Click);
            cms.Items.Add(redo);
            cms.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem cut = new ToolStripMenuItem("Cut");

            cut.Name   = cut.Text;
            cut.Click += new EventHandler(toolStrip_Cut_Click);
            cms.Items.Add(cut);
            ToolStripMenuItem copy = new ToolStripMenuItem("Copy");

            copy.Name   = copy.Text;
            copy.Click += new EventHandler(toolStrip_Copy_Click);
            cms.Items.Add(copy);
            ToolStripMenuItem paste = new ToolStripMenuItem("Paste");

            paste.Name   = paste.Text;
            paste.Click += new EventHandler(toolStrip_Paste_Click);
            cms.Items.Add(paste);
            cms.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem selectAll = new ToolStripMenuItem("Select All");

            selectAll.Name   = selectAll.Text;
            selectAll.Click += new EventHandler(toolStrip_SelectAll_Click);
            cms.Items.Add(selectAll);

            cms.Opening += new CancelEventHandler(ContextMenuStrip_Opening);
            customRtb.ContextMenuStrip = cms;
        }