Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
390
UltraPictureBox
posted

There's little documentation for the UltraPictureBox and I expected it to allow pairing with an imageList control, as I've done with the UltraTree control. Can anyone spare a code example showing how to dynamically assign images (pictures contained in a .Net project) to an UltraPictureBox? Thanks.

  • 20872
    Offline posted

    Hello,

    Have you been able to follow Brian's suggestion?

    Please do not hesitate to contact us if you have any further questions.

  • 69832
    Suggested Answer
    Offline posted

    UltraPictureBox exposes an Image property, and the ImageList component returns Image instances from its Images collection indexers, so you can assign an image from an ImageList like so:

    UltraPictureBox pb = new UltraPictureBox();
    pb.Image = this.imageList.Images[0];

    Note that each time you access the ImageList.ImageCollection indexer (as seen in this code example), you are actually causing a copy of the image to be made, which consumes GDI resources, so this should be done conservatively.