Ejemplo n.º 1
0
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            var G = e.Graphics;

            G.Clear(Color.Black);

            G.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            G.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            G.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            G.TextRenderingHint  = System.Drawing.Text.TextRenderingHint.AntiAlias;
            BOM B = Main.GetBom();

            Font F  = new Font("Panton", 10);
            Font SF = new Font("Panton", 6);

            if (B == null)
            {
                G.DrawString("Not loaded..", F, Brushes.White, 2, 2);
                return;
            }

            int i  = 0;
            int pc = B.GetUniquePartCount(new List <string>()
            {
            });

            CurrentPart = (CurrentPart + pc) % pc;
            var PL = GetPartList();

            foreach (var v in PL)
            {
                string count = v.useagecount.ToString();
                Brush  Br    = Brushes.Red;
                if (v.Soldered)
                {
                    Br = Brushes.Green;
                }
                int y = 2 + i * 14;
                if (i == CurrentPart)
                {
                    G.FillRectangle(new SolidBrush(Color.FromArgb(100, 255, 255, 0)), 0, y, pictureBox1.Width, 14);
                }
                G.DrawString(count, F, Br, 2, y);
                G.DrawString(v.DispName, F, Br, 22, y);
                i++;
            }
        }
Ejemplo n.º 2
0
        private void ToggleCurrentPart()
        {
            BOM B = Main.GetBom();

            if (B == null)
            {
                return;
            }
            int i = 0;

            int pc = B.GetUniquePartCount(new List <string>()
            {
            });

            CurrentPart = (CurrentPart + pc) % pc;

            foreach (var v in GetPartList())
            {
                if (i == CurrentPart)
                {
                    v.Soldered = !v.Soldered;

                    foreach (var a in B.DeviceTree)
                    {
                        foreach (var vv in a.Value)
                        {
                            if (vv.Value.Combined() == v.DispName)
                            {
                                vv.Value.Soldered = v.Soldered;
                            }
                        }
                    }
                    if (v.Soldered)
                    {
                        Main.SolderPart(v.DispName);
                    }
                    else
                    {
                        Main.UnSolderPart(v.DispName);
                    }
                    return;
                }
                i++;
            }
        }