/// <summary> /// コンストラクター /// </summary> /// <param name="textbox">対象となるテキストボックス</param> internal AutoCompleteBox(FooTextBox textbox) : base(textbox.Document) { //リストボックスを追加する this.listBox1.MouseDoubleClick += ListBox1_MouseDoubleClick; this.listBox1.KeyDown += listBox1_KeyDown; this.listBox1.Height = 200; this.listBox1.Visible = false; textbox.Controls.Add(this.listBox1); this.doc = textbox.Document; }
void textbox_FontChanged(object sender, EventArgs e) { FooTextBox textbox = (FooTextBox)sender; Font font = textbox.Font; this.fontName = font.Name; this.fontSize = font.Size; DW.FontWeight weigth = font.Bold ? DW.FontWeight.Bold : DW.FontWeight.Normal; DW.FontStyle style = font.Italic ? DW.FontStyle.Italic : DW.FontStyle.Normal; this.InitTextFormat(font.Name, font.Size, weigth, style); }
internal bool ProcessKeyDown(FooTextBox textbox, KeyEventArgs e, bool isCtrl, bool isShift) { if (this.IsCloseCompleteBox) { if (e.KeyCode == Keys.Space && isCtrl) { this.isReqForceComplete = true; return(true); } return(false); } switch (e.KeyCode) { case Keys.Escape: this.RequestCloseCompleteBox(); textbox.Focus(); return(true); case Keys.Down: if (this.listBox1.SelectedIndex + 1 >= this.listBox1.Items.Count) { this.listBox1.SelectedIndex = this.listBox1.Items.Count - 1; } else { this.listBox1.SelectedIndex++; } return(true); case Keys.Up: if (this.listBox1.SelectedIndex - 1 < 0) { this.listBox1.SelectedIndex = 0; } else { this.listBox1.SelectedIndex--; } return(true); case Keys.Tab: this.RequestCloseCompleteBox(); CompleteWord selWord = (CompleteWord)this.listBox1.SelectedItem; this.SelectItem(this, new SelectItemEventArgs(selWord, this.inputedWord, this.Document)); textbox.Refresh(); return(true); } return(false); }
internal bool ProcessKeyPress(FooTextBox textbox, KeyPressEventArgs e) { if (this.isReqForceComplete && e.KeyChar == ' ') { this.OpenCompleteBox(string.Empty); return(true); } else if (!this.IsCloseCompleteBox && (e.KeyChar == '\r')) { this.RequestCloseCompleteBox(); CompleteWord selWord = (CompleteWord)this.listBox1.SelectedItem; this.SelectItem(this, new SelectItemEventArgs(selWord, this.inputedWord, this.Document)); textbox.Refresh(); return(true); } return(false); }
public D2DTextRender(FooTextBox textbox) { this.TextBox = textbox; textbox.SizeChanged += new EventHandler(textbox_SizeChanged); textbox.FontChanged += new EventHandler(textbox_FontChanged); Size size = textbox.Size; this.fontName = textbox.Font.Name; this.fontSize = textbox.Font.Size; this.InitTextFormat(textbox.Font.Name, (float)textbox.Font.Size); this.CreateDevice(); //初期化ができないので適当なサイズで作る this.ReConstructRenderAndResource(100, 100); }
void textbox_SizeChanged(object sender, EventArgs e) { FooTextBox textbox = (FooTextBox)sender; this.ReConstructRenderAndResource(this.TextBox.Width, this.TextBox.Height); }