public void TBJoiner_DragDrop(object sender, DragEventArgs e) { string str = e.Data.GetData(DataFormats.Text).ToString(); // var miSelectNode = in2SqlWF03PanelRigtSqlM.getNode(e.X, e.Y); //MessageBox.Show(str); TreeNode vtb = in2SqlWF03PanelRigtSqlM.CurrSqlPanel.findeTable(str, getLblConnectionName()); if ((vtb == null) == false) { if (vtb.Nodes.Count < 2) { MessageBox.Show("Please expand table columns by clicking on the table name "); return; } vTableList.Add(vtb); if (vTableList.Count == 1) { vMainTable = vtb; } TBJoiner.Clear(); drawSelect(); } //throw new NotImplementedException(); }
private void copyToolStripButton1_Click(object sender, EventArgs e) { TBJoiner.SelectAll(); TBJoiner.Copy(); TBJoiner.Focus(); }
private void newToolStripButton1_Click(object sender, EventArgs e) { vTableList.Clear(); vMainTable = null; TBJoiner.Clear(); }
private void SqlColored( ) { // getting keywords/functions string keywords = in2SqlLibrary.getMsSqlReserved(); MatchCollection keywordMatches = Regex.Matches(TBJoiner.Text.ToUpper(), keywords); // getting types/classes from the text string types = @"\b(Console)\b"; MatchCollection typeMatches = Regex.Matches(TBJoiner.Text, types); // getting comments (inline or multiline) string comments = @"(\/\/.+?$|\/\*.+?\*\/)"; MatchCollection commentMatches = Regex.Matches(TBJoiner.Text, comments, RegexOptions.Multiline); // getting strings string strings = "\".+?\""; MatchCollection stringMatches = Regex.Matches(TBJoiner.Text, strings); // saving the original caret position + forecolor int originalIndex = TBJoiner.SelectionStart; int originalLength = TBJoiner.SelectionLength; Color originalColor = Color.Black; // MANDATORY - focuses a label before highlighting (avoids blinking) this.Focus(); // removes any previous highlighting (so modified words won't remain highlighted) TBJoiner.SelectionStart = 0; TBJoiner.SelectionLength = TBJoiner.Text.Length; TBJoiner.SelectionColor = originalColor; // scanning... foreach (Match m in keywordMatches) { TBJoiner.SelectionStart = m.Index; TBJoiner.SelectionLength = m.Length; TBJoiner.SelectionColor = Color.Blue; } foreach (Match m in typeMatches) { TBJoiner.SelectionStart = m.Index; TBJoiner.SelectionLength = m.Length; TBJoiner.SelectionColor = Color.DarkCyan; } foreach (Match m in stringMatches) { TBJoiner.SelectionStart = m.Index; TBJoiner.SelectionLength = m.Length; TBJoiner.SelectionColor = Color.Brown; } foreach (Match m in commentMatches) { TBJoiner.SelectionStart = m.Index; TBJoiner.SelectionLength = m.Length; TBJoiner.SelectionColor = Color.Green; } // restoring the original colors, for further writing TBJoiner.SelectionStart = originalIndex; TBJoiner.SelectionLength = originalLength; TBJoiner.SelectionColor = originalColor; // giving back the focus TBJoiner.Focus(); }