Make a slide showing the program

zhaozj2021-02-16  72

Longhorn, which was previously installed, the slidebar's slide show is very beautiful. Ha ha. Now we use C # to realize him.

Of course, you first place a picturebox on it. There is also a corresponding contextMenu. There is an item to choose a picture directory.

The procedure is as follows: private void loadingPictures (String path) {l.clear (); // an arraylist system.io.directoryInfo D = New DirectoryInfo (PATH); ForeInfo F in d.GetFiles ("*. Jpg")) / / Only JPEG image is displayed here {image image = image.fromfile (f.Fullname); float w = image.physicaldimension.width; float h = image.physicaldimension.Height;

FLOAT NW = 0; float nh = 0; if (w> h) {nw = this.picturebox1.width; NH = h / w * nw;} else {nh = this.picturebox1.height; NW = W / h * NH;} // Generate thumbnails adapt to the Picturebox size try {l.add (Image.getthumbnailImage ((int) NH, NULL, NEW INTPTR ())); //l.add (Nimage) Finally {image.dispose ();} Application.doEvents ();} if (l.count> 0) this.timer1.enabled = true;} private image return = true;} private image returnPhoto Street = new system.io.MemoryStream (StreamByte, true); stream.write (streambyte, 0, streambyte.length); Bitmap bmp = new bi TMAP (stream); system.drawing.image image = bmp; // Get the original image // Create the specified size of the specified size = image.getthumbnailImage (112, 136, null, new inteptr ()); graphics g = graphics.fromimage (newimage); g.drawImage (newimage, 10, 10, newimage.width, newimage.Height); // Painted the original picture to g.dispose (); stream.close (); Return NewImage;} Bool thumbnailcallback () {return true;} You need a Timer to set the time interval. Of course, this is relatively simple, no animation gradient doubles and other functions, please ask your brothers to add yourself

转载请注明原文地址:https://www.9cbs.com/read-15148.html

New Post(0)