Example #1
0
        public void DrawIconOnBitmap(Ic ic, ref WriteableBitmap _wrB, int offsetX = 0, int offsetY = 0)
        {
            if (offsetX > 127)
            {
                offsetX -= 256;
            }
            if (offsetY > 127)
            {
                offsetY -= 256;
            }

            int x = offsetX;
            int y = offsetY;
            var s = Icons[ic].Item1.Shapes;

            if (IsSelected)
            {
                s = Icons[ic].Item2.Shapes;
            }

            foreach (var shape in s)
            {
                Color c1 = (shape.Color == Cl.IC_BC) ? BackColor : FrontColor;
                Color c2 = (shape.Color == Cl.IC_BC) ? FrontColor : BackColor;

                if (shape.IsHighlighted)
                {
                    c1 = Colors.Blue;
                }

                shape.DrawShapeOnBitmap(x, y, c1, c2, ref _wrB);
            }
        }
Example #2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if ((value ?? "").ToString() == "")
            {
                return(null);
            }
            if (Icon.Icons == null)
            {
                return(null);
            }
            Ic ic2 = (Ic)value;

            try
            {
                if (!Icon.Icons.ContainsKey(ic2))
                {
                    return(null);
                }
                return(Icon.Icons[ic2].Item2.FrozenBitmap);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Example #3
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            double Ib, Ic, Rc, Rb, Vcc, Vce, Vbe, Imax, beta;

            try
            {
                Rc = Convert.ToDouble(txtbeyzrc.Text) * 1000;
                Rb = Convert.ToDouble(txtbeyzrb.Text) * 1000;

                Vcc  = Convert.ToDouble(txtbeyzvcc.Text);
                Imax = (1000 * Vcc) / Rc;
                beta = Convert.ToDouble(txtbeyzbeta.Text);

                Vbe = Convert.ToDouble(txtbeyzvbe.Text);
                if (Rc > 0 & Rb > 0)
                {
                    Ib = ((Vcc - Vbe) / Rb) * Math.Pow(10, 6);
                    Ic = beta * Ib * Math.Pow(10, -3);

                    Vce              = Vcc - Ic * Rc * Math.Pow(10, -3);
                    lblbeyzib.Text   = " = " + Ib.ToString();
                    lblbeyzıc.Text   = " = " + Ic.ToString();
                    lblbeyzımax.Text = " = " + Imax.ToString();
                    lblbeyzvce.Text  = " = " + Vce.ToString();
                }
                else
                {
                    MessageBox.Show("Direnc Degerlerini yanlış girdiniz:");
                }
            }
            catch (Exception)
            {
                Form1.HataMesaji();
            }
        }
Example #4
0
 /// <summary>
 /// 断开链接
 /// 游戏对象销毁时,应调用
 /// </summary>
 public static void Disconnect()
 {
     if (Ic != null)
     {
         Ic.Shutdown();
         Ic = null;
     }
 }
Example #5
0
        public YiqImage Clone()
        {
            YiqImage result = new YiqImage(this.Width, this.Height);

            result.Y  = (double[, ])Y.Clone();
            result.Ic = (double[, ])Ic.Clone();
            result.Qc = (double[, ])Qc.Clone();

            return(result);
        }
Example #6
0
        /// <summary>
        /// 仅连接一次
        /// 若需要再次连接,需要Disconnect
        /// </summary>
        /// <param name="user"></param>
        /// <param name="pwd"></param>
        public static Infocenter Connect(string ip, int port, string user, string pwd)
        {
            Ip   = ip;
            Port = port;
            User = user;
            Pwd  = pwd;

            //连接服务器
            Ic = Infocenter.Create(Ip, Port, user, pwd);
            Ic.Start();

            return(Ic);
        }
Example #7
0
        private void button3_Click(object sender, EventArgs e)
        {
            double Ib, Ic, Rc, Rb, Vcc, Vce, Vbe, Imax, beta;

            Rc = Convert.ToDouble(txtbeyzrc.Text) * 1000;
            Rb = Convert.ToDouble(txtbeyzrb.Text) * 1000;

            Vcc  = Convert.ToDouble(txtbeyzvcc.Text);
            Imax = (1000 * Vcc) / Rc;
            beta = Convert.ToDouble(txtbeyzbeta.Text);

            Vbe = Convert.ToDouble(txtbeyzvbe.Text);
            Ib  = ((Vcc - Vbe) / Rb) * Math.Pow(10, 6);
            Ic  = beta * Ib * Math.Pow(10, -3);

            Vce              = Vcc - Ic * Rc * Math.Pow(10, -3);
            lblbeyzib.Text   = " = " + Ib.ToString();
            lblbeyzıc.Text   = " = " + Ic.ToString();
            lblbeyzımax.Text = " = " + Imax.ToString();
            lblbeyzvce.Text  = " = " + Vce.ToString();
            ZedGraph.ZedGraphControl g = new ZedGraph.ZedGraphControl();
            g.Size = new Size(panel2.Width - 2, panel2.Height - 2);
            ZedGraph.GraphPane myGraphPane = g.GraphPane;
            myGraphPane.Title.Text       = "Dc yük eğrisi ";
            myGraphPane.XAxis.Title.Text = "Volt (V)";
            myGraphPane.YAxis.Title.Text = "Akım(ma)";
            PointPairList list1 = new PointPairList();

            myGraphPane.AddCurve("", new double[] { 0, Vcc }, new double[] { Imax, 0 }, Color.Blue, ZedGraph.SymbolType.None);
            myGraphPane.AddCurve("", new double[] { 0, Vce }, new double[] { Ic, Ic }, Color.Blue, ZedGraph.SymbolType.None);
            myGraphPane.AddCurve("", new double[] { Vce, Vce }, new double[] { Ic, 0 }, Color.Blue, ZedGraph.SymbolType.None);

            myGraphPane.Chart.Fill = new ZedGraph.Fill(Color.White, Color.Red, 3.0f);

            g.AxisChange();

            panel2.Controls.Add(g);
        }
Example #8
0
 public void DrawIconOnBitmap(Ic ic, WriteableBitmap _wrB, int offsetX = 0, int offsetY = 0)
 {
     DrawIconOnBitmap(ic, ref _wrB, offsetX, offsetY);
 }