Answers for "how to add image in c#"

C#
0

how to set image Source in the code C#

myImage.Source = new BitmapImage(new Uri(@"/Images/foo.png", UriKind.Relative));
Posted by: Guest on July-18-2021
-3

save image in C#

SaveFileDialog dialog = new SaveFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
   int width = Convert.ToInt32(drawImage.Width); 
   int height = Convert.ToInt32(drawImage.Height); 
   Bitmap bmp = new Bitmap(width,height);        
   drawImage.DrawToBitmap(bmp, new Rectangle(0, 0, width, height);
   bmp.Save(dialog.FileName, ImageFormat.Jpeg);
}
Posted by: Guest on July-27-2021

C# Answers by Framework

Browse Popular Code Answers by Language