ahoj, potřebuji poradit s pictureboxem a s obrázkem. Do pictureboxu jsem si nahrál obrázek ale ten se neroztahuje stejně jako picturebox, jak udělám aby se obrázek deformoval a roztahoval stejně jako picturebox?
Fórum › .NET
Picturebox a obrazek

Já používam tuto funkci co jsem si napsal
public Image MyResize(Image img, int resizedW, int resizedH)
{
Bitmap bmp = new Bitmap(resizedW, resizedH);
Graphics graphic = Graphics.FromImage((Image)bmp);
graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphic.DrawImage(img, 0, 0, resizedW, resizedH);
graphic.Dispose();
return (Image)bmp;
}
A pak jí volám takhle
PictureBox.Image = MyResize(Properties.Resources.BackgroundImage, PictureBox.Width, PictureBox.Height);
//MyResize(Image, Šířka_PictureBoxu, Výška_PictureBoxu);
To mutegen: u tvého kódu mi to hází chyby... u InterpolationMode
a tohle celé PictureBox.Image = MyResize(Properties.Resources.BackgroundImage, PictureBox.Width, PictureBox.Height);
//MyResize(Image, Šířka_PictureBoxu, Výška_PictureBoxu);
to liborb: není to žádný projekt, chci dovršit aby když se bude měnit velikost okna tak bitmapa se měnila s ním...
Hmmm .. udělám nový projekt, vložím PictureBox, nastavím mu obrázek, ve vlastnostech nastavím StretchImage a přidám do Anchors right a bottom, přeložím a PictureBox se roztahuje s formulářem a obrázek se roztahuje s PictureBoxem ... všechno funguje, jak má. Co děláš jinak?
No jasně :)
Děláš všechno stejně, nefunguje ti to stejně ...
Naštěstí mám věšteckou kouli zpět z opravy, takže ... to automatické roztahování funguje pouze na property Image a nikoliv BackgroungImage. Obrázek na pozadí se opravdu "jen" opakuje :).

Přidej příspěvek
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
































Uživatelé prohlížející si toto vlákno
Podobná vlákna
PictureBox — založil Wabbit
PictureBox.click; — založil Kubas129
PictureBox a radioButton — založil H0nzin
Picturebox position ? — založil superman
Velke obrazky v PictureBox — založil Tomas
Moderátoři diskuze