VintaSoft PDF .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft PDF .NET Plug-in Discussions
/// <summary>
/// Stores and manages settings for interaction areas of visual tool.
/// </summary>
public class TextBoxInteractionAreaAppearanceManager : InteractionAreaAppearanceManager
{
/// <summary>
/// Initializes a new instance of the <see cref="TextBoxInteractionAreaAppearanceManager"/> class.
/// </summary>
public TextBoxInteractionAreaAppearanceManager()
{
}
/// <summary>
/// Sets the text box settings.
/// </summary>
/// <param name="textBox">The text box of interactive object (PdfFreeTextAnnotation, etc).</param>
public override void SetTextBoxSettings(RichTextBox textBox)
{
base.SetTextBoxSettings(textBox);
if (textBox != null)
{
// subscribe to the KeyDown event of text box
textBox.KeyDown += TextBox_KeyDown;
}
}
/// <summary>
/// Key is pressed in text box.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param>
private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == Keys.Control)
{
switch (e.KeyCode)
{
case Keys.I:
MessageBox.Show("CTRL+I is pressed");
break;
case Keys.B:
MessageBox.Show("CTRL+B is pressed");
break;
case Keys.L:
// show text
MessageBox.Show(((TextBoxBase)sender).Text);
break;
}
}
}
}
// ...
// create manager that stores and manages settings for interaction areas of visual tool
TextBoxInteractionAreaAppearanceManager textBoxInteractionAreaAppearanceManager = new TextBoxInteractionAreaAppearanceManager();
// specify that manager must work with annotation visual tool
textBoxInteractionAreaAppearanceManager.VisualTool = _annotationTool;
// ...
Best regards, Alexander