so i have this lines of codes from winforms that i would like to convert it to WPF. Now i am currently stuck for this function. Below is the code that i need to convert from winforms to WPF since WPF don't have the picturebox tools.
Graphics g = pictureBox1.CreateGraphics();
g.Clear(Color.AliceBlue);
pictureBox1.Image = newimage;//Image.FromFile(thumb);
I tried to swap the picturebox1.CreatedGraphics()
to imagebox tool but it didnt have the createdgraphics function in it.
Would appreciate any help.
Thank you.
It would seem you need to to:
Background
to Colors.AliceBlue
Image
named pictureBox1
as a child to the Border
and set Source = new BitmapImage(new Url(path-to-image))
ie
<Border Background="AliceBlue">
<Image Source = "path-to-image"/>
</Border>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.