Hi, i have these two methods which work as designed, but the original image still shows behind... These methods are to resize an image, one is increase and one is decrease size.
Upon smallerByToolStripMenuItem_Click the image is resized, but the original shows behind it.
Upon largerByToolStripMenuItem_Click the image is also resized, but the bounds of that image stay the same, but i thought the width & hiehgt are behind re-created??...
gr.DrawImage(loadedImage, new System.Drawing.Rectangle(0, 0, (int)newWidth, (int)newHeight));
and they are calculated by new width = image.width/.9 (which make it bigger)??
800/.9 = 888.89....
Am i missing code, is it all wrong, is it the right "kind" of track?..
Anything would be great!. Thanks guys.
private void smallerByToolStripMenuItem_Click(object sender, EventArgs e)//---resize by 10%
{
double newWidth = (loadedImage.Width * .9);
double newHeight = (loadedImage.Height * .9);
using (Graphics gr = Graphics.FromImage(loadedImage))
{
gr.SmoothingMode = SmoothingMode.AntiAlias;
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
gr.DrawImage(loadedImage, new System.Drawing.Rectangle(0, 0, (int)newWidth, (int)newHeight));
}
}
//increase size by 10
private void largerByToolStripMenuItem_Click(object sender, EventArgs e)
{
double newWidth = (loadedImage.Width / .9);
double newHeight = (loadedImage.Height / .9);
using (Graphics gr = Graphics.FromImage(loadedImage))
{
gr.SmoothingMode = SmoothingMode.AntiAlias;
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
gr.DrawImage(loadedImage, new System.Drawing.Rectangle(0, 0, (int)newWidth, (int)newHeight));
}
}
Main goal: Get older image to dissapear
Second goal: Any tips on increasing image size.