public static bool ImageFunction(int postId, int groupId) { Bitmap[] ImagePost; int b = 0; FindFileAndDownload findfileanddownload = new FindFileAndDownload(); using (ContextGroupWallPhoto db = new ContextGroupWallPhoto()) { try { var tt = db.GroupWallPhotos .Select(p => new { id = p.Id, photo = p.photo, PhotoName = p.PhotoName, postId = p.post_id, groupId = p.GroupId }) .Where(p => p.postId == postId && p.groupId == groupId); if (tt.Count() != 0) { //Создаем масссив размером полученных изображений int CountImg = tt.Count(); ImagePost = new Bitmap[CountImg]; foreach (var p in tt) { ImagePost[b] = (Bitmap)findfileanddownload.fileFind(p.photo); b++; } StaticClass.ImagePost = ImagePost; return(true); } return(false); } catch { return(false); } } }
private void AddPicktureBox(string fileurl) { findfileanddownload = new FindFileAndDownload(); imageheightwightcalibration = new ImageHeightWightCalibration(); pickturebox = new PictureBox(); pickturebox.Size = new Size(108, 108); pickturebox.Location = new Point(1, 1); pickturebox.Image = imageheightwightcalibration.ScaleImage(findfileanddownload.fileFind(fileurl), 108, 108); this.Controls.Add(pickturebox); }