104 lines
3.4 KiB
C#
104 lines
3.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace JJMediSys
|
|
{
|
|
public partial class SetKZM : Form
|
|
{
|
|
public SetKZM()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void textBox2_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void label4_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void TextX_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if(TextY.Text!=""&&TextX.Text!=""&& double.TryParse(TextX.Text, out double number1) && double.TryParse(TextY.Text, out double number2))
|
|
{
|
|
int Left = 0;
|
|
int Right = 0;
|
|
if (number1 > 31.5)
|
|
number1 = 31.5;
|
|
Left = (int)((107 + number1 - number2) / 0.03068);
|
|
Right = (int)((31.5 - number1) / 0.03068);
|
|
TextKZM.Text = Left.ToString() + ";" + Right.ToString() + ";" + TextGDM.Text;
|
|
}
|
|
}
|
|
|
|
private void TextY_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (TextY.Text != "" && TextX.Text != "" && double.TryParse(TextX.Text, out double number1) && double.TryParse(TextY.Text, out double number2))
|
|
{
|
|
int Left = 0;
|
|
int Right = 0;
|
|
if (number1 > 31.5)
|
|
number1 = 31.5;
|
|
Left = (int)((107 + number1 - number2) / 0.03068);
|
|
Right = (int)((31.5 - number1) / 0.03068);
|
|
TextKZM.Text = Left.ToString() + ";" + Right.ToString() + ";" + TextGDM.Text;
|
|
}
|
|
}
|
|
|
|
private void TextX_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '.' && e.KeyChar != (char)Keys.Back) // 判断按下的键是否为数字、小数点或退格键
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
else if (e.KeyChar == '.' && TextX.Text.Contains('.')) // 判断小数点个数是否超过1个
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void TextY_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '.' && e.KeyChar != (char)Keys.Back) // 判断按下的键是否为数字、小数点或退格键
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
else if (e.KeyChar == '.' && TextY.Text.Contains('.')) // 判断小数点个数是否超过1个
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void PClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
|
|
|
|
[DllImport("user32.dll")]//*********************拖动无窗体的控件
|
|
public static extern bool ReleaseCapture();
|
|
[DllImport("user32.dll")]
|
|
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
|
|
public const int WM_SYSCOMMAND = 0x0112;
|
|
public const int SC_MOVE = 0xF010;
|
|
public const int HTCAPTION = 0x0002;
|
|
private void SetKZM_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
ReleaseCapture();
|
|
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
|
|
}
|
|
}
|
|
}
|