开发者

Is it possible to add image resources at runtime in C# WPF?

开发者 https://www.devze.com 2023-02-02 00:22 出处:网络
I would like to download information about movies at runtime and at the same time download images that I can display, but I don not want to save many image files on client computer, so I would like to

I would like to download information about movies at runtime and at the same time download images that I can display, but I don not want to save many image files on client computer, so I would like to just save them as resources and make one big 开发者_开发百科file if possible?


What is wrong with saving the files? IF you don't want that, you will have to create your own file format, and then save files into that stream.

You can also keep all images in memory, but this way, the memory usage of your app will increase a lot if you use a lot of images (that might or might not be visible).


You can consume anything in theory and translate it to a byte[] at runtime; images included.

The data has to go somewhere though, either on the clients local disk or within memory. Saving the file as resources...ie...being coupled within the DLL by default is consuming disk space.

A better approach may to simply retrieve your images and store them within a temp directory at runtime. You could provide a settings area where the user can purge this directory as needed or make use of it for caching purposes which could scale back the need to retrieve images each and every time.

0

精彩评论

暂无评论...
验证码 换一张
取 消