private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
;
System::Double PI=3.1415926535;
System::Int64 Width=pictureBox1->Width/2;
System::Double x,y,z,v,i;
Graphics^ g=pictureBox1->CreateGraphics();
System::Drawing::Color my_color;
Random^ random_value=gcnew Random();
for(i=(-2.*PI);i<(2.*PI);i+=0.03)
{
x=Width*sin(i);
y=Width*cos(i);
v=Width*1.0;
z=(-1.0*Width*sin(i));
my_color=System::Drawing::Color::FromArgb(random_value->Next(255),random_value->Next(255),
random_value->Next(255));
Pen^ my_pen=gcnew Pen(my_color);
g->DrawLine(my_pen,int((1.0*Width)+x),int((1.0*Width)+y),int((1.0*Width)+z),int((1.0*Width)+v));
}
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
System::String^ file_Name=textBox1->Text;
System::String^ FTP_Name=textBox2->Text;
pictureBox1->Image->Save(file_Name);
Uri^ uri_adress=gcnew Uri("ftp://"+FTP_Name+"/"+Path::GetFileName(file_Name));
FtpWebRequest^ my_req=dynamic_cast<FtpWebRequest^>(WebRequest::Create(uri_adress));
my_req->Credentials=gcnew
NetworkCredential("anonymus","my_name@server.com");
my_req->Method=WebRequestMethods::Ftp::UploadFile;
FileStream^ send_file=gcnew FileStream(file_Name,FileMode::Open);
Stream^ my_stream=my_req->GetRequestStream();
System::Int64 bytes;
array<Byte> ^ table=gcnew array<Byte>(1024);
do
{
bytes=send_file->Read(table,0,1024);
my_stream->Write(table,0,bytes);
}while(bytes!=0);
my_stream->Close();
}
};
}
Brak komentarzy:
Prześlij komentarz