L
L
LiptonOlolo2016-06-15 16:51:30
C++ / C#
LiptonOlolo, 2016-06-15 16:51:30

DevExpress TreeList + ImageList, how to quickly insert a picture?

Good afternoon.
There is this code:

dynamic Get = JsonConvert.DeserializeObject(cpapi.GCP_Items());

            for (int i = 0; i < Get.Count; i++)
            {
                Invoke((Action)(() => ItemList.Nodes.Add(Get[i].Name.Value, Get[i].count.Value, ToTime(Get[i].time.Value), Get[i].price.Value)));
                ItemList.Nodes[i].Tag = Get[i].UniqID.Value.ToString();
                PictureBox box = new PictureBox();
                box.Size = new Size(32, 32);
                box.LoadAsync(Get[i]["image_url"].Value.ToString());
                ItemsImages.Images.Add(box.Image);
                Invoke((Action)(() => ItemList.Nodes[i].StateImageIndex = i));
            }

And it turns out that only 1 item is added and waits until the picture is loaded for it, then 2 and so on, how can this be done beautifully and quickly? (Main threads so that the GUI thread doesn't stop)
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LiptonOlolo, 2016-06-15
@LiptonOlolo

It seems to have decided. By bicycle way. Download via WebClient and substitute via Image.FromFile

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question