using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Rs.MotionPlat { public partial class TrayLocation : UserControl { public event EventHandler SavePosEvent; public event EventHandler MoveCameraEvent; public event EventHandler FetchPositionEvent; public TrayLocation() { InitializeComponent(); } private string _HeadText; public string HeadText { get { return _HeadText; } set { _HeadText = value; lblHeadText.Text = value; } } private PointF _Posion; public PointF Position { get { return _Posion; } set { _Posion = value; this.txtPosX.Text = value.X.ToString("0.000"); this.txtPosY.Text = value.Y.ToString("0.000"); } } public float PosX { get { return float.Parse(this.txtPosX.Text); } } public float PosY { get { return float.Parse(this.txtPosY.Text); } } private void TrayLocation_Load(object sender, EventArgs e) { this.btnSavePos.Click += (s, ee) => { if (SavePosEvent != null) SavePosEvent(this, ee); }; this.btnMoveCamera.Click += (s, ee) => { if (MoveCameraEvent != null) MoveCameraEvent(this, ee); }; } private void btnFetchPosition_Click(object sender, EventArgs e) { FetchPositionEvent?.Invoke(sender, e); } } }