private void timerDateTime_Tick(object sender, EventArgs e) { if (lblRunOptimizePromptText.Text != RunOptimizePrompt.GetPromptText()) { lblRunOptimizePromptText.Text = RunOptimizePrompt.GetPromptText(); } if (RunOptimizePrompt.GetPromptTextForeColor() == Color.Red) { if (m_iTimerDateTimeCount % 2 == 0) { lblRunOptimizePromptText.ForeColor = Color.DimGray; } else { lblRunOptimizePromptText.ForeColor = Color.Red; } } else { lblRunOptimizePromptText.ForeColor = Color.Lime; } m_iTimerDateTimeCount += 1; }
/// <summary> /// 设定绑定标签的Text(测点值+测点单位)。 /// </summary> void SetBindingLabelsText() { try { Control control, parent; parent = panel6; LabelTag labelTag = null; foreach (DataRow row in YXYHTagLabelBinding.getAllData().Rows) { try { //由父控件找到本Label control = parent.Controls.Find(row["LabelName"].ToString(), false)[0]; control.Text = CalTagValue.GetTagValueAndUnitByID(row["TagID"].ToString()); control.Refresh(); try { labelTag = (LabelTag)control.Tag; if (labelTag.IsSetToolTipText == false) { toolTip1.SetToolTip(control, row["TagDesc"].ToString()); labelTag.IsSetToolTipText = true; labelTag.TagID = int.Parse(row["TagID"].ToString()); labelTag.TagDesc = row["TagDesc"].ToString(); control.Tag = labelTag; } if (labelTag.TagID == 0) { labelTag.TagID = int.Parse(row["TagID"].ToString()); labelTag.TagDesc = row["TagDesc"].ToString(); control.Tag = labelTag; WriteLog.WriteLogs("id=0"); } } catch { control.Tag = new LabelTag(true, int.Parse(row["TagID"].ToString()), row["TagDesc"].ToString()); toolTip1.SetToolTip(control, row["TagDesc"].ToString()); } } catch (Exception ex) { //WriteLog.WriteLogs(ex.ToString()); } } lblRunOptimizePromptText.Text = RunOptimizePrompt.GetPromptText(); lblRunOptimizePromptText.ForeColor = RunOptimizePrompt.GetPromptTextForeColor(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } }
/// <summary> /// 设定绑定标签的Text(测点值+测点单位)。 /// </summary> void SetBindingLabelsText() { try { int i; LabelTag labelTag; Control control, parent = panel1; foreach (DataRowView row in viewTagLabelBinding) { try { //由父控件找到本Label control = parent.Controls.Find(row["LabelName"].ToString(), false)[0]; labelTag = (LabelTag)control.Tag; try { if (labelTag.IsSetToolTipText == false) { toolTip1.SetToolTip(control, row["TagDesc"].ToString()); labelTag.IsSetToolTipText = true; labelTag.TagID = int.Parse(row["TagID"].ToString()); labelTag.TagDesc = row["TagDesc"].ToString(); labelTag.TagUnit = row["unit"].ToString(); } } catch { control.Tag = new LabelTag(true, int.Parse(row["TagID"].ToString()), row["TagDesc"].ToString(), row["unit"].ToString()); toolTip1.SetToolTip(control, row["TagDesc"].ToString()); } //这里是否需要根据机组区分 ZZH control.Text = TagValue.GetShowValueSix(labelTag.TagID, labelTag.TagUnit, row["adjustValue"].ToString()); control.Refresh(); } catch { } } lblRunOptimizePromptText.Text = RunOptimizePrompt.GetPromptText(); lblRunOptimizePromptText.ForeColor = RunOptimizePrompt.GetPromptTextForeColor(); lblTemp.Text = "环境温度:" + TagValue.GetShowValueSix(4208, "℃", ""); //+GlobalVariables.dtOneRowData.Rows[0]["F3208"].ToString(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } }