خرید بک لینک

Vote count: 0

I try to put text from 0 to 11 on 12 pictureboxes have a ball image, but get the text 11 on all.

How can I get the text on the balls from 0 to 11 ?

here is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace wfballs2
{
    public partial class Form1 : Form
    {
        String s;
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            PictureBox[] Shapes = new PictureBox[12];
            for (int i = 0; i < 12; i++)
            {
                s = Convert.ToString(i);
                Shapes[i] = new PictureBox();
                Shapes[i].Name = "ball" + i.ToString();
                Shapes[i].Location = new Point(10 + 45 * i, 300);
                Shapes[i].Size = new Size(40, 40);
                Shapes[i].Image = Image.FromFile(@ "C:UsersEikoDesktopballball.jpg");
                Shapes[i].SizeMode = PictureBoxSizeMode.CenterImage;
                Shapes[i].Visible = true;
                this.Controls.Add(Shapes[i]);
                Shapes[i].Paint += new PaintEventHandler((sender2, e2) =>
                {
                    e2.Graphics.DrawString(s, Font, Brushes.Black, 10, 13);
                });
            }
        }
    }
}

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 17 ارديبهشت 1395 ساعت: 23:13

صفحه بندی