?? form1.h
字號:
Sub_ComputerRectAndPoint(_AnalyseErr, _AnalyseItemPoint, Org_X, Org_Y, count);
for(j = 0, x1 = 0; j < Num; j++)
{
if(errarray[j] == 1)
{
_AnalyseErrInfo[x1, 0] = _AnalyseInfo[j, 0];
_AnalyseErrInfo[x1, 1] = _AnalyseInfo[j, 1];
_AnalyseErrInfo[x1, 2] = _AnalyseInfo[j, 2];
_AnalyseErrInfo[x1, 3] = _AnalyseInfo[j, 3];
_AnalyseErrInfo[x1, 4] = _AnalyseInfo[j, 4];
_AnalyseErrInfo[x1, 5] = _AnalyseInfo[j, 5];
_AnalyseErrInfo[x1, 6] = _AnalyseInfo[j, 6];
x1 += 1;
}
}
}
private: System::Windows::Forms::Button^ button1;
public:
private:
/// <summary>
/// 必需的設計器變量。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// 設計器支持所需的方法 - 不要
/// 使用代碼編輯器修改此方法的內(nèi)容。
/// </summary>
void InitializeComponent(void)
{
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->Init_Memory = (gcnew System::Windows::Forms::Button());
this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton3 = (gcnew System::Windows::Forms::RadioButton());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->button4 = (gcnew System::Windows::Forms::Button());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
this->button5 = (gcnew System::Windows::Forms::Button());
this->checkBox4 = (gcnew System::Windows::Forms::CheckBox());
this->button3 = (gcnew System::Windows::Forms::Button());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
this->groupBox1->SuspendLayout();
this->SuspendLayout();
//
// pictureBox1
//
this->pictureBox1->BackColor = System::Drawing::SystemColors::Window;
this->pictureBox1->Location = System::Drawing::Point(12, 12);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(762, 648);
this->pictureBox1->TabIndex = 0;
this->pictureBox1->TabStop = false;
this->pictureBox1->MouseClick += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::pictureBox1_MouseClick);
//
// Init_Memory
//
this->Init_Memory->Location = System::Drawing::Point(782, 105);
this->Init_Memory->Name = L"Init_Memory";
this->Init_Memory->Size = System::Drawing::Size(125, 36);
this->Init_Memory->TabIndex = 1;
this->Init_Memory->Text = L"初始化內(nèi)存管理";
this->Init_Memory->UseVisualStyleBackColor = true;
this->Init_Memory->Click += gcnew System::EventHandler(this, &Form1::Init_Memory_Click);
//
// radioButton1
//
this->radioButton1->AutoSize = true;
this->radioButton1->Location = System::Drawing::Point(9, 20);
this->radioButton1->Name = L"radioButton1";
this->radioButton1->Size = System::Drawing::Size(83, 16);
this->radioButton1->TabIndex = 2;
this->radioButton1->TabStop = true;
this->radioButton1->Text = L"1M內(nèi)存管理";
this->radioButton1->UseVisualStyleBackColor = true;
//
// radioButton2
//
this->radioButton2->AutoSize = true;
this->radioButton2->Location = System::Drawing::Point(9, 42);
this->radioButton2->Name = L"radioButton2";
this->radioButton2->Size = System::Drawing::Size(83, 16);
this->radioButton2->TabIndex = 3;
this->radioButton2->TabStop = true;
this->radioButton2->Text = L"2M內(nèi)存管理";
this->radioButton2->UseVisualStyleBackColor = true;
//
// radioButton3
//
this->radioButton3->AutoSize = true;
this->radioButton3->Location = System::Drawing::Point(9, 64);
this->radioButton3->Name = L"radioButton3";
this->radioButton3->Size = System::Drawing::Size(83, 16);
this->radioButton3->TabIndex = 4;
this->radioButton3->TabStop = true;
this->radioButton3->Text = L"4M內(nèi)存管理";
this->radioButton3->UseVisualStyleBackColor = true;
//
// groupBox1
//
this->groupBox1->Controls->Add(this->radioButton1);
this->groupBox1->Controls->Add(this->radioButton3);
this->groupBox1->Controls->Add(this->radioButton2);
this->groupBox1->Location = System::Drawing::Point(792, 12);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(98, 87);
this->groupBox1->TabIndex = 5;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"內(nèi)存大小:";
//
// button1
//
this->button1->Location = System::Drawing::Point(805, 631);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(70, 29);
this->button1->TabIndex = 6;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(782, 186);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(125, 36);
this->button2->TabIndex = 7;
this->button2->Text = L"隨機分配內(nèi)存測試";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Location = System::Drawing::Point(802, 339);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(84, 16);
this->checkBox1->TabIndex = 8;
this->checkBox1->Text = L"繪制忙鏈表";
this->checkBox1->UseVisualStyleBackColor = true;
this->checkBox1->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox1_CheckedChanged);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(806, 144);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(77, 12);
this->label1->TabIndex = 9;
this->label1->Text = L"已分配的塊數(shù)";
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(802, 159);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(84, 21);
this->textBox1->TabIndex = 10;
//
// button4
//
this->button4->Location = System::Drawing::Point(782, 228);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(125, 36);
this->button4->TabIndex = 11;
this->button4->Text = L"分析繁忙鏈表";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(788, 270);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(112, 21);
this->textBox2->TabIndex = 12;
//
// checkBox2
//
this->checkBox2->AutoSize = true;
this->checkBox2->Enabled = false;
this->checkBox2->Location = System::Drawing::Point(802, 361);
this->checkBox2->Name = L"checkBox2";
this->checkBox2->Size = System::Drawing::Size(96, 16);
this->checkBox2->TabIndex = 13;
this->checkBox2->Text = L"繪制出錯鏈表";
this->checkBox2->UseVisualStyleBackColor = true;
this->checkBox2->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox2_CheckedChanged);
//
// checkBox3
//
this->checkBox3->AutoSize = true;
this->checkBox3->Location = System::Drawing::Point(802, 383);
this->checkBox3->Name = L"checkBox3";
this->checkBox3->Size = System::Drawing::Size(84, 16);
this->checkBox3->TabIndex = 14;
this->checkBox3->Text = L"繪制空鏈表";
this->checkBox3->UseVisualStyleBackColor = true;
this->checkBox3->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox3_CheckedChanged);
//
// button5
//
this->button5->Location = System::Drawing::Point(782, 297);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(125, 36);
this->button5->TabIndex = 15;
this->button5->Text = L"隨機釋放內(nèi)存測試";
this->button5->UseVisualStyleBackColor = true;
this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
//
// checkBox4
//
this->checkBox4->AutoSize = true;
this->checkBox4->Location = System::Drawing::Point(801, 405);
this->checkBox4->Name = L"checkBox4";
this->checkBox4->Size = System::Drawing::Size(96, 16);
this->checkBox4->TabIndex = 16;
this->checkBox4->Text = L"繪制物理鏈表";
this->checkBox4->UseVisualStyleBackColor = true;
this->checkBox4->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox4_CheckedChanged);
//
// button3
//
this->button3->Location = System::Drawing::Point(782, 427);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(125, 36);
this->button3->TabIndex = 17;
this->button3->Text = L"分析空閑鏈表";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// textBox3
//
this->textBox3->Location = System::Drawing::Point(788, 469);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(112, 21);
this->textBox3->TabIndex = 18;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(917, 672);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->button3);
this->Controls->Add(this->checkBox4);
this->Controls->Add(this->button5);
this->Controls->Add(this->checkBox3);
this->Controls->Add(this->checkBox2);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->button4);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label1);
this->Controls->Add(this->checkBox1);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->Init_Memory);
this->Controls->Add(this->pictureBox1);
this->Name = L"Form1";
this->Text = L"模擬內(nèi)存管理測試";
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
/// <summary>
/// 初始化內(nèi)存按鈕
/// </summary>
private: System::Void Init_Memory_Click(System::Object^ sender, System::EventArgs^ e)
{
int len;
if(radioButton1->Checked)
{
//1M的內(nèi)存管理
G_TestMem = new char [1024 * 1024];
len = 1024 * 1024;
}
else if(radioButton2->Checked)
{
//2M的內(nèi)存管理
G_TestMem = new char [1024 * 1024 * 2];
len = 1024 * 1024 * 2;
}
else if(radioButton3->Checked)
{
//4M的內(nèi)存管理
G_TestMem = new char [1024 * 1024 * 4];
len = 1024 * 1024 * 4;
}
else
{
MessageBox::Show("請選擇要模擬的內(nèi)存大小!!!", "提示", MessageBoxButtons::OK, MessageBoxIcon::Information);
return;
}
G_TestMemLen = len;
int ret = Fun_MemInit((void *)G_TestMem, (void *)(&G_TestMem[len - 1]));
Org_X = 5;
Org_Y = 5;
G_Width = this->pictureBox1->Width - 10; //邊上留下10
G_Height = this->pictureBox1->Height - 10; //邊上留下10
//初始化畫圖工具
_BusyPen = gcnew Pen(Color::Red, 1);
_BusyBrush = gcnew SolidBrush(Color::Red);
_BusyPen->EndCap = System::Drawing::Drawing2D::LineCap::ArrowAnchor;
_BusyFont = gcnew System::Drawing::Font("Times New Roman", 10, FontStyle::Regular, GraphicsUnit::Pixel, 1);
_IdlePen = gcnew Pen(Color::Green, 1);
_IdleBrush = gcnew SolidBrush(Color::Green);
_IdlePen->EndCap = System::Drawing::Drawing2D::LineCap::ArrowAnchor;
FontFamily^ emFontFamily = gcnew FontFamily( "Times New Roman" );
G_FontLineSpace = _BusyFont->GetHeight();
Test_sp = new char * [5000];
Test_Space = new int[1000];
Test_sp_num = 0;
Test_Alloc_Mem = 0;
_BusyItemSum = 0;
_IdleItemSum = 0;
_PhyCount = 0;
}
///<summary>
///試驗按鈕
///</summary>
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
int i;
_myGraphics->Clear(this->pictureBox1->BackColor);
////array<Rectangle>^ myArray = gcnew array<Rectangle>(2);
//i = 2;//Fun_RetBusyList();
//_BusyItem = gcnew array<Rectangle>(i);
//_BusyItem[0].X = 20;
//_BusyItem[0].Y = 20;
//_BusyItem[0].Width = 30;
//_BusyItem[0].Height = 30;
//_BusyItem[1].X = 120;
//_BusyItem[1].Y = 20;
//_BusyItem[1].Width = 30;
//_BusyItem[1].Height = 30;
//_BusyItemPoint = gcnew array<Point,2>(i, 4);
//_BusyItemPoint[0,0].X = _BusyItem[0].X;
//_BusyItemPoint[0,0].Y = _BusyItem[0].Y + 5;
//_BusyItemPoint[0,1].X = _BusyItem[0].X;
//_BusyItemPoint[0,1].Y = _BusyItem[0].Height + _BusyItem[0].Y - 5;
//_BusyItemPoint[0,2].X = _BusyItem[0].X + _BusyItem[0].Width;
//_BusyItemPoint[0,2].Y = _BusyItem[0].Y + 5;
//_BusyItemPoint[0,3].X = _BusyItem[0].X + _BusyItem[0].Width;
//_BusyItemPoint[0,3].Y = _BusyItem[0].Height + _BusyItem[0].Y - 5;
//_BusyItemPoint[1,0].X = _BusyItem[1].X;
//_BusyItemPoint[1,0].Y = _BusyItem[1].Y + 5;
//_BusyItemPoint[1,1].X = _BusyItem[1].X;
//_BusyItemPoint[1,1].Y = _BusyItem[1].Height + _BusyItem[1].Y - 5;
//_BusyItemPoint[1,2].X = _BusyItem[1].X + _BusyItem[1].Width;
//_BusyItemPoint[1,2].Y = _BusyItem[1].Y + 5;
//_BusyItemPoint[1,3].X = _BusyItem[1].X + _BusyItem[1].Width;
//_BusyItemPoint[1,3].Y = _BusyItem[1].Height + _BusyItem[1].Y - 5;
//_BusyPen = gcnew Pen(Color::Red, 1);
//_BusyBrush = gcnew SolidBrush(Color::Red);
//_BusyPen->EndCap = System::Drawing::Drawing2D::LineCap::ArrowAnchor;
//_myGraphics->FillRectangle(_BusyBrush, _BusyItem[0]);
////Sub_DrawList(_BusyItem, _BusyItemPoint, _BusyPen, _BusyBrush, 2);
////Pen^ BluePen = gcnew Pen(Color::ForestGreen, 1);
////System::Drawing::Drawing2D::GraphicsPath^ strokePath = gcnew System::Drawing::Drawing2D::GraphicsPath();
////array<Point, 2>^ pt;// = { Point(0, 0), Point(10, 10), Point(10, -10)};
//////strokePath->AddPolygon(pt);
//////System::Convert::ChangeType(0, (System::Drawing::Drawing2D::GraphicsPath::typeid));
//////System::Drawing::Drawing2D::GraphicsPath^ fillPath = gcnew System::Drawing::Drawing2D::GraphicsPath();;
//////fillPath = NULL;
//////System::Drawing::Drawing2D::CustomLineCap^ custCap = gcnew System::Drawing::Drawing2D::CustomLineCap(fillPath, strokePath);//custCap(NULL, &strokePath);
//////BluePen->CustomEndCap = custCap;
////BluePen->EndCap = System::Drawing::Drawing2D::LineCap::ArrowAnchor;
////myGraphics = this->pictureBox1->CreateGraphics();
//_myGraphics->DrawLine(_BusyPen, 0, 10, 30, 10);
////Rectangle xu1(100, 100, 100, 100);
//_myGraphics->DrawRectangle(_BusyPen, _BusyItem[1]);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -