private void removeTextTempBox() { if (temporaryTBox != null && temporaryTextEditResult != null) { Edge cEdge=temporaryTextEditResult.CurrentEdge; List<char> chars=cEdge.EdgeChars; for (int i = 0; i < chars.Count; i++) { mainAutomate.OpFunction.DeleteRow(new StateCharPair(cEdge.BeginNode.NodeState,chars[i]),cEdge.EndNode.NodeState); mainAutomate.InnerAlphabet.DeleteChar(chars[i]); } if((temporaryTBox.Text.Trim()).Length>0) temporaryTextEditResult.CurrentEdge.InnerChars = temporaryTBox.Text; pictureBox1.Controls.Remove(temporaryTBox); temporaryTBox.Dispose(); temporaryTBox = null; temporaryTextEditResult = null; chars = cEdge.EdgeChars; for (int i = 0; i < chars.Count; i++) { mainAutomate.OpFunction.SetDirectState(new StateCharPair(cEdge.BeginNode.NodeState,chars[i]),cEdge.EndNode.NodeState); if(!mainAutomate.InnerAlphabet.IsInAlphabet(chars[i])) mainAutomate.InnerAlphabet.AddToAlphabet(chars[i]); } //here add or modify operation function this.pictureBox1.Refresh(); listView3.Items.Clear(); listView1.Items.Clear(); this.mainAutomate.OpFunction.WriteDataToListView(listView3); this.mainAutomate.InnerAlphabet.WriteAlphabetToListView(listView1); } }
private void editMouseAction(MouseEventArgs e) { TextEditResult tRes = graph.CheckTextEdition(e.X, e.Y); //check if this a modification of text for edge if (tRes != null) { temporaryTextEditResult = tRes; TextBox textBox = new TextBox(); textBox.Width = Math.Max(30,tRes.size.Width); textBox.Height = tRes.size.Height; textBox.Location = new Point(tRes.corner.X, tRes.corner.Y); textBox.Text = tRes.content; temporaryTBox = textBox; temporaryTBox.KeyDown += new KeyEventHandler(TextBox_KeyDown); selectState = 4; this.pictureBox1.Controls.Add(textBox); } else //check if this is a modification of node name { } }