コード例 #1
0
        public DigitalAdjustmentNode()
            : base()
        {
            index++;

            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxDigitalAdjustmentType;

            this.Text  = UIResMang.GetString("TextDigitalAdjustment");
            this.Title = UIResMang.GetString("TextDigitalAdjustment") + index;
            SetText(this.Title);

            this.Size      = new Size(180, 40);
            this.FlatStyle = EFlatStyle.Stereo;
            this.TitleFont = new STFont(Color.Yellow, 28);

            this.ReadAddressId   = new Dictionary <string, KNXSelectedAddress>();
            this.WriteAddressIds = new Dictionary <string, KNXSelectedAddress>();

            this.LeftImage      = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResImgDir, "reduce.png"));
            this.RightImage     = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResImgDir, "increase.png"));
            this.DecimalDigit   = EDecimalDigit.Zero;
            this.MaxValue       = 30;
            this.MinValue       = 16;
            this.RegulationStep = ERegulationStep.One;
            this.Unit           = EMeasurementUnit.None;
            this.ValueFont      = new STFont(Color.Yellow, 28);
        }
コード例 #2
0
        public ValueDisplayNode(KNXValueDisplay knx, BackgroundWorker worker)
            : base(knx, worker)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxValueDisplayType;
            SetText(this.Title);

            this.ReadAddressId = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>();

            if (ImportedHelper.IsLessThan2_1_8() && knx.Unit > (int)EMeasurementUnit.Centigrade)
            {
                this.Unit = (EMeasurementUnit)Enum.ToObject(typeof(EMeasurementUnit), knx.Unit - 1);
            }
            else
            {
                this.Unit = (EMeasurementUnit)Enum.ToObject(typeof(EMeasurementUnit), knx.Unit);
            }

            if (ImportedHelper.IsLessThan2_5_7())
            {
                this.ValueFont = this.TitleFont.Clone();
            }
            else
            {
                this.ValueFont = new STFont(knx.ValueFont);
            }

            this.DecimalDigit = (EDecimalDigit)Enum.ToObject(typeof(EDecimalDigit), knx.DecimalDigit);
        }
コード例 #3
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            base.PaintValue(e);

            try
            {
                STFont f         = e.Value as STFont;
                Color  fontColor = f.Color;
                Font   font      = new Font("宋体", 9, f.GetFontStyle());
                e.Graphics.DrawString("ab", font, new SolidBrush(fontColor), e.Bounds);
            }
            catch (Exception ex)
            {
                Console.WriteLine("PropertyGridImageEditor Error:" + ex.Message);
            }
        }
コード例 #4
0
        /// <summary>
        /// 从工程文件中导入控件
        /// </summary>
        /// <param name="knx"></param>
        public BlindsNode(KNXBlinds knx, BackgroundWorker worker)
            : base(knx, worker)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxBlindsType;
            SetText(this.Title);

            this.ReadAddressId   = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>();
            this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>();

            if (ImportedHelper.IsLessThan2_0_3())
            {
                if (!string.IsNullOrEmpty(knx.LeftImage))
                {
                    this.LeftImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.LeftImage));
                }
                if (!string.IsNullOrEmpty(knx.RightImage))
                {
                    this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.RightImage));
                }
            }
            else
            if (ImportedHelper.IsLessThan2_5_6())
            {
                this.LeftImage  = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_LEFTIMAGE));
                this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_RIGHTIMAGE));
            }
            else
            {
                this.LeftImage  = knx.LeftImage;
                this.RightImage = knx.RightImage;
            }

            if (ImportedHelper.IsLessThan2_5_2())
            {
                this.LeftTextFont  = new STFont(knx.LeftTextFontColor, knx.LeftTextFontSize);
                this.RightTextFont = new STFont(knx.RightTextFontColor, knx.RightTextFontSize);
            }
            else
            {
                this.LeftTextFont  = new STFont(knx.LeftTextFont);
                this.RightTextFont = new STFont(knx.RightTextFont);
            }
            this.LeftText  = knx.LeftText;
            this.RightText = knx.RightText;
        }
コード例 #5
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            STFont f = value as STFont;

            if ((typeof(string) == destinationType) && (null != f))
            {
                //string valString = "Color:" + ColorHelper.ColorToHexStr(f.Color);
                //valString += ";" + "Size:" + f.Size;
                //valString += ";" + "Bold:" + f.Bold;
                //valString += ";" + "Italic:" + f.Italic;
                //valString += ";" + "Strikeout:" + f.Strikeout;
                //valString += ";" + "Underline:" + f.Underline;
                //return valString;
                return(f.Size.ToString());
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
コード例 #6
0
        public ValueDisplayNode()
            : base()
        {
            _index++;

            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxValueDisplayType;

            this.Text  = UIResMang.GetString("TextValueDisplay");
            this.Title = UIResMang.GetString("TextValueDisplay") + _index;
            SetText(this.Title);

            this.Size = new Size(180, 40);

            this.ReadAddressId = new Dictionary <string, KNXSelectedAddress>();
            this.Unit          = EMeasurementUnit.Centigrade;
            this.DecimalDigit  = EDecimalDigit.Zero;

            this.ValueFont = new STFont(Color.Yellow, 28);
        }
コード例 #7
0
        public BlindsNode() : base()
        {
            index++;

            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxBlindsType;

            this.Text  = UIResMang.GetString("TextBlinds");
            this.Title = UIResMang.GetString("TextBlinds") + index;
            SetText(this.Title);

            this.Size      = new Size(180, 40);
            this.FlatStyle = EFlatStyle.Stereo;

            this.ReadAddressId   = new Dictionary <string, KNXSelectedAddress>();
            this.WriteAddressIds = new Dictionary <string, KNXSelectedAddress>();

            this.LeftImage    = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResImgDir, "arrow_down.png"));
            this.LeftText     = "";
            this.LeftTextFont = new STFont(Color.Black, 16);

            this.RightImage    = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResImgDir, "arrow_up.png"));
            this.RightText     = "";
            this.RightTextFont = new STFont(Color.Black, 16);
        }
コード例 #8
0
        public DigitalAdjustmentNode(KNXDigitalAdjustment knx, BackgroundWorker worker)
            : base(knx, worker)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxDigitalAdjustmentType;

            SetText(this.Title);

            this.ReadAddressId   = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>();
            this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>();

            if (ImportedHelper.IsLessThan2_0_3())
            {
                if (!string.IsNullOrEmpty(knx.LeftImage))
                {
                    this.LeftImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.LeftImage));
                }
                if (!string.IsNullOrEmpty(knx.RightImage))
                {
                    this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.RightImage));
                }
            }
            else if (ImportedHelper.IsLessThan2_5_6())
            {
                this.LeftImage  = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_LEFTIMAGE));
                this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_RIGHTIMAGE));
            }
            else
            {
                this.LeftImage  = knx.LeftImage;
                this.RightImage = knx.RightImage;
            }
            this.DecimalDigit = (EDecimalDigit)Enum.ToObject(typeof(EDecimalDigit), knx.DecimalDigit);
            this.MaxValue     = knx.MaxValue;
            this.MinValue     = knx.MinValue;

            if (ImportedHelper.IsLessThan2_1_8() && knx.Unit > (int)EMeasurementUnit.Centigrade)
            {
                this.Unit = (EMeasurementUnit)Enum.ToObject(typeof(EMeasurementUnit), knx.Unit - 1);
            }
            else
            {
                this.Unit = (EMeasurementUnit)Enum.ToObject(typeof(EMeasurementUnit), knx.Unit);
            }

            if (ImportedHelper.IsLessThan2_5_3())
            {
                this.RegulationStep = ERegulationStep.One;
            }
            else
            {
                if (ImportedHelper.IsLessThan2_5_4())
                {
                    knx.RegStep        += 2;
                    this.RegulationStep = (ERegulationStep)Enum.ToObject(typeof(ERegulationStep), knx.RegStep);
                }
                else
                {
                    this.RegulationStep = (ERegulationStep)EnumExtension.ConvertFrom(typeof(ERegulationStep), knx.RegulationStep);
                }
            }

            if (ImportedHelper.IsLessThan2_5_4())
            {
                this.ValueFont = this.TitleFont.Clone();
            }
            else
            {
                this.ValueFont = new STFont(knx.ValueFont);
            }
        }