Browse Source

little change

master
yibo 7 years ago
parent
commit
04ff92a964
2 changed files with 18 additions and 8 deletions
  1. +8
    -3
      WinFormControl/UScanPanel.cs
  2. +10
    -5
      WinFormControl/UWeightControl.cs

+ 8
- 3
WinFormControl/UScanPanel.cs View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WinFormControl.Converter;
namespace WinFormControl
{
@ -32,9 +33,13 @@ namespace WinFormControl
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!ParentForm.KeyPreview)
ParentForm.KeyPreview = true;
ParentForm.KeyPress += ParentForm_KeyPress;
var parentForm = ControlUtil.GetParentFormm(this);
if (parentForm != null)
{
if (!parentForm.KeyPreview)
parentForm.KeyPreview = true;
parentForm.KeyPress += ParentForm_KeyPress;
}
}
bool reading = false;


+ 10
- 5
WinFormControl/UWeightControl.cs View File

@ -11,6 +11,7 @@ using WinFormControl.Properties;
using System.Threading;
using System.IO.Ports;
using System.Collections.Concurrent;
using WinFormControl.Converter;
namespace WinFormControl
{
@ -42,13 +43,17 @@ namespace WinFormControl
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
ParentForm.FormClosing += delegate
var parentForm = ControlUtil.GetParentFormm(this);
if (parentForm != null)
{
if (_inQueryThread != null && _inQueryThread.IsAlive)
parentForm.FormClosing += delegate
{
DisableWeight();
}
};
if (_inQueryThread != null && _inQueryThread.IsAlive)
{
DisableWeight();
}
};
}
}
private void settingBtn_Click(object sender, EventArgs e)


Loading…
Cancel
Save