Tech Off Thread

2 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Loading embedded image in winforms control.

Back to Forum: Tech Off
  • User profile image

    I am writing a control that inherits from the panel control. I want to load an embedded image as the background image for my panel control. However every measure i have taken to load my embedded image has resulted in an error when adding the control to an application. Any ideas on what i can do to fix it?

  • User profile image

    How about some source code of what you've tried? What exactly do you mean by an "embedded image?"

    Embedded as a resource in the project? If so, are you sure you've got the resource name correct when you load it? I use the following code to find the names of resources embedded in an assembly:

    Assembly a = Assembly.GetExecutingAssembly();
    string [] resNames = a.GetManifestResourceNames();

    The resNames array will have all of the resources in it. The name may surprise you, as it will have the full namespace name, such as "StarTechnologies.SdtGui.VisioSupport.ImageList16.png" where the namespace name (in this case, "StarTechnologies.SdtGui.VisioSupport") is, I believe, the Default Namespace property of the assembly's project.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.