Changed: textbox button to respond to left-button only

This commit is contained in:
Ray committed 2021-09-28 21:19:34 +01:00
1 parent 2af53adcae
commit 3518084267
7 files changed
+78 -78

No files matched your search

@@ -2,8 +2,8 @@
{
using RyzStudio.Drawing;
using System;
using System.ComponentModel;
using System.Drawing;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public partial class TButtonTextBox : RyzStudio.Windows.ThemedForms.TUserControl
@@ -22,11 +22,19 @@
textBox1.Left = this.Margin.Left;
textBox1.PreviewKeyDown += textBox_PreviewKeyDown;
imageBox1.Click += imageBox1_Click;
imageBox1.MouseClick += imageBox1_MouseClick;
OnResize(null);
}
protected virtual void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
OnButtonClick?.Invoke(sender, e);
}
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
@@ -69,8 +77,6 @@
}
}
protected virtual void imageBox1_Click(object sender, EventArgs e) => OnButtonClick?.Invoke(sender, e);
[Category("Action")]
[Browsable(true)]
public event EventHandler OnButtonClick;
@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.IO;
using System.Windows.Forms;
using UIResources = BookmarkManager.UIResource;
@@ -16,8 +15,13 @@ namespace RyzStudio.Windows.ThemedForms
public FolderBrowserDialog FolderDialog { get; set; } = null;
protected override void imageBox1_Click(object sender, EventArgs e)
protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
if (this.FolderDialog == null)
{
this.FolderDialog = new FolderBrowserDialog();
@@ -1,5 +1,4 @@
using System;
using System.Text;
using System.Text;
using System.Windows.Forms;
using UIResources = BookmarkManager.UIResource;
@@ -71,8 +70,13 @@ namespace RyzStudio.Windows.ThemedForms
this.Text = this.KeyCodeResults.DisplayText;
}
protected override void imageBox1_Click(object sender, EventArgs e)
protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
this.KeyCodeResults.Clear();
this.Text = this.KeyCodeResults.DisplayText;
@@ -16,8 +16,13 @@ namespace RyzStudio.Windows.ThemedForms
public OpenFileDialog FileDialog { get; set; } = null;
protected override void imageBox1_Click(object sender, EventArgs e)
protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
if (this.FileDialog == null)
{
this.FileDialog = new OpenFileDialog();