Forum  General Visual ...  How do I...?  Change image for form's background or picturebox
Previous Previous
 
Next Next
New Post 2/1/2012 11:46 AM
  jasb1
9 posts
No Ranking


Change image for form's background or picturebox 

Howdy,

How can I change the background image for a MDIform, and make it auto-ajust to the browser?

I've added an image, defined as an embebed resource, but it doesn't appear on the browser when I try to find am image on the background property of the MDIform.

The same for the picturebox control.

 
New Post 2/2/2012 2:57 PM
  jasb
279 posts
4th Level Poster


Re: Change image for form's background or picturebox 

Hi,

Sorry to make pressure, can someone give a hand, Palli?

 
New Post 2/4/2012 4:44 AM
  palli
11824 posts
1st Level Poster




Re: Change image for form's background or picturebox 
Modified By palli  on 2/4/2012 8:45:22 AM)

Hi,

Images in Visual WebGui in general, are accessed/rendered to your forms as gateway requests, meaning that the generated Html will include an img tag with a src reference that will issue a request to your server to get the real image contents. Inside of Visual WebGui there are prewired gateways to get images from specific folders within the application virtual folder, usually a subfolder under the Resource folder. This way, the prewired gateway ImageResourceHandle will handle gateway requests for Resources\Images folder etc. This you probably know already.

Embedding an image within your application will still require a gateway to serve the contents to the browser, either the prewired AssemblyResourceHandle, or a one you wire up yourself.

This AssemblyResourceHandle would then be used for embedded images in a manner similar to the following:

            this.pictureBox2.Image = new AssemblyResourceHandle(this.GetType(), "MyJPG.jpg");
            this.pictureBox1.Image = new AssemblyResourceHandle(this.GetType(), "SomeFolder.George.png");
 

The first line will serve an image embedded within the current application on the root folder, and the second line would do the same for an embedded image placed on a subfolder named SomeFolder.

If the images are embedded within an assembly other than the currently executing application, you would have to adjust to instanciation of AssemblyResourceHandle accordingly.

As I have no information on the exact location of your image, I can not give you any exact code lines to place in your application, but I hope the above information will help you solve this.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 2/4/2012 9:02 AM
  jasb
279 posts
4th Level Poster


Re: Change image for form's background or picturebox 

Hi Palli,

Got it, but what will be the root folder? Sorry my ignorance.

If I set it like this:
  this.pictureBox2.Image = new AssemblyResourceHandle(this.GetType(), "MyJPG.jpg");
What will be the folder to place "MyJPG.jpg" ? the root folder of the webserver? inside /bin ?

 
New Post 2/4/2012 2:14 PM
  palli
11824 posts
1st Level Poster




Re: Change image for form's background or picturebox 

Hi,

If you embed the image, you don't need to place it anywhere, as it's already contained within the assembly (the DLL) and the AssemblyResourceHandle gateway will get it from within the assembly.

Of course this would mean that if you ever wanted to change the image, you would need to do that within the dev environment and rebuild and redeploy the application.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  How do I...?  Change image for form's background or picturebox
CompanionKit Bottom
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS