You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.7 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Rs.MotionPlat
{
public partial class MoveDebug : BaseForm
{
public MoveDebug()
{
InitializeComponent();
}
private void MoveDebug_Load(object sender, EventArgs e)
{
//获取屏幕的宽度
int tWidth = Screen.PrimaryScreen.WorkingArea.Width;
int tHeight=Screen.PrimaryScreen.WorkingArea.Height;
this.Opacity = 1;
this.Location = new Point(tWidth-Width, tHeight-Height);
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
Point startPoint;
Point endPoint;
Point curPoint;
bool pressed = false;
private void panel_head_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button== MouseButtons.Left)
{
if(e.Clicks==2)
{
this.Close();
}
pressed = true;
curPoint = this.Location;
startPoint = e.Location;
}
}
private void panel_head_MouseMove(object sender, MouseEventArgs e)
{
if(pressed)
{
endPoint = e.Location;
int offsetX = endPoint.X - startPoint.X;
int offsetY=endPoint.Y- startPoint.Y;
curPoint.Offset(offsetX, offsetY);
this.Location = curPoint;
}
}
private void panel_head_MouseUp(object sender, MouseEventArgs e)
{
if(pressed)
{
pressed = false;
}
}
protected void CommonMoveDist_Click(object sender, EventArgs e)
{
Label lblNum = (Label)sender;
txtMoveDist.Text = lblNum.Text;
chkMoveStep.Checked = true;
}
protected void Calc_Click(object sender, EventArgs e)
{
chkMoveStep.Checked = true;
Label lblNum = (Label)sender;
if (lblNum.Text.ToLower() == "c")
{
txtMoveDist.Text = "";
}
else
{
if (lblNum.Text == ".")
{
if (txtMoveDist.Text.IndexOf(".") == -1 && txtMoveDist.Text.Length > 0)
txtMoveDist.Text += ".";
}
else
{
txtMoveDist.Text += lblNum.Text;
}
}
}
}
}