示例#1
0
        public Form1()
        {
            InitializeComponent();
            lctrl = new LoanCtrl();
            // To get the right list enter string name of the list, this is made for direct access
            // to the list so the checkboxes respond directly
            dataGridView1.DataSource = lctrl.GetDirectList("loans");
            dataGridView1.BackgroundColor = Color.Silver;
            dataGridView1.Columns[3].Visible = true;
            dataGridView1.Columns[0].ReadOnly = true;
            dataGridView1.Columns[1].ReadOnly = true;
            dataGridView1.Columns[2].ReadOnly = true;

            DataGridViewCellStyle style = new DataGridViewCellStyle();
            DataGridViewCellStyle styleHeader = new DataGridViewCellStyle();
            style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            styleHeader.Alignment = DataGridViewContentAlignment.MiddleCenter;
            styleHeader.Padding = new Padding(20, 0, 0, 0);
            dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray;
            dataGridView1.EnableHeadersVisualStyles = false;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.RowsDefaultCellStyle.SelectionBackColor = Color.DeepSkyBlue;
            dataGridView1.RowsDefaultCellStyle.SelectionForeColor = Color.Black;
            dataGridView1.RowHeadersVisible = false;
            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                column.HeaderCell.Style = styleHeader;
                column.DefaultCellStyle = style;
            }
            dataGridView1.Columns[3].HeaderCell.Style = style;
        }
示例#2
0
 public void TableUpdate()
 {
     lctrl = new LoanCtrl();
     DataSet ds = new DataSet();
     BindingSource bs = new BindingSource();
     bs.DataSource = lctrl.GetDirectList("loans");
     dataGridView1.DataSource = bs;
 }
示例#3
0
 public PopUp()
 {
     InitializeComponent();
     textBox1.Enabled = false;
     textBox2.Enabled = false;
     textBox3.Enabled = false;
     lc = new LoanCtrl();
     textBox1.Text = lc.GetLoan(Index).Name;
     textBox2.Text = lc.GetLoan(Index).Amount.ToString();
     textBox3.Text = lc.GetLoan(Index).Date;
 }