Inheritance: System.Windows.Forms.UserControl
コード例 #1
0
        private void tsbSelect_Click(object sender, EventArgs e)
        {
            if (tsbExit.Visible)
            {
                return;
            }

            if (tsbExitPrint.Visible)
            {
                tsbExitPrint_Click(null, null);
            }


            gbxUp.Visible   = false;
            dgvInfo.Visible = false;
            tsbExit.Visible = true;

            ucInfo frm = new ucInfo();

            gbxMiddle.Controls.Add(frm);
            frm.Dock = DockStyle.Fill;
            frm.tableLayoutPanel.RowCount = this.dgvInfo.ColumnCount;

            for (int i = 0; i < this.dgvInfo.ColumnCount - 1; i++)
            {
                Label lblName = new Label();
                lblName.Text = this.dgvInfo.Columns[i].Name;
                frm.tableLayoutPanel.Controls.Add(lblName);


                Label lblValue = new Label();
                lblValue.Text   = this.dgvInfo[i, 0].Value.ToString();
                lblValue.Anchor = AnchorStyles.Left;
                frm.tableLayoutPanel.Controls.Add(lblValue);
                lblValue.DataBindings.Add("Text",
                                          this.dgvInfo.DataSource, lblName.Text);
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: hubuUniversity/demo
        private void tsbSelect_Click(object sender, EventArgs e)
        {
            if (tsbExit.Visible)
            {
                return;
            }

            if (tsbExitPrint.Visible)
            {
                tsbExitPrint_Click(null, null);
            }


            gbxUp.Visible = false;
            dgvInfo.Visible = false;
            tsbExit.Visible = true;

            ucInfo frm = new ucInfo();
            gbxMiddle.Controls.Add(frm);
            frm.Dock = DockStyle.Fill;
            frm.tableLayoutPanel.RowCount = this.dgvInfo.ColumnCount;

            for (int i = 0; i < this.dgvInfo.ColumnCount - 1; i++)
            {
                Label lblName = new Label();
                lblName.Text = this.dgvInfo.Columns[i].Name;
                frm.tableLayoutPanel.Controls.Add(lblName);


                Label lblValue = new Label();
                lblValue.Text = this.dgvInfo[i, 0].Value.ToString();
                lblValue.Anchor = AnchorStyles.Left;
                frm.tableLayoutPanel.Controls.Add(lblValue);
                lblValue.DataBindings.Add("Text", 
                    this.dgvInfo.DataSource,lblName.Text);
            }
        }