Advertisement
Guest User

Untitled

a guest
Jan 10th, 2014
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.28 KB | None | 0 0
  1. #pragma once
  2.  
  3. namespace DeltaControl {
  4.  
  5.     using namespace System;
  6.     using namespace System::ComponentModel;
  7.     using namespace System::Collections;
  8.     using namespace System::Windows::Forms;
  9.     using namespace System::Data;
  10.     using namespace System::Drawing;
  11.     using namespace System::IO::Ports; // For SerialPort
  12.  
  13.     /// <summary>
  14.     /// Summary for Form1
  15.     /// </summary>
  16.     public ref class DeltaForm : public System::Windows::Forms::Form
  17.     {
  18.     public:
  19.         DeltaForm(void)
  20.         {
  21.             InitializeComponent();
  22.             //
  23.             //TODO: Add the constructor code here
  24.             //
  25.         }
  26.  
  27.     protected:
  28.         /// <summary>
  29.         /// Clean up any resources being used.
  30.         /// </summary>
  31.         ~DeltaForm()
  32.         {
  33.             if (components)
  34.             {
  35.                 delete components;
  36.             }
  37.         }
  38.  
  39.     private: System::Windows::Forms::TextBox^  txtOutput;
  40.     protected:
  41.     private: System::Windows::Forms::ComboBox^  cbPort;
  42.     private: System::Windows::Forms::TextBox^  txtBaud;
  43.     private: System::Windows::Forms::Button^  btnConnect;
  44.     private: System::Windows::Forms::Label^  label1;
  45.     private: System::Windows::Forms::Label^  Port;
  46.  
  47.     // Create the SerialPort object
  48.     private: System::IO::Ports::SerialPort^  serialComms;
  49.  
  50.     private:
  51.         /// <summary>
  52.         /// Required designer variable.
  53.         /// </summary>
  54.         System::ComponentModel::Container ^components;
  55.  
  56. #pragma region Windows Form Designer generated code
  57.         /// <summary>
  58.         /// Required method for Designer support - do not modify
  59.         /// the contents of this method with the code editor.
  60.         /// </summary>
  61.         void InitializeComponent(void)
  62.         {
  63.             // Serial port component ----
  64.             this->components = (gcnew System::ComponentModel::Container());
  65.             this->serialComms = (gcnew System::IO::Ports::SerialPort(this->components));
  66.             this->serialComms->PortName = L"COM3"; // Set the default
  67.             this->serialComms->ReadTimeout = 500;
  68.             this->serialComms->WriteTimeout = 500;
  69.             // ---------------------------
  70.            
  71.             this->txtOutput = (gcnew System::Windows::Forms::TextBox());
  72.             this->cbPort = (gcnew System::Windows::Forms::ComboBox());
  73.             this->txtBaud = (gcnew System::Windows::Forms::TextBox());
  74.             this->btnConnect = (gcnew System::Windows::Forms::Button());
  75.             this->label1 = (gcnew System::Windows::Forms::Label());
  76.             this->Port = (gcnew System::Windows::Forms::Label());
  77.             this->SuspendLayout();
  78.             //
  79.             // txtOutput
  80.             //
  81.             this->txtOutput->Location = System::Drawing::Point(344, 105);
  82.             this->txtOutput->Multiline = true;
  83.             this->txtOutput->Name = L"txtOutput";
  84.             this->txtOutput->Size = System::Drawing::Size(456, 576);
  85.             this->txtOutput->TabIndex = 0;
  86.             //
  87.             // cbPort
  88.             //
  89.             this->cbPort->FormattingEnabled = true;
  90.             this->cbPort->Location = System::Drawing::Point(64, 12);
  91.             this->cbPort->Name = L"cbPort";
  92.             this->cbPort->Size = System::Drawing::Size(64, 21);
  93.             this->cbPort->TabIndex = 1;
  94.             //
  95.             // txtBaud
  96.             //
  97.             this->txtBaud->Location = System::Drawing::Point(64, 35);
  98.             this->txtBaud->Name = L"txtBaud";
  99.             this->txtBaud->Size = System::Drawing::Size(64, 20);
  100.             this->txtBaud->TabIndex = 2;
  101.             this->txtBaud->Text = L"9600";
  102.             //
  103.             // btnConnect
  104.             //
  105.             this->btnConnect->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  106.                 static_cast<System::Byte>(0)));
  107.             this->btnConnect->Location = System::Drawing::Point(33, 61);
  108.             this->btnConnect->Name = L"btnConnect";
  109.             this->btnConnect->Size = System::Drawing::Size(81, 29);
  110.             this->btnConnect->TabIndex = 9;
  111.             this->btnConnect->Text = L"Connect";
  112.             this->btnConnect->UseVisualStyleBackColor = true;
  113.             this->btnConnect->Click += gcnew System::EventHandler(this, &DeltaForm::btnConnect_Click);
  114.             //
  115.             // label1
  116.             //
  117.             this->label1->AutoSize = true;
  118.             this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
  119.                 static_cast<System::Byte>(0)));
  120.             this->label1->Location = System::Drawing::Point(10, 36);
  121.             this->label1->Name = L"label1";
  122.             this->label1->Size = System::Drawing::Size(48, 16);
  123.             this->label1->TabIndex = 8;
  124.             this->label1->Text = L"Baud:";
  125.             //
  126.             // Port
  127.             //
  128.             this->Port->AutoSize = true;
  129.             this->Port->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
  130.                 static_cast<System::Byte>(0)));
  131.             this->Port->Location = System::Drawing::Point(19, 13);
  132.             this->Port->Name = L"Port";
  133.             this->Port->Size = System::Drawing::Size(40, 16);
  134.             this->Port->TabIndex = 7;
  135.             this->Port->Text = L"Port:";
  136.             //
  137.             // Form1
  138.             //
  139.             this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  140.             this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  141.             this->ClientSize = System::Drawing::Size(810, 693);
  142.             this->Controls->Add(this->btnConnect);
  143.             this->Controls->Add(this->label1);
  144.             this->Controls->Add(this->Port);
  145.             this->Controls->Add(this->txtBaud);
  146.             this->Controls->Add(this->cbPort);
  147.             this->Controls->Add(this->txtOutput);
  148.             this->Name = L"Form1";
  149.             this->Text = L"Delta Robot Control";
  150.             this->ResumeLayout(false);
  151.             this->PerformLayout();
  152.  
  153.         }
  154. #pragma endregion
  155.     private: System::Void btnConnect_Click(System::Object^  sender, System::EventArgs^  e) {
  156.              }
  157.  
  158. };
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement