Example #1
0
        public bool LoadAlarmSetInfo(CheckBox chbType, ComboBox cmbType, TextBox txtPath, int intType,ButtonCaptionPanel bcpPath,ButtonCaptionPanel bcpTest)
        {
            DataSet ds = null;
            using(ds=new DataSet())
            {
                ds = asdal.GetAlarmSetInfo(intType);

                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    int i = Convert.ToInt32(ds.Tables[0].Rows[0][1]);
                    cmbType.SelectedValue = i;
                    if (i == 1 || i == 2)
                    {
                        txtPath.Enabled = false;
                        bcpPath.Enabled = false;
                        bcpTest.Enabled = false;
                        txtPath.Text = "";
                    }
                    else
                    {
                        txtPath.Enabled = true;
                        bcpPath.Enabled = true;
                        bcpTest.Enabled = true;
                        txtPath.Text = ds.Tables[0].Rows[0][2].ToString();
                    }
                    if (Convert.ToInt32(ds.Tables[0].Rows[0][3])== 1)
                    {
                        chbType.Checked = true;
                    }
                    else
                    {
                        chbType.Checked = false;
                    }
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        /// 初始化窗体,组件的布局
        /// </summary>
        private void InitComponent()
        {
            cpStationConfig.Location = new Point(5, 43);
            cpStationConfig.Size = new Size(this.Width, 32);
            cpStationConfig.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Top) | (AnchorStyles.Right));
            cpStationConfig.CaptionTitle = KJ128NDataBase.HardwareName.Value(KJ128NDataBase.CorpsName.Station) + "及" + KJ128NDataBase.HardwareName.Value(KJ128NDataBase.CorpsName.StaHead) + "配置信息";//图示_当前"+KJ128NDataBase.HardwareName.Value(KJ128NDataBase.CorpsName.Station)+"配置";
            cpStationConfig.CaptionHeight = 30;
            cpStationConfig.CaptionTitleTop = 8;
            cpStationConfig.IsOnlyCaption = true;
            cpStationConfig.SetCaptionPanelStyle = CaptionPanelStyleEnum.BlueCaption;

            // 添加翻页按钮
            sumCount = new CaptionPanel();
            sumCount.CaptionTitleLeft = 0;
            sumCount.Location = new Point(this.Width - 63 - 200 -155, 10);
            sumCount.Size = new Size(130,32);

            cpStationConfig.Controls.Add(sumCount);
            
            cpUp = new ButtonCaptionPanel();
            cpUp.SetCaptionPanelStyle = CaptionPanelStyleEnum.windowsStyle;
            cpUp.Location = new Point(this.Width-63-60-155, 10);
            cpUp.Size = new Size(63, 32);
            cpUp.CaptionTitle = "上一页";
            cpUp.IsOnlyCaption = true;
            cpUp.SetButtonStyle = ButtonCaptionPanelButtonStyle.Office2003Style;
            //cpUp.SetCaptionPanelStyle = CaptionPanelStyleEnum.BlueCaption; --zdc
            cpUp.Click += new EventHandler(cpUp_Click);
            
            cpStationConfig.Controls.Add(cpUp);


            cpDown = new ButtonCaptionPanel();
            cpDown.SetCaptionPanelStyle = CaptionPanelStyleEnum.windowsStyle;
            cpDown.Location = new Point(this.Width +10-60-155, 10);
            cpDown.Size = new Size(63, 32);
            cpDown.CaptionTitle = "下一页";
            cpDown.IsOnlyCaption = true;
            cpDown.SetButtonStyle = ButtonCaptionPanelButtonStyle.Office2003Style;
           // cpDown.SetCaptionPanelStyle = CaptionPanelStyleEnum.BlueCaption;--zdc
            cpDown.Click += new EventHandler(cpDown_Click);
            cpStationConfig.Controls.Add(cpDown);

            txtPage = new CaptionPanel();
            txtPage.CaptionTitleLeft = 0;
            txtPage.Location = new Point(this.Width + 80-60-155, 10);
            txtPage.Size = new Size(30, 32);
            cpStationConfig.Controls.Add(txtPage);

            lblSumPage = new CaptionPanel();
            lblSumPage.CaptionTitleLeft = 0;
            lblSumPage.Location = new Point(this.Width + 114-60-155, 10);
            lblSumPage.Size = new Size(40, 32);
            cpStationConfig.Controls.Add(lblSumPage);

            txtCheckPage = new KJ128N.Command.TxtNumber();
            txtCheckPage.Location = new Point(this.Width + 149-50-155, 10);
            txtCheckPage.Size = new Size(35, 22);
            txtCheckPage.Text = "1";
            cpStationConfig.Controls.Add(txtCheckPage);

            cpCheckPage = new ButtonCaptionPanel();
            cpCheckPage.SetCaptionPanelStyle = CaptionPanelStyleEnum.windowsStyle;
            cpCheckPage.Location = new Point(this.Width + 182-40-155, 10);
            cpCheckPage.Size = new Size(63, 32);
            cpCheckPage.CaptionTitle = "跳  至";
            cpCheckPage.IsOnlyCaption = true;
            cpCheckPage.SetButtonStyle = ButtonCaptionPanelButtonStyle.Office2003Style;
            //chCheckPage.
            //cpCheckPage.SetCaptionPanelStyle = CaptionPanelStyleEnum.BlueCaption; --zdc
            cpCheckPage.Click += new EventHandler(cpCheckPage_Click);
            cpStationConfig.Controls.Add(cpCheckPage);
            this.Controls.Add(cpStationConfig);
            
            //每页显示行数
            cpCount = new ButtonCaptionPanel();
            cpCount.SetCaptionPanelStyle = KJ128WindowsLibrary.CaptionPanelStyleEnum.Office2007Panel;
            cpCount.Location = new Point(350, 5);
            cpCount.Size = new Size(106, 22);
            cpCount.CaptionTitle = "每页显示条数:";
            cpCount.IsOnlyCaption = true;
            cpCount.SetButtonStyle = ButtonCaptionPanelButtonStyle.None;

            cpStationConfig.Controls.Add(cpCount);
            this.Controls.Add(cpStationConfig);

            //选中每页行数
            cbpageSize = new ComboBox();
            cbpageSize.DropDownStyle = ComboBoxStyle.DropDownList;
            cbpageSize.Size = new System.Drawing.Size(44, 20);
            cbpageSize.Location = new Point(350 + cpCount.Width + 10, 5);
            cbpageSize.Items.AddRange(new object[] {"20","40","50","100","200"});
            cbpageSize.SelectedIndex = 0;
            cbpageSize.DropDownClosed += new EventHandler(cbpageSize_DropDownClosed);
            cpStationConfig.Controls.Add(cbpageSize);
            //panel1.Dock = DockStyle.Top;
            //cpStationConfig.Dock = DockStyle.Top;
            this.panel3.Controls.Add(cpStationConfig);
            cpStationConfig.Dock = DockStyle.Fill;

            vspStationConfigInfo.Location = new Point(5, cpStationConfig.Top + cpStationConfig.Height);
            vspStationConfigInfo.Size = new Size(780, 480);
            vspStationConfigInfo.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Top) | (AnchorStyles.Right) | (AnchorStyles.Bottom));
            vspStationConfigInfo.LayoutType = VSPanelLayoutType.VerticalType;
            vspStationConfigInfo.IsBorderLine = true;
            vspStationConfigInfo.AutoScroll = true;
            //vspStationConfigInfo.Dock = DockStyle.Fill;
            this.panel2.Controls.Add(vspStationConfigInfo);
            vspStationConfigInfo.Dock = DockStyle.Fill;
        }