Solved

Help needed| Visual C# 2015 allow user to load custom image as resource

Posted on 2016-10-16
3
18 Views
Last Modified: 2016-11-05
I am writing an application in Visual C# 2015 that produces reports. On the header I display a default logo (this uses a linked resource that is installed during install).

I want to enable the user to select their own image to use in the header. Can the resource file be replaced at runtime by user selected image.

Alternately, I was thinking of using a "setting" that is string which initially has say "Use Resource Image". If the user selects their won image then I change the setting to path and name of their image.

In the rendering part of the report I check the setting and use either the resource or user selected file dependent on the setting value.

I think this would work but if they inadvertently move their image file the program will have issues. It would be good if the program could load their image as an embedded image so it is always available.

Any help much appreciated.
0
Comment
Question by:David Huisman
  • 2
3 Comments
 
LVL 35

Assisted Solution

by:Miguel Oz
Miguel Oz earned 250 total points (awarded by participants)
ID: 41846364
I do not think you can create a resource at run-time, but you could capture the image file and store as a binary in a database table or in the app data folder of your application. I prefer the database approach as it is safely stored in a central location that you can back it up.
0
 
LVL 33

Accepted Solution

by:
sarabande earned 250 total points (awarded by participants)
ID: 41846777
two choices if you want to make a customized application:

(1) put the image into a second rc file, say logo.rc.
     add the customers logo into logo<customer name>.rc
     add the second rc file to project with option 'exclude from build=yes"
     make a new release configuration where the logo.rc is excluded and the other rc is included.

(2) move your resources into a dll resource project.
     create a second dll Project with exchanged (customized) resources
     at customer's setup choose the right dll to be installed.

alternatively - and maybe easier - is to have both Images in the resource file but load the wished one dynamically into an empty frame control at runtime.

Sara
0
 
LVL 33

Expert Comment

by:sarabande
ID: 41875268
Unfortunately the Asker didn't respond to the given solutions. But as both the answers are valid solutions in my experience, the answers's should be added to the knowledgebase.

Sara
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question