/// <summary> /// ViewNode 转 KNXView /// </summary> /// <param name="knx"></param> protected void ToKnx(KNXView knx) { knx.Id = this.Id; knx.Text = this.Text; knx.Left = this.X; knx.Top = this.Y; knx.Width = this.Width; knx.Height = this.Height; //knx.Left = this.Location.X; //knx.Top = this.Location.Y; //knx.Width = this.Size.Width; //knx.Height = this.Size.Height; knx.DisplayBorder = (int)this.DisplayBorder; knx.BorderColor = FrmMainHelp.ColorToHexStr(this.BorderColor); knx.Alpha = this.Alpha; knx.Radius = this.Radius; knx.FlatStyle = (int)this.FlatStyle; knx.BackgroundColor = FrmMainHelp.ColorToHexStr(this.BackgroundColor); knx.BackgroundImage = this.BackgroundImage; knx.FontColor = FrmMainHelp.ColorToHexStr(this.FontColor); knx.FontSize = this.FontSize; }
/// <summary> /// KNXView 转 ViewNode /// </summary> /// <param name="knx"></param> public ViewNode(KNXView knx) { this.Id = knx.Id; this.Text = knx.Text; this.X = knx.Left; this.Y = knx.Top; this.Width = knx.Width; this.Height = knx.Height; //this.Location = new Point(knx.Left, knx.Top); //this.Size = new Size(knx.Width, knx.Height); this.DisplayBorder = (EBool)Enum.ToObject(typeof(EBool), knx.DisplayBorder); this.BorderColor = FrmMainHelp.HexStrToColor(knx.BorderColor); this.Alpha = knx.Alpha; this.Radius = knx.Radius; this.FlatStyle = (EFlatStyle)Enum.ToObject(typeof(EFlatStyle), knx.FlatStyle); this.BackgroundColor = FrmMainHelp.HexStrToColor(knx.BackgroundColor ?? "#FFFFFF"); this.BackgroundImage = knx.BackgroundImage; this.FontColor = FrmMainHelp.HexStrToColor(knx.FontColor ?? "#000000"); this.FontSize = knx.FontSize; this.State = ControlState.Normal; }