Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace DrawingLine3
- {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- /// <summary>
- /// MyForm 的摘要
- /// </summary>
- public ref class MyForm : public System::Windows::Forms::Form
- {
- public:
- MyForm(void)
- {
- InitializeComponent();
- //
- //TODO: 在此加入建構函式程式碼
- //
- }
- protected:
- /// <summary>
- /// 清除任何使用中的資源。
- /// </summary>
- ~MyForm()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::Button^ button1;
- protected:
- private:
- /// <summary>
- /// 設計工具所需的變數。
- /// </summary>
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// 此為設計工具支援所需的方法 - 請勿使用程式碼編輯器修改
- /// 這個方法的內容。
- /// </summary>
- void InitializeComponent(void)
- {
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->SuspendLayout();
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(197, 226);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(75, 23);
- this->button1->TabIndex = 0;
- this->button1->Text = L"button1";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
- //
- // MyForm
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(284, 261);
- this->Controls->Add(this->button1);
- this->Name = L"MyForm";
- this->Text = L"MyForm";
- this->ResumeLayout(false);
- }
- #pragma endregion
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
- {
- Graphics^ G = this->CreateGraphics();
- int Idx = 0;
- //for (Idx = 1; Idx <= 100; Idx += 3)
- //{
- // G->DrawLine(Pens::White, 0, Idx, 200, Idx);
- // G->DrawLine(Pens::Gray, 0, Idx + 1, 200, Idx + 1);
- // G->DrawLine(Pens::Black, 0, Idx + 2, 200, Idx + 2);
- //}
- G->DrawLine(gcnew Pen(Brushes::Red, 7), 30, 1, 10, 100);
- G->DrawLine(gcnew Pen(Brushes::Orange, 6), 27, 1, 20, 100);
- G->DrawLine(gcnew Pen(Brushes::Yellow, 5), 24, 1, 30, 100);
- G->DrawLine(gcnew Pen(Brushes::Green, 4), 21, 1, 40, 100);
- G->DrawLine(gcnew Pen(Brushes::Blue, 3), 18, 1, 50, 100);
- G->DrawLine(gcnew Pen(Brushes::Indigo, 2), 15, 1, 60, 100);
- G->DrawLine(Pens::Purple, 12, 1, 70, 100);
- G->DrawLine(Pens::Black, 9, 1, 80, 100);
- G->DrawLine(Pens::Gray, 6, 1, 90, 100);
- G->DrawLine(Pens::White, 3, 1, 100, 100);
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement