UCPosit.cs 1.4 KB
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UserCtrlsByDXC
{
    public partial class UCPosit : UserControl
    {
        public UCPosit()
        {
            InitializeComponent();
        }

        private int listNo = 0;
        public int ListNo
        {
            get { return listNo; }
            set
            {
                listNo = value;
                flowLayoutPanel1.Controls.Clear();
                //this.Size = new Size(15 * listNo, 25);
                for (int i = 0; i < listNo; i++)
                {
                    Button bt = new Button();
                    bt.FlatStyle = FlatStyle.Popup;
                    //bt.Image = Properties.Resources.List;
                    bt.BackColor = Color.MediumTurquoise;
                    bt.Size = new Size(29, 24);
                    //bt.Location = new Point(15 * i, 0);
                    bt.ForeColor = Color.Blue;
                    bt.Font=new Font("Airal", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    bt.Text = (i + 1).ToString();
                    bt.Margin = new Padding(0);
                    //bt.Enabled = false;
                    flowLayoutPanel1.Controls.Add(bt);
                }
            }
        }
    }
}