Пример #1
0
        // Установка силы тока на источнике постоянного ток
        private void trackBar8_Scroll(object sender, EventArgs e)
        {
            curI          = trackBar8.Value * ((Data.EaMax + Data.EaMin) / 100);
            textBox2.Text = curI.ToString();
            ASetValue(panel2, curI);

            Rx         = trackBar9.Value * 0.001 + trackBar0.Value * 0.01 + trackBar1.Value * 0.1 + trackBar2.Value * 1 + trackBar3.Value * 10 + trackBar4.Value * 100 + trackBar5.Value * 1000 + trackBar6.Value * 10000;
            RxBox.Text = Rx.ToString();

            if (radioButton1.Checked)
            {
                R         = Convert.ToDouble(RaBox.Text) + Convert.ToDouble(RxBox.Text); // R = Rx + Ra
                RBox.Text = R.ToString();
            }
            else if (radioButton2.Checked)
            {
                R         = (Convert.ToDouble(RxBox.Text) * Convert.ToDouble(RvBox.Text)) / (Convert.ToDouble(RxBox.Text) + Convert.ToDouble(RvBox.Text)); // R = (Rx * Rv) / (Rx + Rv)
                RBox.Text = R.ToString();
            }
            try
            {
                curV = curI * R;
                VSetValue(panel1, curV);
                trackBar7.Value = Convert.ToInt32(curV);
                textBox1.Text   = curV.ToString();
            }
            catch
            {
                return;
            }
        }
Пример #2
0
        public override IEnumerable <SvgAttribute> GetAttributes()
        {
            var baseAttributes = base.GetAttributes();

            if (baseAttributes != null)
            {
                foreach (var attr in baseAttributes)
                {
                    yield return(attr);
                }
            }

            var ci = CultureInfo.InvariantCulture;

            yield return(new SvgAttribute("cx", "0",
                                          () => Cx.ToString(ci),
                                          v => Cx = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("cy", "0",
                                          () => Cy.ToString(ci),
                                          v => Cy = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("rx", "0",
                                          () => Rx.ToString(ci),
                                          v => Rx = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("ry", "0",
                                          () => Ry.ToString(ci),
                                          v => Ry = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("stroke-width",
                                          () => StrokeWidth.ToString(ci),
                                          v => StrokeWidth = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("stroke",
                                          () => ColorTranslator.ToSvg(Stroke),
                                          v => Stroke = SvgAttribute.ParseColorAttribute(v, Stroke.A)
                                          ));

            yield return(new SvgAttribute("stroke-opacity", "1",
                                          () => ((double)Stroke.A / 255).ToString(ci),
                                          v => Stroke = SvgAttribute.ParseOpacityAttribute(v, Stroke)
                                          ));

            yield return(new SvgAttribute("fill",
                                          () => Fill.A == 0 ? "none" : ColorTranslator.ToSvg(Fill),
                                          v => Fill = SvgAttribute.ParseColorAttribute(v, Fill.A)
                                          ));

            yield return(new SvgAttribute("fill-opacity", "1",
                                          () => ((double)Fill.A / 255).ToString(ci),
                                          v => Fill = SvgAttribute.ParseOpacityAttribute(v, Fill)
                                          ));
        }
Пример #3
0
        private void trackBar6_Scroll(object sender, EventArgs e)
        {
            Rx         = trackBar9.Value * 0.001 + trackBar0.Value * 0.01 + trackBar1.Value * 0.1 + trackBar2.Value * 1 + trackBar3.Value * 10 + trackBar4.Value * 100 + trackBar5.Value * 1000 + trackBar6.Value * 10000;
            RxBox.Text = Rx.ToString();
            if (radioButton1.Checked)
            {
                R         = Convert.ToDouble(RaBox.Text) + Convert.ToDouble(RxBox.Text); // R = Rx + Ra
                RBox.Text = R.ToString();
            }
            else if (radioButton2.Checked)
            {
                R         = (Convert.ToDouble(RxBox.Text) * Convert.ToDouble(RvBox.Text)) / (Convert.ToDouble(RxBox.Text) + Convert.ToDouble(RvBox.Text)); // R = (Rx * Rv) / (Rx + Rv)
                RBox.Text = R.ToString();
            }

            curI            = curV / R;
            trackBar8.Value = Convert.ToInt32(curI);
            ASetValue(panel2, curI);
            textBox2.Text = curI.ToString();
        }