Solved

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

Posted on 2016-10-16
3
25 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 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 34

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 34

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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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