Пример #1
0
        private void btnSelectAccountCode_Click(object sender, EventArgs e)
        {
            try
            {
                //pnllv = new Panel();
                lv       = new ListView();
                frmPopup = new Form();
                frmPopup.StartPosition = FormStartPosition.CenterScreen;
                frmPopup.BackColor     = Color.CadetBlue;
                //frmPopup.ShowIcon = false;
                frmPopup.MaximizeBox     = false;
                frmPopup.MinimizeBox     = false;
                frmPopup.ControlBox      = false;
                frmPopup.FormBorderStyle = FormBorderStyle.FixedSingle;

                frmPopup.Size   = new Size(450, 300);
                lv              = AccountCodeDB.getAccountCodeListView();
                lv.ColumnClick += new ColumnClickEventHandler(LvColumnClick);
                lv.Bounds       = new Rectangle(new Point(0, 0), new Size(450, 250));
                frmPopup.Controls.Add(lv);

                Button lvOK = new Button();
                lvOK.BackColor = Color.Tan;
                lvOK.Text      = "OK";
                lvOK.Location  = new Point(44, 270);
                lvOK.Click    += new System.EventHandler(this.lvOK_Clicked);
                frmPopup.Controls.Add(lvOK);

                Button lvCancel = new Button();
                lvCancel.BackColor = Color.Tan;
                lvCancel.Text      = "CANCEL";
                lvCancel.Location  = new Point(141, 270);
                lvCancel.Click    += new System.EventHandler(this.lvCancel_Clicked);
                frmPopup.Controls.Add(lvCancel);

                Label lblSearch = new Label();
                lblSearch.Text     = "Find";
                lblSearch.Location = new Point(250, 272);
                lblSearch.Size     = new Size(45, 15);
                frmPopup.Controls.Add(lblSearch);

                txtSearch              = new TextBox();
                txtSearch.Location     = new Point(300, 270);
                txtSearch.TextChanged += new EventHandler(txtSearch_TextChanged);
                frmPopup.Controls.Add(txtSearch);

                frmPopup.ShowDialog();
                //pnllv.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
        }
Пример #2
0
        private void brnSelectAccCode_Click(object sender, EventArgs e)
        {
            grdList.Rows.Clear();
            removeControlsFromlvPanel();
            pnlList.Controls.Remove(pnllv);
            ////btnSelectAccCode.Enabled = false;
            pnllv             = new Panel();
            pnllv.BorderStyle = BorderStyle.FixedSingle;

            pnllv.Bounds    = new Rectangle(new Point(311, 46), new Size(566, 281));
            lv              = AccountCodeDB.getAccountCodeListView();
            lv.ColumnClick += new ColumnClickEventHandler(LvColumnClick);
            //this.lv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView1_ItemChecked1);
            lv.Bounds = new Rectangle(new Point(35, 13), new Size(500, 225));
            pnllv.Controls.Add(lv);

            Button lvOK = new Button();

            lvOK.Text     = "OK";
            lvOK.Location = new Point(71, 245);
            lvOK.Click   += new System.EventHandler(this.lvOK_Click2);
            pnllv.Controls.Add(lvOK);

            Button lvCancel = new Button();

            lvCancel.Text     = "Cancel";
            lvCancel.Location = new Point(187, 245);
            lvCancel.Click   += new System.EventHandler(this.lvCancel_Click2);
            pnllv.Controls.Add(lvCancel);

            Label lblSearch = new Label();

            lblSearch.Text     = "Find";
            lblSearch.Location = new Point(364, 249);
            lblSearch.Size     = new Size(37, 15);
            pnllv.Controls.Add(lblSearch);

            txtSearch              = new TextBox();
            txtSearch.Location     = new Point(414, 246);
            txtSearch.TextChanged += new EventHandler(txtSearch_TextChanged);
            pnllv.Controls.Add(txtSearch);

            pnlList.Controls.Add(pnllv);
            pnllv.BringToFront();
            pnllv.Visible = true;

            txtSearch.Focus();
        }