private void lboxFindResult_DoubleClick(object sender, EventArgs e) { FindResultPosition position = lboxFindResult.SelectedItem as FindResultPosition; if (position == null) { return; } ListBoxDoubleClick(sender, position); }
private void scriptTree1_SelectedScriptNode(object sender, treeEventArgs e) { //MessageBox.Show(e.scriptPath); frmScriptEdit fseshow = null; foreach (frmScriptEdit fse in this.MdiChildren) { if (e.scriptPath == fse.Tag.ToString()) { fseshow = fse; break; } } if (fseshow == null) { fseshow = new frmScriptEdit(); fseshow.Tag = e.scriptPath; fseshow.Text = e.scriptPath; fseshow.fieldid = e.fieldid; fseshow.tabid = e.tabid; fseshow.strCode = e.scriptCode; fseshow.tag = e.tag; fseshow.MdiParent = this; fseshow.OnSave += new OnSaveEventsHandle(fseshow_OnSave); if (this.OnNewWindow != null) { this.OnNewWindow(this, new svEventsArgs(fseshow.luaEditorControl1)); } fseshow.WindowState = FormWindowState.Maximized; fseshow.Show(); } //激活窗口到前台 foreach (DevComponents.DotNetBar.TabItem ti in this.tabStrip1.Tabs) { if (ti.AttachedControl == fseshow) { tabStrip1.SelectedTab = ti; } } fseshow.GoToPosition(curPosition); curPosition = null; if (mScriptFont != null) { fseshow.luaEditorControl1.ScriptFont = mScriptFont; } }
public void GoToPosition(FindResultPosition position) { if (position == null) { return; } int LineNumber = position.LineNumber; int ColNumber = position.ColNumber; int Length = position.Text.Length; //this.luaEditorControl1.MoveToLine(LineNumber); //add by wangying1 2009-7-23 this.luaEditorControl1.SelectText(LineNumber - 1, ColNumber, Length); //end of add }
private void OnListBoxDoubleClick(object sender, FindResultPosition position) { TreeNode node = position.TheTreeNode; if (node == null) { return; } curPosition = position; TreeViewCancelEventArgs tvcea = new TreeViewCancelEventArgs(node, false, TreeViewAction.Unknown); this.scriptTree1.tree_BeforeSelect(sender, tvcea); }
private void FindInCode(string Code, string strFind, TreeNode node) { if (node == null) { return; } int LastLineEndIndex = -1; int CurLineEndIndex = -1; string OneLine = string.Empty; int curLineNumber = 1; //当前行号 int ColIndex = -1; //在当前行的列号 int IndexInAll = -1; //在全文的索引号 FindResultPosition position; while (FetchNextLine(Code, ref LastLineEndIndex, ref CurLineEndIndex, ref OneLine)) { ColIndex = OneLine.IndexOf(strFind, this.ckbCaseSensitive.Checked ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase); if (ColIndex != -1) { IndexInAll = LastLineEndIndex + ColIndex; position = new FindResultPosition(node); position.Index = IndexInAll; position.LineNumber = curLineNumber; position.LinePreview = OneLine; position.ColNumber = ColIndex; //add by wangying1 2009-7-23 position.Text = strFind; //end of add lboxFindResult.Items.Insert(lboxFindResult.Items.Count, position); } ++curLineNumber; } }