private void DrawRing(Graphics g)//画阀门和进样室上下位 { RectangleF rect1 = new RectangleF(CMach.PFCenter.X - 147, CMach.PFCenter.Y - 70, 14, 140); RectangleF rect2 = new RectangleF(CMach.PFCenter.X + 117, CMach.PFCenter.Y - 70, 14, 140); if (DI074.GetBoolValue()) { g.FillRectangle(Brushes.Lime, rect1); } else if (DI075.GetBoolValue()) { g.FillRectangle(Brushes.Red, rect1); } else { g.FillRectangle(Brushes.Gray, rect1); } if (DI110.GetBoolValue()) { g.FillRectangle(Brushes.Lime, rect2); } else if (DI111.GetBoolValue()) { g.FillRectangle(Brushes.Red, rect2); } else { g.FillRectangle(Brushes.Gray, rect2); } Single iL = 300; Single iH = 40; Single iW = 30; RectangleF rect3 = new RectangleF(CMach.PFCenter.X - iH, CMach.PFCenter.Y - iL - iW, iH / 2, iW * 2); RectangleF rect4 = new RectangleF(CMach.PFCenter.X + iH / 2, CMach.PFCenter.Y - iL - iW, iH / 2, iW * 2); bool B2 = false; bool B3 = false; SolidBrush FontBrush = new SolidBrush(System.Drawing.Color.DeepSkyBlue); FontBrush.Color = Color.White; StringFormat format1 = new StringFormat(StringFormatFlags.LineLimit); format1.Alignment = StringAlignment.Center; format1.LineAlignment = StringAlignment.Center; for (int i = 0; i < CMach.TuoPanNum; i++) { if (CMach.TuoPan[i] == 2)//进样室高位 { B2 = true; } else if (CMach.TuoPan[i] == 3)//进样室高位 { B3 = true; } } if (B2)//进样室高位 { g.FillRectangle(Brushes.Red, rect3); g.DrawString("上", new Font("宋体", 16, GraphicsUnit.World), FontBrush, rect3, format1); } else { g.FillRectangle(Brushes.Gray, rect3); g.DrawString("上", new Font("宋体", 16, GraphicsUnit.World), FontBrush, rect3, format1); } if (B3)//进样室高位 { g.FillRectangle(Brushes.Red, rect4); g.DrawString("下", new Font("宋体", 16, GraphicsUnit.World), FontBrush, rect4, format1); } else { g.FillRectangle(Brushes.Gray, rect4); g.DrawString("下", new Font("宋体", 16, GraphicsUnit.World), FontBrush, rect4, format1); } }