frmInitializeTwoPointRectangle.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using OTSModelSharp.ServiceCenter;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
  13. {
  14. public partial class frmInitializeTwoPointRectangle : Form
  15. {
  16. ISemController cfun;
  17. public PointF LTPoint;
  18. public PointF RBPoint;
  19. public bool IsOK = false;
  20. OTSCommon.Language lan;
  21. Hashtable table;
  22. public frmInitializeTwoPointRectangle()
  23. {
  24. InitializeComponent();
  25. lan = new OTSCommon.Language(this);
  26. table = lan.GetNameTable(this.Name);
  27. }
  28. private void bn_FirstPoint_Click(object sender, EventArgs e)
  29. {
  30. double Px = 0;
  31. double Py = 0;
  32. double Pr = 0;
  33. if (cfun.GetSemPositionXY(ref Px, ref Py, ref Pr))
  34. {
  35. tB_LTPointX.Text = Px.ToString();
  36. tB_LTPointY.Text = Py.ToString();
  37. LTPoint = new PointF((float)Px, (float)Py);
  38. }
  39. }
  40. private void bn_SecondPoint_Click(object sender, EventArgs e)
  41. {
  42. double Px = 0;
  43. double Py = 0;
  44. double Pr = 0;
  45. if (cfun.GetSemPositionXY(ref Px, ref Py, ref Pr))
  46. {
  47. tB_RBPointX.Text = Px.ToString();
  48. tB_RBPointY.Text = Py.ToString();
  49. RBPoint = new PointF((float)Px, (float)Py);
  50. }
  51. }
  52. private void frmInitializeTwoPointRectangle_Load(object sender, EventArgs e)
  53. {
  54. if (cfun == null)
  55. {
  56. cfun = SemController.GetSEMController();
  57. }
  58. }
  59. private void bn_OK_Click(object sender, EventArgs e)
  60. {
  61. IsOK = true;
  62. this.Close();
  63. }
  64. private void bn_Cancel_Click(object sender, EventArgs e)
  65. {
  66. this.Close();
  67. }
  68. private void button1_Click(object sender, EventArgs e)
  69. {
  70. LTPoint = new PointF(Convert.ToSingle(tB_LTPointX.Text), Convert.ToSingle(tB_LTPointY.Text));
  71. }
  72. private void button2_Click(object sender, EventArgs e)
  73. {
  74. RBPoint = new PointF(Convert.ToSingle(tB_RBPointX.Text), Convert.ToSingle(tB_RBPointY.Text));
  75. }
  76. }
  77. }