Pressing Ctrl + Enter will accept text in text drawing input box

This commit is contained in:
Jaex 2016-08-24 16:18:00 +03:00
parent d74892f883
commit 94d1ee5c41
3 changed files with 28 additions and 19 deletions

View file

@ -42,7 +42,7 @@ private void InitializeComponent()
this.cbUnderline = new System.Windows.Forms.CheckBox();
this.btnAlignmentHorizontal = new System.Windows.Forms.Button();
this.btnAlignmentVertical = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.cmsAlignmentHorizontal = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiAlignmentLeft = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiAlignmentCenter = new System.Windows.Forms.ToolStripMenuItem();
@ -63,6 +63,7 @@ private void InitializeComponent()
this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtInput.Name = "txtInput";
this.txtInput.TextChanged += new System.EventHandler(this.txtInput_TextChanged);
this.txtInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtInput_KeyDown);
//
// btnTextColor
//
@ -161,12 +162,12 @@ private void InitializeComponent()
this.btnAlignmentVertical.UseVisualStyleBackColor = true;
this.btnAlignmentVertical.Click += new System.EventHandler(this.btnAlignmentVertical_Click);
//
// btnClose
// btnOK
//
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
resources.ApplyResources(this.btnOK, "btnOK");
this.btnOK.Name = "btnOK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnClose_Click);
//
// cmsAlignmentHorizontal
//
@ -232,7 +233,7 @@ private void InitializeComponent()
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.flpProperties);
this.Controls.Add(this.txtInput);
this.MaximizeBox = false;
@ -258,7 +259,7 @@ private void InitializeComponent()
private System.Windows.Forms.FlowLayoutPanel flpProperties;
private System.Windows.Forms.Label lblTextSize;
private System.Windows.Forms.NumericUpDown nudTextSize;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.CheckBox cbBold;
private System.Windows.Forms.CheckBox cbItalic;
private System.Windows.Forms.CheckBox cbUnderline;

View file

@ -163,6 +163,14 @@ private void tsmiAlignmentBottom_Click(object sender, EventArgs e)
UpdateVerticalAlignmentImage();
}
private void txtInput_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == (Keys.Control | Keys.Enter))
{
Close();
}
}
private void txtInput_TextChanged(object sender, EventArgs e)
{
InputText = txtInput.Text;

View file

@ -450,31 +450,31 @@
<data name="&gt;&gt;flpProperties.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="btnClose.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<data name="btnOK.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
<value>422, 327</value>
</data>
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
<value>104, 26</value>
</data>
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="btnClose.Text" xml:space="preserve">
<value>Close</value>
<data name="btnOK.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="&gt;&gt;btnClose.Name" xml:space="preserve">
<value>btnClose</value>
<data name="&gt;&gt;btnOK.Name" xml:space="preserve">
<value>btnOK</value>
</data>
<data name="&gt;&gt;btnClose.Type" xml:space="preserve">
<data name="&gt;&gt;btnOK.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnClose.Parent" xml:space="preserve">
<data name="&gt;&gt;btnOK.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;btnClose.ZOrder" xml:space="preserve">
<data name="&gt;&gt;btnOK.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<metadata name="cmsAlignmentHorizontal.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">