moin,
ich bau mir grad ein kleines bildbetrachtertool.
hierzu lade ich ein bild in die picturebox.
wenn das bild größer ist als die box kann ich mir das
volle bild allerdings nicht ansehen, da es keine
scrollbalken gibt. wär cool wenn mir jemand
weiter helfen könnte.
objekt.AutoScroll=true;
Früher war ich unentschlossen, heute bin ich mir da nicht mehr so sicher...
Damit kannst Du das Bild skalieren, ScrollBars würd ich n bissl nervig finden beim Bilder anschauen 😉
Image img = Image.FromStream(stream);
//skaliert das Bild
double dblHeight = img.Height;
double dblWidth = img.Width;
double dblFactor = 0.0;
if (dblHeight >= dblWidth)
dblFactor = dblHeight / pictureBox1.Height;
else
dblFactor = dblWidth / pictureBox1.Width;
dblHeight = dblHeight / dblFactor;
dblWidth = dblWidth / dblFactor;
Bitmap result = new Bitmap((int) dblWidth,(int) dblHeight);
Graphics g = Graphics.FromImage(result);
g.DrawImage(img,new Rectangle(0,0,(int) dblWidth, (int) dblHeight),
new Rectangle(0,0,img.Height,img.Width),GraphicsUnit.Pixel);
pictureBox1.Image = result;
ciao ciao DaSumpf
is nett von dir, aber ich hab das schon.
also ich hab echt voll bock auf diese scrollbalken🙂