Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When do you want to do this changes? Hopefully you can add some event handler that allows you to add code that will execute when you want to do this modifications.</p> <p>As for how to do the changes. You will need the name of the member variable of the components.</p> <p>Say, you have a <code>PictureBox</code> that goes by the name <code>PicMyPicture</code>. Then you can do this:</p> <pre><code>PicMyPicture.Image = image; </code></pre> <p>or</p> <pre><code>PicMyPicture.BackGroundImage = image; </code></pre> <p>or similar for other properties and components.</p> <p>Please look at your IDE, chances are that it allows you to define the event handler. For intance you can find events of the components in the properties window of Visual Studio (are you using Visual Studio?), or similar locations in other IDEs.</p> <hr> <p>Ok, but the above has a problem... from where do you get that image?</p> <p>Well, it may come loaded from a file, from a resource in your application, downloaded from Internet, recovered from a database, or even generated at runtime.</p> <p>The more commons for your case are resources and files, so I'll cover those.</p> <p>This codes loads an image from disk:</p> <pre><code>var image = Image.FromFile(@"C:\path\path\some.png"); </code></pre> <p>You may be wondering... how can will I write the path if I don't know where the final user will put application? well, to load a file from a relative path to the working directory of your application, you can do this:</p> <pre><code>var path = Environment.CurrentDirectory; if (!path.EndsWith(Path.DirectorySeparatorChar.ToString())) { path += Path.DirectorySeparatorChar; } path += "some.png"; var image = Image.FromFile(path); </code></pre> <p>This codes loads an image from the resources in your application:</p> <pre><code>var image = new Bitmap ( System.Reflection.Assembly.GetEntryAssembly(). GetManifestResourceStream("MyProject.Resources.myimage.png") ); </code></pre> <p>You have to make sure that you have added the resource to your project before hand. Check out the documentation on your IDE to find out how.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload