Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace DeltaControl {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- using namespace System::IO::Ports; // For SerialPort
- /// <summary>
- /// Summary for Form1
- /// </summary>
- public ref class DeltaForm : public System::Windows::Forms::Form
- {
- public:
- DeltaForm(void)
- {
- InitializeComponent();
- //
- //TODO: Add the constructor code here
- //
- }
- protected:
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- ~DeltaForm()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::TextBox^ txtOutput;
- protected:
- private: System::Windows::Forms::ComboBox^ cbPort;
- private: System::Windows::Forms::TextBox^ txtBaud;
- private: System::Windows::Forms::Button^ btnConnect;
- private: System::Windows::Forms::Label^ label1;
- private: System::Windows::Forms::Label^ Port;
- // Create the SerialPort object
- private: System::IO::Ports::SerialPort^ serialComms;
- private:
- /// <summary>
- /// Required designer variable.
- /// </summary>
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- void InitializeComponent(void)
- {
- // Serial port component ----
- this->components = (gcnew System::ComponentModel::Container());
- this->serialComms = (gcnew System::IO::Ports::SerialPort(this->components));
- this->serialComms->PortName = L"COM3"; // Set the default
- this->serialComms->ReadTimeout = 500;
- this->serialComms->WriteTimeout = 500;
- // ---------------------------
- this->txtOutput = (gcnew System::Windows::Forms::TextBox());
- this->cbPort = (gcnew System::Windows::Forms::ComboBox());
- this->txtBaud = (gcnew System::Windows::Forms::TextBox());
- this->btnConnect = (gcnew System::Windows::Forms::Button());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->Port = (gcnew System::Windows::Forms::Label());
- this->SuspendLayout();
- //
- // txtOutput
- //
- this->txtOutput->Location = System::Drawing::Point(344, 105);
- this->txtOutput->Multiline = true;
- this->txtOutput->Name = L"txtOutput";
- this->txtOutput->Size = System::Drawing::Size(456, 576);
- this->txtOutput->TabIndex = 0;
- //
- // cbPort
- //
- this->cbPort->FormattingEnabled = true;
- this->cbPort->Location = System::Drawing::Point(64, 12);
- this->cbPort->Name = L"cbPort";
- this->cbPort->Size = System::Drawing::Size(64, 21);
- this->cbPort->TabIndex = 1;
- //
- // txtBaud
- //
- this->txtBaud->Location = System::Drawing::Point(64, 35);
- this->txtBaud->Name = L"txtBaud";
- this->txtBaud->Size = System::Drawing::Size(64, 20);
- this->txtBaud->TabIndex = 2;
- this->txtBaud->Text = L"9600";
- //
- // btnConnect
- //
- this->btnConnect->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(0)));
- this->btnConnect->Location = System::Drawing::Point(33, 61);
- this->btnConnect->Name = L"btnConnect";
- this->btnConnect->Size = System::Drawing::Size(81, 29);
- this->btnConnect->TabIndex = 9;
- this->btnConnect->Text = L"Connect";
- this->btnConnect->UseVisualStyleBackColor = true;
- this->btnConnect->Click += gcnew System::EventHandler(this, &DeltaForm::btnConnect_Click);
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(0)));
- this->label1->Location = System::Drawing::Point(10, 36);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(48, 16);
- this->label1->TabIndex = 8;
- this->label1->Text = L"Baud:";
- //
- // Port
- //
- this->Port->AutoSize = true;
- this->Port->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(0)));
- this->Port->Location = System::Drawing::Point(19, 13);
- this->Port->Name = L"Port";
- this->Port->Size = System::Drawing::Size(40, 16);
- this->Port->TabIndex = 7;
- this->Port->Text = L"Port:";
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(810, 693);
- this->Controls->Add(this->btnConnect);
- this->Controls->Add(this->label1);
- this->Controls->Add(this->Port);
- this->Controls->Add(this->txtBaud);
- this->Controls->Add(this->cbPort);
- this->Controls->Add(this->txtOutput);
- this->Name = L"Form1";
- this->Text = L"Delta Robot Control";
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void btnConnect_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement