Exemplo n.º 1
0
        public CreateView_Form(DBTableControl dbTables, SQLTable tbl, TableDockingForm dtF, NavigationButtons.Navigation xnav)
        {
            nav = xnav;
            this.Visible = false;
            bFormCreated = false;
            m_TableDockingForm = dtF;
            m_DBTables = dbTables;
            m_tbl = tbl;
            this.Icon=Properties.Resources.DataView_FormIcon;
            InitializeComponent();
            nmUpDn_Limit.Minimum = 0;
            nmUpDn_Limit.Maximum = 1000000000;
            chk_Limit.Checked = Properties.Settings.Default.bLimit;
            nmUpDn_Limit.Value = Convert.ToDecimal(Properties.Settings.Default.iLimitNumber);
            chk_Descending.Checked = Properties.Settings.Default.b_order_by_ID_desc;

            this.flowLayoutPanel1.Tag = 1;
            this.flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight;
            this.flowLayoutPanel2.Tag = 2;
            this.flowLayoutPanel2.FlowDirection = FlowDirection.TopDown;

            PictureBox pictureBox_MoveRight = new PictureBox();
            pictureBox_MoveRight.Image = Properties.Resources.MoveRightIcon.ToBitmap();
            pictureBox_MoveRight.Parent = this;
            pictureBox_MoveRight.Left = flowLayoutPanel2.Left + flowLayoutPanel2.Width + 3;
            pictureBox_MoveRight.Top = flowLayoutPanel2.Top + flowLayoutPanel2.Height / 4;
            pictureBox_MoveRight.Width = pictureBox_MoveRight.Image.Size.Width + 6;
            pictureBox_MoveRight.Height = pictureBox_MoveRight.Image.Size.Height + 6;
            pictureBox_MoveRight.Visible = true;
            //pictureBox_MoveRight.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;

            PictureBox pictureBox_MoveLeft = new PictureBox();
            pictureBox_MoveLeft.Image = Properties.Resources.MoveLeftIcon.ToBitmap();
            pictureBox_MoveLeft.Parent = this;
            pictureBox_MoveLeft.Left = flowLayoutPanel2.Left + flowLayoutPanel2.Width + 3;
            pictureBox_MoveLeft.Top = flowLayoutPanel2.Top + flowLayoutPanel2.Height/4 + 30;
            pictureBox_MoveLeft.Width = pictureBox_MoveLeft.Image.Size.Width + 6;
            pictureBox_MoveLeft.Height = pictureBox_MoveLeft.Image.Size.Height + 6;
            pictureBox_MoveLeft.Visible = true;
            //pictureBox_MoveLeft.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
            //this.pictureBox2.Image = Properties.Resources.MoveLeftIcon.ToBitmap();

            this.flowLayoutPanel1.DragEnter += new DragEventHandler(flowLayoutPanel1_DragEnter);
            this.flowLayoutPanel1.DragDrop += new DragEventHandler(flowLayoutPanel1_DragDrop);
            this.flowLayoutPanel2.DragEnter += new DragEventHandler(flowLayoutPanel1_DragEnter);
            this.flowLayoutPanel2.DragDrop += new DragEventHandler(flowLayoutPanel1_DragDrop);

            if (!bFormCreated)
            {

                int iCtrl = 1;
                m_pTableDockingFormXml = m_DBTables.m_xml.GetTableDockingFormXml(m_tbl.TableName);
                if (m_pTableDockingFormXml == null)
                {
                    m_pTableDockingFormXml = m_DBTables.m_xml.Create_pTableDockingFormXml(m_tbl.TableName);
                    m_DBTables.m_xml.m_xmldata.Add(m_pTableDockingFormXml);
                }
                if (m_pTableDockingFormXml.m_CreateViewFormXml == null)
                {
                    m_pTableDockingFormXml.Create_pCreateViewFormXml();
                }

                m_pTableDockingFormXml.m_CreateViewFormXml.wrect.SetFormPlacement(this);

                // Create DefineView_InputControls with no binding to xml data !
                m_tbl.Create_DefineView_InputControls(null, "", ref m_tbl.DefineView_inpCtrlList, this, this, ref iCtrl);

                //this.DynamicCreateControls(m_DBTables.m_xml.GetCreateViewFormDefaultView(m_tbl.TableName));

                this.DynamicCreateControls(m_pTableDockingFormXml.m_CreateViewFormXml.m_DefaultViewXml);

                bFormCreated = true;
            }
            this.Text = lngRPM.s_DataView_Form.s + m_tbl.lngTableName.s + " (" + m_tbl.TableName + ")";
            tsmi_CreateNew.Text = lngRPM.s_CreateNewView.s;
            tsmi_Select_View.Text = lngRPM.s_SelectView.s;
            tsmi_DeleteView.Text = lngRPM.s_DeleteView.s;
            tsmi_Save.Text =  lngRPM.s_Save.s;
            tsmi_Show.Text = lngRPM.s_Show.s;
            label_PrimaryView.Text = lngRPM.s_PrimaryView.s;
            chk_Limit.Text = lngRPM.s_Limit.s;
            chk_Descending.Text = lngRPM.s_Descending.s;
            grb_ShowLimits.Text = lngRPM.s_View.s;
        }