コード例 #1
0
ファイル: GiphyPostHandler.cs プロジェクト: natict/IDC_DP_A17
        protected override async Task <bool> HandleRequest(PostRequest request)
        {
            if (request.Message.ToLower().StartsWith(GiphyPrefix))
            {
                string searchFor = request.Message.Substring(GiphyPrefix.Length);
                string url       = m_GiphyClient.Translate(searchFor);
                m_PictureBoxPostSentPhoto.Load(url);

                DialogResult res = MessageBox.Show("Do you want to post it?", "Interesting...", MessageBoxButtons.YesNo);
                if (res == DialogResult.Yes)
                {
                    await FacebookApiClient.Instance.PostPictureURLAsync(url, searchFor);

                    request.RequestResult = "Gif Posted successfully!";
                }

                return(false);
            }

            return(true);
        }
コード例 #2
0
        public PopupForm(Staff s)
        {
            InitializeComponent();
            int        x  = 50;
            int        y  = 50;
            PictureBox pb = new PictureBox();

            pb.Size     = new Size(150, 150);
            pb.Location = new Point(x, y);
            pb.SizeMode = PictureBoxSizeMode.StretchImage;
            pb.Load(s.imagePath);
            contentPane.Controls.Add(pb);
            contentPane.Controls.Add(e.createLabel("Name: " + s.name, x, y));
            contentPane.Controls.Add(e.createLabel("Username: "******"Tagline: " + s.tagline, x, y));
            contentPane.Controls.Add(e.createLabel("Office: " + s.office, x, y));
            contentPane.Controls.Add(e.createLabel("Title: " + s.title, x, y));
            contentPane.Controls.Add(e.createLabel("Interest Area: " + s.interestArea, x, y));
            contentPane.Controls.Add(e.createLabel("Email: " + s.email, x, y));
            contentPane.Controls.Add(e.createLabel("Phone: " + s.phone, x, y));
        }
コード例 #3
0
        public void KnownList(List <string> list)
        {
            int x = 20, y = 20, maxHeight = -1;

            foreach (var item in list)
            {
                PictureBox pic = new PictureBox();
                pic.Size = new System.Drawing.Size(140, 160);
                pic.Load(item);
                pic.Location = new Point(x, y);
                pic.SizeMode = PictureBoxSizeMode.StretchImage;
                x           += pic.Width + 10;
                maxHeight    = Math.Max(pic.Height, maxHeight);
                if (x > this.ClientSize.Width - 100)
                {
                    x  = 20;
                    y += maxHeight + 10;
                }
                this.panelKnownFor.Controls.Add(pic);
            }
        }
コード例 #4
0
        private void setContainerUI()
        {
            //load cover,name,... cho album container

            albumName_label.Text = trackTable.Rows[0]["albumTitle"].ToString();
            albumYear_label.Text = trackTable.Rows[0]["albumYear"].ToString();
            if (albumYear_label.Text == "0")
            {
                albumYear_label.Text = "";
            }
            ThreadPool.QueueUserWorkItem(delegate {
                PB.Load(GetData.GetSongData.GetSongCover(trackTable.Rows[0]["albumLink"].ToString()));
                string artistText = "";
                DataTable albumArtistTable;
                if (trackTable.Rows[0]["artistID"].ToString() == "")
                {
                    string[] artistArr = GetSongData.GetSongArtist(trackTable.Rows[0]["albumLink"].ToString());
                    foreach (string art in artistArr)
                    {
                        if (art != artistArr[artistArr.Length - 1])
                        {
                            artistText += art + ";";
                        }
                        else
                        {
                            artistText += art;
                        }
                    }
                }
                else
                {
                    albumArtistTable = Database.getArtistBaseOnID(trackTable.Rows[0]["artistID"].ToString());
                    artistText       = trackTable.Rows[0]["artistname"].ToString();
                }
                this.BeginInvoke((Action) delegate {
                    albumCover_panel.BackgroundImage = PB.Image;
                    albumArtist_label.Text           = artistText;
                });
            });
        }
コード例 #5
0
        /*  public static List<String> GetRandom()
         * {
         *    List<String> pics = new List<String>();
         *
         *    String reklPic = "https://i.imgur.com/eQ4wEpO.gif";
         *    String ss = "https://i.imgur.com/eQ4wEpO.gif";
         *
         *    List<String> reklPics = SQLClass.Select(
         *        "SELECT pic FROM " + Tables.ADVERTISMENT +
         *        " WHERE pic != ''");
         *
         *    int v = rnd.Next(1, reklPics.Count);
         *    if (reklPics[v - 1] != "")
         *    {
         *        ss = ss[v - 1].ToString();
         *        reklPic = reklPics[v - 1].ToString();
         *    }
         *
         *    pics.Add(reklPic);
         *
         *    return pics;
         * }*/

        public void refreshADS()
        {
            this.Controls.Clear();
            int x = 0;
            int y = 0;
            //Random rnd = new Random();

            List <String> reklPics = SQLClass.Select(
                "SELECT pic FROM " + Tables.ADVERTISMENT +
                " WHERE pic != ''");

            for (int i = 0; i < amount; i++)
            {
                if (this.ParamsAds.Count > 0)
                {
                    PictureBox pic = new PictureBox
                    {
                        Location = new Point(x, y),
                        SizeMode = PictureBoxSizeMode.StretchImage
                    };
                    pic.Click += new System.EventHandler(GhostMainForm.reclama_Click);
                    pic.Width  = this.Width;
                    pic.Height = this.Height / amount;

                    try
                    {
                        pic.Load(reklPics[rnd.Next(0, Convert.ToInt32(Math.Min(
                                                                          amount, reklPics.Count
                                                                          )))]);
                    }
                    catch (Exception)
                    {
                        i++;
                        continue;
                    }
                    this.Controls.Add(pic);
                    y += progal + pic.Height;
                }
            }
        }
コード例 #6
0
        private void RenderPictureBoxes(List <Skill> skills, string commanderSkillset)
        {
            LOG.Debug("RenderPictureBoxes(" + skills.Count + ", " + commanderSkillset + ")");
            foreach (Skill s in skills)
            {
                LOG.Debug("Skill: " + s.Name);
                LOG.Debug("Render image: " + s.SortBy.ToString());
                PictureBox pb = (PictureBox)panelCaptainSkills.Controls["pic" + s.SortBy.ToString()];
                if (s.ImageUrl == null || s.ImageUrl.Equals(""))
                {
                    LOG.Debug("No image URL. Loading resource");
                    if (skillsPictures.ContainsKey(commanderSkillset + s.SortBy.ToString()))
                    {
                        LOG.Debug("Found resource...");
                        pb.Image = skillsPictures[commanderSkillset + s.SortBy.ToString()];
                    }
                    else
                    {
                        LOG.Warning("No resource found for image " + s.SortBy.ToString());
                        pb.Image = null;
                    }
                }
                else
                {
                    LOG.Debug("Loading url: " + s.ImageUrl);
                    pb.Load(s.ImageUrl);
                }
                pb.AccessibleName = s.Name;

                ToolTip ttip = new ToolTip
                {
                    AutomaticDelay = 500,
                    AutoPopDelay   = 9000,
                    ToolTipTitle   = s.Name
                };
                string tagText = s.Description + "\n" + s.Effect + "\n" + s.Notes;
                ttip.SetToolTip(pb, tagText);
            }
        }
コード例 #7
0
 private void Populate_View(string imageUrl)
 {
     if (InvokeRequired)
     {
         this.Invoke((MethodInvoker) delegate {
             Populate_View(imageUrl);
         });
         return;
     }
     else
     {
         PictureBox pictureBox = new PictureBox
         {
             Size      = new Size(120, 175),
             SizeMode  = PictureBoxSizeMode.Zoom,
             BackColor = Color.Transparent
         };
         pictureBox.Load(imageUrl);
         pictureBox.Click += PictureBox_Click;
         flpCovers.Controls.Add(pictureBox);
     }
 }
コード例 #8
0
            public void Setup(MapEditor form, int id)
            {
                var container = form.splitContainer1;
                var mapData   = form.mapData;
                var tileData  = mapData.tileData;

                pos.Y = PreviewSize * (id + 1);

                preview          = new PictureBox();
                preview.Location = new Point(pos.X, pos.Y);
                preview.Size     = new Size(PreviewSize, PreviewSize);
                preview.Load(tileData[id].first);

                button                   = new Button();
                button.Location          = new Point(pos.X + PreviewSize, pos.Y);
                button.Text              = $"{tileData[id].first}\nCan Move : {tileData[id].second}";
                button.Size              = new Size(Math.Max(150, container.SplitterDistance - PreviewSize - 4), PreviewSize);
                container.SplitterMoved += (object sender, SplitterEventArgs args) =>
                {
                    button.Size = new Size(Math.Max(150, args.X - PreviewSize - 4), PreviewSize);
                };
                button.MouseDown += (object sender, MouseEventArgs args) =>
                {
                    if (args.Button == MouseButtons.Left)
                    {
                        form.brush = id;
                    }
                    else if (args.Button == MouseButtons.Right)
                    {
                        var tuple = mapData.tileData[id];
                        tuple.second         = !tuple.second;
                        mapData.tileData[id] = tuple;
                        button.Text          = $"{tileData[id].first}\nCan Move : {mapData.tileData[id].second}";
                    }
                };

                container.Panel1.Controls.Add(preview);
                container.Panel1.Controls.Add(button);
            }
コード例 #9
0
        private TableLayoutPanel GetGridAgeResult(string imgPath, AgeResult ageResult)
        {
            var grid = new TableLayoutPanel();

            grid.ColumnCount = 2;
            grid.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
            grid.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 80F));
            grid.Dock     = DockStyle.Fill;
            grid.Name     = "gridGen";
            grid.RowCount = 2;
            grid.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
            grid.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
            grid.CellBorderStyle = TableLayoutPanelCellBorderStyle.Outset;

            var pct = new PictureBox();

            pct.SizeMode = PictureBoxSizeMode.StretchImage;
            pct.Dock     = DockStyle.Fill;
            pct.Load("https://i.ibb.co/mNnH91W/240px-Vorschriftszeichen-1-svg.png");

            var label1 = new Label()
            {
                Dock = DockStyle.Fill
            };
            var label2 = new Label()
            {
                Dock = DockStyle.Fill
            };
            var age = ageResult.age.OrderByDescending(f => f.confidence).FirstOrDefault();

            label1.Text = $"Диапазон Возраста: {age.ageRange.min}-{age.ageRange.max}.";
            label2.Text = $"Точность: {age.confidence}.";
            grid.Controls.Add(label1, 1, 0);
            grid.Controls.Add(label2, 1, 1);
            grid.Controls.Add(pct, 0, 0);
            grid.SetRowSpan(pct, 2);

            return(grid);
        }
コード例 #10
0
        public String LoadImage(String strURL, String strFileName, int iZoomValue)
        {
            try
            {
                PictureBox temp = new PictureBox();
                temp.Load(strURL);
                this.imageBox1.Image = temp.Image;

                imageBox1.SizeMode = ImageGlass.ImageBoxSizeMode.Normal;

                this.imageBox1.Image.Tag = strFileName;

                imageBox1.Zoom         = iZoomValue;
                imageBox1.ZoomChanged += imageBox1_ZoomChanged;
            }
            catch (System.Exception)
            {
                return("Error");
            }

            return("Ok");
        }
コード例 #11
0
        private void Form4_Load(object sender, EventArgs e)
        {
            this.panel3.Controls.Clear();
            List <PicNum> piclist = new List <PicNum>();

            piclist = search();
            if (piclist.Count > 0 && piclist != null)
            {
                int len = piclist.Count >= 3 ? 3 : piclist.Count;
                for (int i = 0; i < len; i++)
                {
                    string imgPath = piclist[i].picPath;
                    if (!System.IO.File.Exists(imgPath))
                    {
                        continue;
                    }
                    PictureBox pic = new PictureBox();
                    pic.Load(imgPath);
                    pic.Tag      = piclist[i].OrderNo;
                    pic.Size     = new Size(300, 100);
                    pic.SizeMode = PictureBoxSizeMode.StretchImage;
                    //pic.Height = 100;
                    //listView1.Controls.Add(pic);
                    pic.Location = new Point(10, i * 100);
                    pic.Click   += new System.EventHandler(this.pictureBox_Click);//添加Click事件
                    this.panel3.Controls.Add(pic);
                }
                if (Convert.ToDouble(piclist[0].similarity) > 0.8)
                {
                    InShow(piclist[0].OrderNo);
                }
            }
            else
            {
                Label lable = new Label();
                lable.Text = "无数据";
                this.panel3.Controls.Add(lable);
            }
        }
コード例 #12
0
        private void FillFlightControlTab()
        {
            ClearTab(CV.Controls, "cv");
            int c = 1;

            foreach (long fcId in selectedShip.Modules.FlightControl)
            {
                ModuleData module = Program.AllModules[fcId.ToString()];

                foreach (Control ctr in CV.Controls)
                {
                    if (ctr.Name.Equals("cvPanel" + c.ToString()))
                    {
                        TableLayoutPanel panel   = getTable(ctr);
                        PictureBox       picture = getPicture(ctr);
                        if (module.ImageUrl != null)
                        {
                            picture.Load(module.ImageUrl);
                        }
                        panel.Controls.Clear();
                        panel.Controls.Add(createHeadlineLabel("Name"), 0, 0);
                        panel.Controls.Add(createLabel(module.Name), 0, 1);

                        panel.Controls.Add(createHeadlineLabel("ID"), 1, 0);
                        panel.Controls.Add(createLabel(module.ID.ToString()), 1, 1);

                        panel.Controls.Add(createHeadlineLabel("Cost"), 2, 0);
                        panel.Controls.Add(createLabel(module.PriceCredits.ToString()), 2, 1);

                        string value = module.FighterSquadrons + " Fighters / " + module.BomberSquadrons + " Bombers / " + module.TorpedoSquadrons + " Torpedoes";
                        panel.Controls.Add(createHeadlineLabel("Squadrons"), 3, 0);
                        panel.Controls.Add(createLabel(value), 3, 1);

                        ctr.Visible = true;
                    }
                }
                c++;
            }
        }
コード例 #13
0
ファイル: Draws.cs プロジェクト: boksts/Perceptron
        public void ReadDraw(OpenFileDialog ofd, PictureBox pb, int Ni, ref int [] x)
        {
            ofd.ShowDialog();
            String s = ofd.FileName;

            pb.Load(s);
            pb.SizeMode = PictureBoxSizeMode.StretchImage;

            int    k   = 0;
            Bitmap Bmp = new Bitmap(s);
            Color  color;

            for (int j = 0; j < Bmp.Height; j++)
            {
                for (int i = 0; i < Bmp.Width; i++)
                {
                    color = Bmp.GetPixel(i, j);
                    x[k]  = ((color.R + color.B + color.G) < 50) ? 1 : 0;
                    k++;
                }
            }
        }
コード例 #14
0
        public void refresh_items()
        {
            GetSettings get_settings = new GetSettings(General.settings.username, General.settings.password, General.settings.host, General.settings.lang);
            string      data         = get_settings.execute();

            General.user = new JavaScriptSerializer().DeserializeObject(data) as IDictionary <string, object>;
            SMSHeaders SH    = new SMSHeaders(General.settings.username, General.settings.password, General.settings.host, General.settings.lang);
            string     data1 = SH.execute();

            General.headers = new JavaScriptSerializer().Deserialize <IList <string> >(data1);
            if (General.user != null)
            {
                fullname_lbl.Text          = General.user["fullname"].ToString();
                username_lbl.Text          = General.user["username"].ToString();
                total_waiting_lbl.Text     = General.user["waiting_all"].ToString();
                total_delivered_lbl.Text   = General.user["delivered_all"].ToString();
                total_undelivered_lbl.Text = General.user["undelivered_all"].ToString();
                total_count_lbl.Text       = General.user["count_all"].ToString();
                pkt_balance_tsslbl.Text    = string.Format("{0} SMS, {1} TELEFON", General.user["sms_balance_pkt"].ToString(), General.user["tel_balance_pkt"].ToString());
                balance_tsslbl.Text        = string.Format("{0} {1} BAKİYE", General.user["balance"].ToString(), General.user["currency"].ToString());
                try
                {
                    var Pbox = new PictureBox();
                    Pbox.Load(string.Format("http://{0}/media/profile_pictures/{1}.jpg", General.settings.host, General.user["username"].ToString()));
                    picture_pnl.BackgroundImage = Pbox.Image;
                }
                catch { }
                sms_header_cmbbx.DataSource = General.headers;
            }
            message_rchtxtbx.Text           = phoneset_rchtxtbx.Text = "";
            mainform_sttsstrp.BackColor     = SystemColors.Highlight;
            this.phoneset_rchtxtbx.ReadOnly = false;
            ready_tsslbl.Text     = "Ready";
            this.Is_SMSCustom     = false;
            this.ExcelFileName    = "";
            this.ExcelPhoneColumn = 0;
            this.GSM_Array        = null;
            this.message_auto_complete_menu.RemoveItems();
        }
コード例 #15
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter           = "Image files (jpg, jpeg, bmp, png)|*.jpg;*.jpeg;*.bmp;*.png";
            fd.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
            fd.RestoreDirectory = true;
            board.SuspendLayout();
            if (fd.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    PictureBox pb = new PictureBox();
                    pb.Size = new Size(board.Width, board.Height);
                    //pb.SizeMode = PictureBoxSizeMode.Zoom;
                    pb.Load(fd.FileName);

                    //MessageBox.Show("" + pb.Image.Width + " " + pb.Image.Height);
                    // this.Controls.Add(pb);

                    //pb.BringToFront();

                    // Bitmap bp = new Bitmap(board.Width, board.Height);

                    pb.Image = ResizeImage(pb.Image, 640, 480);


                    //MessageBox.Show("" + pb.Image.Width + " " + pb.Image.Height);


                    explode((Bitmap)pb.Image, board.ColumnCount, board.RowCount);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                }
            }
            board.ResumeLayout();
        }
コード例 #16
0
        private void FillGFCSTab()
        {
            ClearTab(GFCS.Controls, "gfcs");
            int c = 0;

            foreach (long id in selectedShip.Modules.FireControl)
            {
                ModuleData module = Program.AllModules[id.ToString()];
                foreach (Control ctr in GFCS.Controls)
                {
                    if (ctr.Name.Equals("gfcs" + c.ToString()))
                    {
                        TableLayoutPanel panel   = getTable(ctr);
                        PictureBox       picture = getPicture(ctr);
                        Label            lblName = getLabel(ctr);

                        if (module.ImageUrl != null)
                        {
                            picture.Load(module.ImageUrl);
                        }
                        lblName.Text = module.Name;

                        panel.Controls.Clear();
                        panel.Controls.Add(createHeadlineLabel("ID"), 0, 0);
                        panel.Controls.Add(createLabel(module.ID.ToString()), 0, 1);

                        panel.Controls.Add(createHeadlineLabel("Cost"), 1, 0);
                        panel.Controls.Add(createLabel(module.PriceCredits.ToString()), 1, 1);

                        panel.Controls.Add(createHeadlineLabel("Distance (km)"), 2, 0);
                        panel.Controls.Add(createLabel(module.FireDistance.ToString()), 2, 1);

                        ctr.Visible = true;
                    }
                }
                c++;
            }
        }
コード例 #17
0
        //Overloaded Constructor taking the full image URL as input
        public ImageDetailForm(string fullImageURL)
        {
            InitializeComponent();

            try {
                //Create a new PictureBox
                PictureBox pb = new PictureBox();

                //Load the image
                pb.Load(fullImageURL);

                //Set several other attributes
                pb.Left        = 30;
                pb.Top         = 30;
                pb.Width       = this.Width - 75;
                pb.Height      = this.Height - 95;
                pb.Visible     = true;
                pb.BorderStyle = BorderStyle.FixedSingle;
                pb.SizeMode    = PictureBoxSizeMode.StretchImage;

                //Add the PictureBox to the Form's controls
                this.Controls.Add(pb);
            }

            catch (ArgumentException)
            {
                //Close the window and release the associated resources
                this.Close();
                this.Dispose();
            }

            catch (WebException)
            {
                //Close the window and release the associated resources
                this.Close();
                this.Dispose();
            }
        }
コード例 #18
0
ファイル: Form1.cs プロジェクト: PURVA-REDKAR/C-
        private void tb_factrese_Enter(object sender, EventArgs e)
        {
            string jsonResearch = getRestData("/research/");

            research = JToken.Parse(jsonResearch).ToObject <Research>();

            tbl_byfact.Controls.Clear();

            for (int i = 0; i < research.byFaculty.Count; i++)
            {
                if (i != 0)
                {
                    tbl_byfact.RowCount = tbl_byfact.RowCount + 1;
                }
                int row = 0;



                // RichTextBox richTB = new RichTextBox();


                String s = research.byFaculty[i].facultyName;
                if (!s.Equals("Deborah Gears"))
                {
                    PictureBox richTB = new PictureBox();
                    richTB.Text = research.byFaculty[i].facultyName;
                    richTB.Name = "factBox1" + i + row;
                    richTB.Load(people.faculty.Find(x => x.name.Equals(s)).imagePath);
                    richTB.SizeMode = PictureBoxSizeMode.StretchImage;
                    richTB.Click   += new EventHandler(this.byfactname);

                    tbl_byfact.Controls.Add(richTB);
                    tbl_byfact.SetColumn(richTB, i);
                    tbl_byfact.SetRow(richTB, row);
                    row++;
                }
            }
        }
コード例 #19
0
 public void RefreshGames()
 {
     for (int i = 0; i < libraryGames.Count; i++)
     {
         // Inizializza la foto dei giochi
         PictureBox game = new PictureBox();
         game.Parent = flpGames;
         game.Click += gameLaunch;
         // Modifica alcune sue proprieta'
         game.Name = "game_" + i;
         // VECCHIO METODO ->    game.Tag = lbxLibrary.Items[i].ToString();
         game.Tag      = libraryGames[i];
         game.Width    = 230;
         game.Height   = 107;
         game.SizeMode = PictureBoxSizeMode.StretchImage;
         // Ricava lo steam Id
         // VECCHIO METODO ->    string gameName = lbxLibrary.Items[i].ToString();
         string gameName = libraryGames[i];
         string steamid  = gameName.Substring(gameName.LastIndexOf("/") + 1);
         // Carica immagine
         game.Load("http://cdn.akamai.steamstatic.com/steam/apps/" + steamid + "/header.jpg");;
     }
 }
コード例 #20
0
        public void getboxart(string hexid, PictureBox pbxBoxart, PictureBox pbxRegion)
        {
            if (hexid == "")
            {
                pbxBoxart.Image = null;
                pbxRegion.Image = null;
            }
            else
            {
                pbxBoxart.Load("http://www.wiiboxart.com/artwork/cover/" + hexid.Replace(System.Environment.NewLine, "") + ".png");
                switch (hexid[3].ToString())
                {
                case "P": pbxRegion.Image = Properties.Resources.pal;
                    break;

                case "E": pbxRegion.Image = Properties.Resources.ntsc;
                    break;

                case "J": pbxRegion.Image = Properties.Resources.ntscj;
                    break;
                }
            }
        }
コード例 #21
0
 private void Click_Image(object sender, EventArgs e)
 {
     LastPictureBox = (PictureBox)sender;
     NameDeleteImage.Add(LastPictureBox.ImageLocation);
     if (iNameImage != NameImages.Count)
     {
         try
         {
             LastPictureBox.Load(nameDir + NameImages[iNameImage]);
             iNameImage++;
             LastPictureBox.Refresh();
         }
         catch
         {
             NameDeleteImage.Add(nameDir + NameImages[iNameImage]);
             iNameImage++;
         }
     }
     else
     {
         label1.Text = " end ";
     }
 }
 private void addFriendToListViewAsync(object i_ListView)
 {
     if (this.InvokeRequired)
     {
         AddItemCallback a = new AddItemCallback(addFriendToListViewAsync);
         Invoke(a, new object[] { i_ListView });
     }
     else
     {
         foreach (User friend in User.Friends)
         {
             PictureBox pb = new PictureBox();
             pb.Load(friend.PictureSmallURL);
             Image            img = pb.Image;
             UserListViewItem userListViewItem = new UserListViewItem(friend);
             userListViewItem.ImageKey = friend.Name;
             userListViewItem.Name     = friend.Name;
             userListViewItem.Text     = friend.Name;
             this.LargeImageList.Images.Add(friend.Name, img);
             this.Items.Add(userListViewItem);
         }
     }
 }
コード例 #23
0
ファイル: Form2.cs プロジェクト: Shonsanchez/cilentProject3
        public void createAmbassTab(StudentAmbassadors sa)
        {
            int x = 50;
            int y = 50;

            ambassTab.Controls.Add(e.createLabel(sa.title, x, y));
            y += 30;
            PictureBox pb = new PictureBox();

            pb.Size     = new Size(400, 225);
            pb.Location = new Point(x, y);
            pb.SizeMode = PictureBoxSizeMode.StretchImage;
            pb.Load(sa.ambassadorsImageSource);
            ambassTab.Controls.Add(pb);
            y += 320;
            foreach (SubSectionContent sc in sa.subSectionContent)
            {
                ambassTab.Controls.Add(e.createLabel(sc.title, x, y));
                y += 20;
                ambassTab.Controls.Add(e.createTextBox(sc.description, x, y, 400, 125));
                y += 150;
            }
        }
コード例 #24
0
        private void generatePicBox(string fileName)
        {
            PictureBox pic = new PictureBox();

            pic.Tag = optionList[currentOption];
            if (File.Exists(i_path + @"\" + fileName))
            {
                pic.Load(i_path + @"\" + fileName);
            }
            else
            {
                pic.Image = VirtualTrain.Properties.Resources.error;
            }

            pic.Width    = 100;
            pic.Height   = 100;
            pic.SizeMode = PictureBoxSizeMode.StretchImage;

            pnl.Controls.Add(pic);
            pic.Location = new Point((currentOption % 5) * (pic.Width + space) + initX, (currentOption > 4 ? 1 : 0) * (pic.Height + vspace) + initY);
            currentOption++;
            generateCheckBox(pic.Tag.ToString(), pic.Location);
        }
コード例 #25
0
ファイル: Form1.cs プロジェクト: DeadMoros/cutPhotos
        private void button3_Click_1(object sender, EventArgs e)
        {
            string FullName = "";

            try
            {
                FullName = images[positionOfImage].FullName;

                if (File.Exists(FullName))
                {
                    pb = new PictureBox();
                    pb.Load(FullName);
                    pictureBox1.Image = new Bitmap(pb.Image);
                }
                currentImage = (Bitmap)pictureBox1.Image.Clone();
                cutImage     = (Bitmap)pictureBox1.Image.Clone();
                pictureBox1.Invalidate();
            }
            catch (Exception ee)
            {
                MessageBox.Show("Не удалось загрузить новый файл" + ee.Message + " Имя файла: " + FullName, "Oшибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void initFriendsPanel()
        {
            var userFriends = m_User.Friends;

            Invoke(
                new Action(() =>
            {
                listViewFriends.View = View.LargeIcon;
                listViewFriends.LargeImageList.ImageSize  = new Size(64, 64);
                listViewFriends.LargeImageList.ColorDepth = ColorDepth.Depth24Bit;
                OprogressBarLoginAndFetchData.Maximum     = m_User.Friends.Count + OprogressBarLoginAndFetchData.Value;
            }),
                null);

            foreach (User friend in m_User.Friends)
            {
                PictureBox pictureBox = new PictureBox();
                pictureBox.Load(friend.PictureSmallURL);
                Image            friendImage      = pictureBox.Image;
                UserListViewItem userListViewItem = new UserListViewItem(friend);
                userListViewItem.ImageKey = friend.Name;
                userListViewItem.Name     = friend.Name;
                userListViewItem.Text     = friend.Name;
                Invoke(new Action(() =>
                {
                    listViewFriends.LargeImageList.Images.Add(friend.Name, friendImage);
                    listViewFriends.Items.Add(userListViewItem);
                    OprogressBarLoginAndFetchData.IncrementByOne();
                }));
            }

            Invoke(new Action(() =>
            {
                OprogressBarLoginAndFetchData.Reset();
                m_LoginAndDataFetchCompleted = true;
            }));
        }
コード例 #27
0
        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 60; i++)
            {
                a[i] = 0;
            }
            int sump = 0, j = 0, k = 0;

            for (int i = 1; ; i++)
            {
                Random rd = new Random();
                num = rd.Next(1, 53);
                if (a[num] == 0)
                {
                    a[num] = 1;
                    sump++;
                    PictureBox p = new PictureBox();
                    p.Name = "pictureBox" + i.ToString();
                    p.Size = new System.Drawing.Size(85, 125);

                    p.Top  = 10 + k * 120;
                    p.Left = 10 + j * 40;
                    j++; if (j % 13 == 0)
                    {
                        j = 0; k++;
                    }

                    p.Load("..\\..\\..\\Poker_Card\\" + num + ".png");
                    Controls.Add(p);
                    p.BringToFront();
                }
                if (sump == 52)
                {
                    break;
                }
            }
        }
コード例 #28
0
 private void Make_Picture_Boxes(List <string> lst)
 {
     try
     {
         if (lst == null || lst.Count == 0)
         {
             return;
         }
         fPanel.AutoScroll = true;
         for (var i = fPanel.Controls.Count - 1; i >= 0; i--)
         {
             fPanel.Controls[i].Dispose();
         }
         for (var i = 0; i < lst.Count; i++)
         {
             try
             {
                 var picbox = new PictureBox();
                 Controls.Add(picbox);
                 picbox.Size = new Size(62, 63);
                 picbox.Load(lst[i]);
                 picbox.Name     = "pic" + i;
                 picbox.Cursor   = Cursors.Hand;
                 picbox.SizeMode = PictureBoxSizeMode.StretchImage;
                 fPanel.Controls.Add(picbox);
             }
             catch (Exception)
             {
                 lst.RemoveAt(i);
             }
         }
     }
     catch (Exception exception)
     {
         WebErrorLog.ErrorInstence.StartErrorLog(exception);
     }
 }
コード例 #29
0
        private void AddUpgradePanel(Consumable upgrade, int upgradeNo)
        {
            if (upgradeNo < 0 || upgradeNo > 5)
            {
                return;
            }

            Panel pnl = (Panel)Upgrades.Controls["upgrade" + upgradeNo];

            if (pnl != null)
            {
                Label lblHead  = (Label)pnl.Controls["lblHeadline" + upgradeNo];
                Label lblDesc  = (Label)pnl.Controls["lblDescription" + upgradeNo];
                Label lblPerks = (Label)pnl.Controls["lblPerks" + upgradeNo];
                Label lblCost  = (Label)pnl.Controls["lblCostSlot" + upgradeNo];

                lblHead.Text = upgrade.Name.Replace("\n", "");
                lblDesc.Text = upgrade.Description;

                string perks = "";
                foreach (KeyValuePair <string, ConsumableProfile> prof in upgrade.Profile)
                {
                    ConsumableProfile profile = prof.Value;
                    perks += profile.Description + "\n";
                }
                lblPerks.Text = perks;

                PictureBox pb = (PictureBox)pnl.Controls["picture" + upgradeNo];
                pb.Load(upgrade.ImageUrl);

                string txt = "Credits: " + upgrade.Credits;
                lblCost.Text = txt;

                pnl.Visible = true;
                pnl.Refresh();
            }
        }
コード例 #30
0
        private void initializeComponent(string splashImageFullPath)
        {
            components  = new System.ComponentModel.Container();
            pictureBox1 = new PictureBox();
            timer1      = new Timer(components);
            ((System.ComponentModel.ISupportInitialize)(pictureBox1)).BeginInit();
            SuspendLayout();

            //
            // Picture Box
            //
            pictureBox1.Location = new System.Drawing.Point(0, 0);
            pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
            pictureBox1.Load(splashImageFullPath);
            pictureBox1.BorderStyle = BorderStyle.FixedSingle;
            Controls.Add(pictureBox1);

            //
            // Form
            //
            ClientSize        = pictureBox1.Size;
            FormBorderStyle   = FormBorderStyle.None;
            AllowTransparency = true;
            TopMost           = true;
            StartPosition     = FormStartPosition.CenterScreen;
            this.Click       += ((sender, e) => Close());

            //
            // Timer
            //
            timer1.Interval = 10;
            timer1.Tick    += timer1_Tick;

            ((System.ComponentModel.ISupportInitialize)(pictureBox1)).EndInit();

            ResumeLayout(true);
        }