private void pumpBlock_Click(object sender, EventArgs e) { CPumpButton pBSender = (CPumpButton)sender; if (pBSender.Enabled) { foreach (CPumpButton pumpBlock in pumpList) { pumpBlock.Checked = pumpBlock == pBSender; } SelectedPumpIndex = pBSender.PumpIndex; cylinder_OnCylinderClicked(0); // bool vb = DataPool.CDataPool.GetDataPoolObject().GetBoolValue( selectedPumpIndex, selectedCylinderIndex, CmdDataType.cdtManualStart_Pump); //PumpInstallButton.Text = (vb) ? "停止泵站" : "启动泵站"; if (vb) { PumpInstallButton.Text = "停止泵站"; } else { PumpInstallButton.Text = (pumpList[selectedPumpIndex].Enabled && pumpList[selectedPumpIndex].CurrentPara < 30) ? "启动泵站" : "停止泵站"; } } }
public PageViewMAC() { InitializeComponent(); this.ForeColor = Color.Black; currentFont = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular); _candatapool = CDataPool.GetDataPoolObject(); //pump美化 pumpIcon = AdvaMACSystemRes.pump; pumpImages = new ImagesContaner(); pumpImages.DNImg = AdvaMACSystemRes.pumpborder_checked; pumpImages.UPImg = AdvaMACSystemRes.pumpborder; pumpImages.DNImgDisable = AdvaMACSystemRes.pumpborder_disable; pumpImages.UPImgDisaable = AdvaMACSystemRes.pumpborder_disable; //button美化 buttonImages = new ImagesContaner(); buttonImages.DNImg = AdvaMACSystemRes.MAC_down; buttonImages.UPImg = AdvaMACSystemRes.MAC_up; buttonImages.DNImgDisable = AdvaMACSystemRes.MAC_disable; buttonImages.UPImgDisaable = AdvaMACSystemRes.MAC_disable; //cylinder美化 progressBarImages = new CProgressBarImagesContainer(); progressBarImages.BgImage = AdvaMACSystemRes.graybar; progressBarImages.FrontImage = AdvaMACSystemRes.greenbar; progressBarImages.FrontImage_Unpass = AdvaMACSystemRes.redbar; progressBarImages.WarningImage = AdvaMACSystemRes.yellowbar; progressBarImages.SettingImage = AdvaMACSystemRes.bluebar; //new pumps pumpList = new List <CPumpButton>(); for (int j = 0; j < pumpNumber; j++) { CPumpButton pumpBlock = new CPumpButton(); pumpList.Add(pumpBlock); } //new cylinders cylinderList = new List <CylinderCellBlock>(); for (int i = 0; i < cylinderNumber; i++) { CylinderCellBlock cylinder = new CylinderCellBlock(); cylinderList.Add(cylinder); } //new buttons controlModeButton = new ImageButton(); //controlButtonList = new List<ImageButton>(); //autoModeButton = new ImageButton(); //controlButtonList.Add(autoModeButton); //manualModeButton = new ImageButton(); //controlButtonList.Add(manualModeButton); stateButtonList = new List <ImageButton>(); PumpSettingButton = new ImageButton(); //stateButtonList.Add(PumpSettingButton); PumpInstallButton = new ImageButton(); stateButtonList.Add(PumpInstallButton); cylinderExtendButton = new ImageButton(); stateButtonList.Add(cylinderExtendButton); //cylinderStopButton = new ImageButton(); //stateButtonList.Add(cylinderStopButton); cylinderRetractButton = new ImageButton(); stateButtonList.Add(cylinderRetractButton); this.SuspendLayout(); //pumps for (int j = 0; j < pumpNumber; j++) { CPumpButton pumpBlock = pumpList[j]; pumpBlock.Size = new Size(PumpWidth, PumpHeight); pumpBlock.Location = new Point(PumpMarginLeft, PumpMarginTop + j * (PumpHeight + PumpSpacingY)); pumpBlock.Toggle = true; pumpBlock.PumpIndex = j; pumpBlock.IMGContainer = pumpImages; pumpBlock.TransParent = true; pumpBlock.Icon = pumpIcon; pumpBlock.Click += new EventHandler(pumpBlock_Click); this.Controls.Add(pumpBlock); } //cylinders for (int i = 0; i < cylinderNumber; i++) { CylinderCellBlock cylinder = cylinderList[i]; cylinder.Size = new Size(CBWidth, CBHeight); cylinder.Location = new Point(CBMarginLeft + (i % 2) * (CBWidth + CBSpacingX), CBMarginTop + (i / 2) * (CBHeight + CBSpacingY)); cylinder.OnCylinderClicked += new OnCylinderClickHandler(cylinder_OnCylinderClicked); cylinder.IMGContainer = progressBarImages; //cylinder.Font = currentFont; this.Controls.Add(cylinder); } //buttons controlModeButton.Size = new Size(ButtonWidth, ButtonHeight); controlModeButton.Location = new Point(ButtonMarginLeft, ButtonMarginTop); controlModeButton.Font = currentFont; controlModeButton.IMGContainer = buttonImages; controlModeButton.Checked = false; controlModeButton.Toggle = false; //controlModeButton.CheckedChanged += new EventHandler(controlModeButton_CheckedChanged); //controlModeButton.MouseUp += new MouseEventHandler(controlModeButton_MouseUp); //controlModeButton.Click += new EventHandler(controlModeButton_Click); controlModeButton.Text = "自动模式"; this.Controls.Add(controlModeButton); //for (int k = 0; k < controlButtonList.Count; k++) //{ // ImageButton button = controlButtonList[k]; // button.Size = new Size(ButtonWidth, ButtonHeight); // button.Location = new Point(ButtonMarginLeft, ButtonMarginTop + k * (ButtonHeight + ButtonSpacingY)); // button.Font = currentFont; // button.IMGContainer = buttonImages; // button.Toggle = true; // button.Click += new EventHandler(controlModeButton_Click); // this.Controls.Add(button); //} //autoModeButton.Name = "auto"; //manualModeButton.Name = "manual"; //autoModeButton.Text = "自动模式"; //manualModeButton.Text = "手动模式"; for (int k = 0; k < stateButtonList.Count; k++) { ImageButton button = stateButtonList[k]; button.Size = new Size(ButtonWidth, ButtonHeight); button.Location = new Point(ButtonMarginLeft + (k + 1) * (ButtonWidth + ButtonSpacingX), ButtonMarginTop); button.Font = currentFont; button.IMGContainer = buttonImages; button.Toggle = false; this.Controls.Add(button); } cylinderExtendButton.Text = "油缸伸出"; //cylinderExtendButton.Click += new EventHandler(cylinderExtendButton_Click); cylinderExtendButton.MouseDown += new MouseEventHandler(cylinderExtendButton_MouseDown); cylinderExtendButton.MouseUp += new MouseEventHandler(cylinderExtendButton_MouseUp); //cylinderStopButton.Text = "油缸停止"; //cylinderStopButton.Click += new EventHandler(cylinderStopButton_Click); cylinderRetractButton.Text = "油缸缩回"; //cylinderRetractButton.Click += new EventHandler(cylinderRetractButton_Click); cylinderRetractButton.MouseDown += new MouseEventHandler(cylinderRetractButton_MouseDown); cylinderRetractButton.MouseUp += new MouseEventHandler(cylinderRetractButton_MouseUp); cylinderExtendButton.Enabled = false; //cylinderStopButton.Enabled = false; cylinderRetractButton.Enabled = false; PumpInstallButton.Text = "启动泵站"; PumpInstallButton.Click += new EventHandler(PumpInstallButton_Click); //PumpInstallButton.MouseDown += new MouseEventHandler(); //PumpInstallButton.MouseUp += new MouseEventHandler(); PumpInstallButton.Enabled = false; PumpSettingButton.Text = "轴力设定"; PumpSettingButton.Click += new EventHandler(PumpSettingButton_Click); //PumpSettingButton.MouseDown += new MouseEventHandler(); //PumpSettingButton.MouseUp += new MouseEventHandler(); PumpSettingButton.Enabled = false; this.ResumeLayout(false); }