//public virtual void SaveToXML(XmlElement Node) { } public override void LoadFromXML(XmlElement Node) { base.LoadFromXML(Node); try { Points.Add(new PointF(iOrgX1, iOrgY1)); Points.Add(new PointF(iOrgX2, iOrgY2)); XmlElement TextNode = (XmlElement)(Node.SelectSingleNode("Appearance")); //绘制背景 Background = Convert.ToBoolean(TextNode.GetAttribute("Transparent")); TextW = Convert.ToSingle(TextNode.GetAttribute("Width")); TextH = Convert.ToSingle(TextNode.GetAttribute("Height")); String strFontName = TextNode.GetAttribute("FontName"); float fSize = Convert.ToSingle(TextNode.GetAttribute("FontSize")); FontStyle fStyle = (FontStyle)Enum.Parse(typeof(FontStyle), TextNode.GetAttribute("FontStyle")); DrawFont = new System.Drawing.Font(strFontName, fSize, fStyle); String strTemp = TextNode.GetAttribute("FontColor"); FontBrush.Color = ColorTranslator.FromWin32(Int32.Parse(strTemp)); int ExpType = int.Parse(TextNode.GetAttribute("ViewStyle")); FExpression.ExpressType = (LCExpressType)ExpType; FExpression.Exipression = TextNode.GetAttribute("ShowVar"); FExpression.IsShowUnit = Convert.ToBoolean(TextNode.GetAttribute("IsShowUnit")); FExpression.GetDeviceVar(); if (TextNode.HasAttribute("TextOut_horizontal")) { HorizonAlign = (StringAlignment)Enum.Parse(typeof(StringAlignment), TextNode.GetAttribute("TextOut_horizontal")); } if (TextNode.HasAttribute("TextOut_Vertical")) { VerticalAlign = (StringAlignment)Enum.Parse(typeof(StringAlignment), TextNode.GetAttribute("TextOut_Vertical")); } Text = TextNode.GetAttribute("Text"); FExpression.sText = Text; FExpression.GetDeviceVar(); IsBorder = Convert.ToBoolean(TextNode.GetAttribute("IsBorder")); DrawPen.Color = ColorTranslator.FromWin32(Int32.Parse(TextNode.GetAttribute("BorderColor"))); DrawPen.Width = Int32.Parse(TextNode.GetAttribute("BorderWidth")); DrawPen.DashStyle = DashStyle.Solid; FillOptions.BrushType = LCBrushType.Solid; m_SolidBrush.Color = ColorTranslator.FromWin32(Int32.Parse(TextNode.GetAttribute("FillColor"))); strIfName = TextNode.GetAttribute("strIfName"); bCloseWin = Convert.ToBoolean(TextNode.GetAttribute("bCloseWin")); strSta = TextNode.GetAttribute("strSta"); TextNode = (XmlElement)(Node.SelectSingleNode("Behavior")); IsExecProgram = Convert.ToBoolean(TextNode.GetAttribute("IsExecProgram")); Program = TextNode.GetAttribute("Program"); } catch (Exception e) { } }
public void GetDeviceVar(string StaName) { FExpression = new CExpression(); FExpression.ExpressType = LCExpressType.Expression; FExpression.Exipression = szExpress; FExpression.GetDeviceVar(StaName); }
public CExpression FExpression = new CExpression(); //条件表达式 /// <summary> /// 获取参数 /// </summary> public SwitchPic(string _PicName, string _Condition) { PicName = _PicName; Condition = _Condition; FExpression.ExpressType = LCExpressType.Expression; FExpression.Exipression = _Condition; FExpression.GetDeviceVar(); }