#pragma endregion
int *table;
System::Single single_value;
int step;
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
textBox1->Text=performanceCounter1->NextValue().ToString();
single_value=Convert::ToSingle(textBox1->Text);
textBox1->Text=textBox1->Text+"%";
table[step]=(System::Int32)single_value;
++step;
panel1->Refresh();
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
table=new int[panel1->Width];
step=0;
}
private: System::Void panel1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
Random^ random_value=gcnew Random();
System::Drawing::Color my_color;
if(step>panel1->Width)
{
step=0;
e->Graphics->Clear(System::Drawing::Color::White);
}
int i;
for(i=1;i<step;i++)
{
my_color=System::Drawing::Color::FromArgb(random_value->Next(255),random_value->Next(255),random_value->Next(255));
Pen^ line=gcnew Pen(my_color);
line->Width=1;
e->Graphics->DrawLine(line,i-1,300-(table[i-1]*3.),i,300-(table[i]*3.));
}
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
delete table;
Close();
}
};
}
Brak komentarzy:
Prześlij komentarz