?
Solved

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

Posted on 2016-10-16
3
Medium Priority
?
32 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 36

Assisted Solution

by:Miguel Oz
Miguel Oz earned 1000 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 35

Accepted Solution

by:
sarabande earned 1000 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 35

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

752 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