简体   繁体   中英

Visual Studio 2013 C# Add all images from imagelist to listview

Currently I have zero code to show and display because I am new to using Visual Studio, Let me first explain what result I am trying to get so that you can better understand what I am trying to do. I will be making my first attempt at coding a program in C# using a great deal of images.

I added about 1300 images to imageList1 and I am trying to get all of these images to display vertically with their own picturbox or in a listview on form load so sooner or later making it so these images can be dragged and dropped into another window which will output code. I need these images to load from the program itself and not a local directory. Not sure if imageList is the best way to go for this or not.

I have googled and found nothing on what I am trying to do. Right now all I need help with is getting the images in imagelist to even display. I have googled for 2 days and found nothing on what I am looking to do, may be due to keywords entered but I found nothing.

try something like this (not sure of positioning picture boxes though):

    PictureBox pb = default(PictureBox);
        int x = 0, y = 3000;
        foreach (Image img in imglist1.Images)
        {
            pb = new System.Windows.Forms.PictureBox();
            pb.Image = img;
            pb.Width = 1450;
            pb.Height = 1450;
            //x += 1000;
            y -= 1000;
            pb.Location = new System.Drawing.Point(x,y);

            //pb.Location.X = x;
            //pb.Location.Y = y;
            this.Controls.Add(pb);
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM