Salut à tous!
J'aurais besoin d'un ptit coup de main, je dispose d'une Form dans laquelle j'ai créé une PictureBox.
Je voudrais simplement pouvoir zoomer sur la PictureBox!
Voilà une partie de mon code :
private double ZOOMFACTOR
1.25; // 25% smaller or larger
private int MINMAX = 5;
...
private void ZoomIn()
{
if ( ( ctrlMapView.Width < ( MINMAX * this.Width ) ) &&
( ctrlMapView.Height < ( MINMAX * this.Height ) ) )
{
ctrlMapView.Width = Convert.ToInt32 ( ctrlMapView.Width * ZOOMFACTOR );
ctrlMapView.Height = Convert.ToInt32 ( ctrlMapView.Height * ZOOMFACTOR );
ctrlMapView.SizeMode = PictureBoxSizeMode.StretchImage;
ctrlMapView.Hide();
}
ctrlMapView.Refresh();
}
private void ZoomOut()
{
if ( ( ctrlMapView.Width > ( this.Width / MINMAX ) ) &&
( ctrlMapView.Height > ( this.Height / MINMAX ) ) )
{
ctrlMapView.SizeMode = PictureBoxSizeMode.StretchImage;
ctrlMapView.Width = Convert.ToInt32 ( ctrlMapView.Width / ZOOMFACTOR );
ctrlMapView.Height = Convert.ToInt32 ( ctrlMapView.Height / ZOOMFACTOR );
}
ctrlMapView.Refresh();
}
Le problème est que ça ne zoome pas du tout, j'ai bien l'apparition des scrollbar et la taille de ma PictureBox change bien.
Serait-ce un pb avec le SizeMode?
Merci d'avance.