public Form1() { InitializeComponent(); Graphics dc = this.CreateGraphics(); // create Graphics object FontInfo KeyFontFormat1 = new FontInfo( "Arial", 12f, FontStyle.Bold); BoardKey1 = new BoardKey(PositionLeft, PositionRight, KeySizeSqu, dc, KeyFontFormat1); this.Show(); // show control box to user top = -1; top_buffer = -1; string s_val = System.String.Empty; }
private void Form1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && top>-1) { CatchStart = false; CurvePointIndex[0] = 1; CurvePointIndex[top] = 1; if(WordPosStack[top].key == " " && top>0) { CurvePointIndex[--top] = 1; } if (top == 0 && WordPosStack[top].key == " ") { this.textBox1.Paste(" "); } else { bool Flag = true; //Word find WordFind: List<string> Result = new List<string>(); Result.Clear(); Result = Org_Word.Find(Word.ToLower(), CurvePointIndex); this.listBox1.Items.Clear(); string tmp = ""; int min_lenth = Word.Length; if (Result.Count != 0) { foreach (string ResultWord in Result) { this.listBox1.Items.Add(ResultWord.ToUpper()); if (Word.Length - ResultWord.Length < min_lenth) tmp = ResultWord.ToUpper(); } } else { if (Flag) { CurvePointIndex = new int[MaxLenthWord]; CurvePointIndex[0] = CurvePointIndex[top] = 1; Flag = false; goto WordFind; } this.listBox1.Items.Add(Word); tmp = Word; } input_buffer[++top_buffer] = tmp; if (tmp.Length > 1) { buffer += tmp + " "; this.textBox1.Paste(tmp + " "); } else if(tmp.Length == 1) { buffer += tmp; this.textBox1.Paste(tmp); } else { } } //Create a new word string Graphics hc = this.CreateGraphics(); hc.Clear(this.BackColor);// if need to save path, then comment this line FontInfo KeyFontFormat1 = new FontInfo("Arial", 12f, FontStyle.Bold); BoardKey1 = new BoardKey(PositionLeft, PositionRight, KeySizeSqu,hc, KeyFontFormat1); Word = ""; top = -1; } if(e.Button == MouseButtons.Right && CatchStart && top>-1) { FontInfo KeyFontFormat1 = new FontInfo("Arial", 12f, FontStyle.Bold); BoardKey1.KeyIndexPlus(WordPosStack[top], KeyFontFormat1, KeySizeSqu, index_times); } }