private: System::Void pictureBoxFt_Paint(System::Object^ sender, System::Windows::Forms:
aintEventArgs^ e) {
gp = e->Graphics;
CREATION_GRAPHE ();
}
private: System::Void Form_grapheft_Resize(System::Object^ sender, System::EventArgs^ e) {
RESIZE ();
}
void Form_grapheft::CREATION_GRAPHE ()
{
//gp=this->pictureBoxFt->CreateGraphics(); test !!!
SolidBrush ^SB;
SB=gcnew SolidBrush (System:
rawing::Color::Yellow);
gp->FillRectangle (SB,0,0,LargeurImage,HauteurImage);
Pen ^penFond;
penFond=gcnew Pen (System:
rawing::Color::Black,1);
// ecriture d'une croix a travers le picturebox
gp->DrawLine(penFond,0,0,LargeurImage,HauteurImage);
gp->DrawLine(penFond,0,HauteurImage,LargeurImage,0);
}
void Form_grapheft::RESIZE ()
{
System:
rawing::Size GeometryPicture;
GeometryPicture=Form_grapheft::Size;
// je rentre le picturebox a l'interieur de ma forme
// je pars toujours de 0,0
GeometryPicture.Height -= Form_grapheft::menuStrip1->Size.Height+16+30;
GeometryPicture.Width -= 16+1;
Form_grapheft::pictureBoxFt->Size=GeometryPicture;
HauteurImage=this->pictureBoxFt->Height;
LargeurImage=this->pictureBoxFt->Width;
Invalidate ();
}
void Form_grapheft::INIT_GRAPHE_FT ()
{
this->SetStyle ( System::Windows::Forms::ControlStyles::ResizeRedraw, true);
// definition hauteur et largeur image
HauteurImage=this->pictureBoxFt->Height;
LargeurImage=this->pictureBoxFt->Width;
}
}
Partager