Пример #1
0
        public FormSetColor()
        {
            InitializeComponent();



            this.btnGnd.BackColor = Color.FromArgb(int.Parse(Ini.GetItemValue("colorInfo", "colorGND")));
            this.btnVcc.BackColor = Color.FromArgb(int.Parse(Ini.GetItemValue("colorInfo", "colorVCC")));
            this.btnNone.BackColor = Color.FromArgb(int.Parse(Ini.GetItemValue("colorInfo", "colorNONE")));
            this.btnFoots.BackColor = Color.FromArgb(int.Parse(Ini.GetItemValue("colorInfo", "colorFoot")));
            this.btnLine.BackColor = Color.FromArgb(int.Parse(Ini.GetItemValue("colorInfo", "colorLine")));
        }
Пример #2
0
        public UcFoot(int idx, int x, int y)
        {
            this.index = idx;
            this.locX  = x;
            this.locY  = y;

            InitializeComponent();

            this.Width  = Constants.FOOT_SIZE_PIXEL;
            this.Height = Constants.FOOT_SIZE_PIXEL;
            int hsize = Constants.FOOT_SIZE_PIXEL / 2;

            this.Location  = new Point(this.locX + hsize, this.locY + hsize);
            this.BackColor = Color.FromArgb(int.Parse(Ini.GetItemValue("colorInfo", "colorFoot")));
        }
Пример #3
0
        public FormSetSize(Action updateChangeSize)
        {
            this.updateChangeSize = updateChangeSize;

            InitializeComponent();

            this.tbWidthBoard.Text   = Ini.GetItemValue("sizeInfo", "pixelBoardWidth");
            this.tbHeightBoard.Text  = Ini.GetItemValue("sizeInfo", "pixelBoardHeight");
            this.tbWidthWindow.Text  = Ini.GetItemValue("sizeInfo", "pixelInitialWidth");
            this.tbHeightWindow.Text = Ini.GetItemValue("sizeInfo", "pixelInitialHeight");
            this.tbFootSize.Text     = Ini.GetItemValue("sizeInfo", "pixelFootSize");
            this.tbLineWidth.Text    = Ini.GetItemValue("sizeInfo", "pixelLineWidth");
            this.tbNetPoint.Text     = Ini.GetItemValue("sizeInfo", "pixelNetPoint");
            this.tbMargin.Text       = Ini.GetItemValue("sizeInfo", "pixelBoardMargin");
            this.tbDragDistance.Text = Ini.GetItemValue("sizeInfo", "pixelDragDistance");
        }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int boardWidth  = int.Parse(this.tbWidthBoard.Text);
            int boardHeight = int.Parse(this.tbHeightBoard.Text);
            int windowWidth = int.Parse(this.tbWidthWindow.Text);
            int widowHeight = int.Parse(this.tbHeightWindow.Text);

            if (!(boardWidth > 0 && boardHeight > 0 && windowWidth > 0 && widowHeight > 0 &&
                  int.Parse(this.tbFootSize.Text) > 0 && int.Parse(this.tbLineWidth.Text) > 0 &&
                  int.Parse(this.tbNetPoint.Text) > 0 && int.Parse(this.tbMargin.Text) > 0 &&
                  int.Parse(this.tbDragDistance.Text) > 0))
            {
                MessageBox.Show("仅可输入正整数");
            }
            else if (boardWidth < 500 || boardWidth > 5000 || boardHeight < 500 || boardHeight > 5000)
            {
                MessageBox.Show("画板尺寸有效范围【500,5000】");
                this.tbWidthBoard.Text  = Ini.GetItemValue("sizeInfo", "pixelBoardWidth");
                this.tbHeightBoard.Text = Ini.GetItemValue("sizeInfo", "pixelBoardHeight");
            }
            else if (windowWidth < 500 || windowWidth > 5000 || widowHeight < 500 || widowHeight > 5000)
            {
                MessageBox.Show("窗口尺寸有效范围【500,5000】");
                this.tbWidthWindow.Text  = Ini.GetItemValue("sizeInfo", "pixelInitialWidth");
                this.tbHeightWindow.Text = Ini.GetItemValue("sizeInfo", "pixelInitialHeight");
            }
            else
            {
                Ini.SetItemValue("sizeInfo", "pixelBoardWidth", this.tbWidthBoard.Text);
                Ini.SetItemValue("sizeInfo", "pixelBoardHeight", this.tbHeightBoard.Text);
                Ini.SetItemValue("sizeInfo", "pixelInitialWidth", this.tbWidthWindow.Text);
                Ini.SetItemValue("sizeInfo", "pixelInitialHeight", this.tbHeightWindow.Text);
                Ini.SetItemValue("sizeInfo", "pixelFootSize", this.tbFootSize.Text);
                Ini.SetItemValue("sizeInfo", "pixelLineWidth", this.tbLineWidth.Text);
                Ini.SetItemValue("sizeInfo", "pixelNetPoint", this.tbNetPoint.Text);
                Ini.SetItemValue("sizeInfo", "pixelBoardMargin", this.tbMargin.Text);
                Ini.SetItemValue("sizeInfo", "pixelDragDistance", this.tbDragDistance.Text);

                this.updateChangeSize();
            }
        }
Пример #5
0
 public DBUtility(bool dbEncrypt)
 {
     SQLiteHelper.SetPassWordFlag = dbEncrypt;
     SQLiteHelper.SetSignature    = Ini.GetItemValue("sizeInfo", "appSignature");
 }
Пример #6
0
        private void CreateModelData()
        {
            this.InsertSerialInfo(new SerialInfo()
            {
                PortName = "COM1",
                BaudRate = 9600,
                DataBits = 8,
                Parity   = 0,
                StopBits = 1,
                TimeOut  = 200
            });
            Color       colorFoot = Color.FromArgb(Convert.ToInt32(Ini.GetItemValue("colorInfo", "colorFoot")));
            ElementInfo info      = new ElementInfo();

            //箭头
            info.Name      = enumComponent.NONE.ToString();
            info.FootType  = enumComponentType.NormalComponent;
            info.Size      = new Size(0, 0);
            info.BackColor = Color.Gray;
            info.LineFoots = new List <LineFoot>();
            info.BackImage = "img\\arrow.png";
            AddNewBaseComponent(info);
            //74HC244
            info.Name   = "74HC244";
            info.Number = "aaaaaaaa";
            //info.FootType = enumComponentType.Chips;
            info.FootType  = enumComponentType.NormalComponent;
            info.Size      = new Size(374, 280);
            info.BackColor = Color.Gray;
            info.LineFoots = new List <LineFoot>()
            {
                new LineFoot()
                {
                    LocX = 35, LocY = 0, InnerIdx = 1
                },
                new LineFoot()
                {
                    LocX = 70, LocY = 0, InnerIdx = 2
                },
                new LineFoot()
                {
                    LocX = 105, LocY = 0, InnerIdx = 3
                },
                new LineFoot()
                {
                    LocX = 140, LocY = 0, InnerIdx = 4
                },
                new LineFoot()
                {
                    LocX = 175, LocY = 0, InnerIdx = 5
                },
                new LineFoot()
                {
                    LocX = 210, LocY = 0, InnerIdx = 6
                },
                new LineFoot()
                {
                    LocX = 245, LocY = 0, InnerIdx = 7
                },
                new LineFoot()
                {
                    LocX = 280, LocY = 0, InnerIdx = 8
                },
                new LineFoot()
                {
                    LocX = 315, LocY = 0, InnerIdx = 9
                },
                new LineFoot()
                {
                    LocX = 350, LocY = 0, InnerIdx = 10
                },

                new LineFoot()
                {
                    LocX = 35, LocY = 280, InnerIdx = 11
                },
                new LineFoot()
                {
                    LocX = 70, LocY = 280, InnerIdx = 12
                },
                new LineFoot()
                {
                    LocX = 105, LocY = 280, InnerIdx = 13
                },
                new LineFoot()
                {
                    LocX = 140, LocY = 280, InnerIdx = 14
                },
                new LineFoot()
                {
                    LocX = 175, LocY = 280, InnerIdx = 15
                },
                new LineFoot()
                {
                    LocX = 210, LocY = 280, InnerIdx = 16
                },
                new LineFoot()
                {
                    LocX = 245, LocY = 280, InnerIdx = 17
                },
                new LineFoot()
                {
                    LocX = 280, LocY = 280, InnerIdx = 18
                },
                new LineFoot()
                {
                    LocX = 315, LocY = 280, InnerIdx = 19
                },
                new LineFoot()
                {
                    LocX = 350, LocY = 280, InnerIdx = 20
                }
            };
            info.BackImage = "img\\74HC244.jpg";
            AddNewBaseComponent(info);
            //74Serial
            info.Name   = "74Serial";
            info.Number = string.Empty;
            //info.FootType = enumComponentType.Chips;
            info.FootType  = enumComponentType.NormalComponent;
            info.Size      = new Size(246, 176);
            info.BackColor = Color.Gray;
            info.LineFoots = new List <LineFoot>()
            {
                new LineFoot()
                {
                    Name = "1", LocX = 17, LocY = 0, InnerIdx = 1
                },
                new LineFoot()
                {
                    Name = "2", LocX = 52, LocY = 0, InnerIdx = 2
                },
                new LineFoot()
                {
                    Name = "3", LocX = 87, LocY = 0, InnerIdx = 3
                },
                new LineFoot()
                {
                    Name = "4", LocX = 122, LocY = 0, InnerIdx = 4
                },
                new LineFoot()
                {
                    Name = "5", LocX = 157, LocY = 0, InnerIdx = 5
                },
                new LineFoot()
                {
                    Name = "6", LocX = 192, LocY = 0, InnerIdx = 6
                },
                new LineFoot()
                {
                    Name = "7", LocX = 227, LocY = 0, InnerIdx = 7
                },

                new LineFoot()
                {
                    Name = "1", LocX = 17, LocY = 176, InnerIdx = 8
                },
                new LineFoot()
                {
                    Name = "2", LocX = 52, LocY = 176, InnerIdx = 9
                },
                new LineFoot()
                {
                    Name = "3", LocX = 87, LocY = 176, InnerIdx = 10
                },
                new LineFoot()
                {
                    Name = "4", LocX = 122, LocY = 176, InnerIdx = 11
                },
                new LineFoot()
                {
                    Name = "5", LocX = 157, LocY = 176, InnerIdx = 12
                },
                new LineFoot()
                {
                    Name = "6", LocX = 192, LocY = 176, InnerIdx = 13
                },
                new LineFoot()
                {
                    Name = "7", LocX = 227, LocY = 176, InnerIdx = 14
                }
            };
            info.BackImage = "img\\74Serial.png";
            AddNewBaseComponent(info);
            //运放
            info.Name      = enumComponent.Amplifier.ToString();
            info.FootType  = enumComponentType.NormalComponent;
            info.Size      = new Size(140, 140);
            info.BackColor = Color.Gray;
            info.LineFoots = new List <LineFoot>(8)
            {
                new LineFoot()
                {
                    Color = colorFoot, Name = "1", LocX = 15, LocY = 0, InnerIdx = 1
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "2", LocX = 50, LocY = 0, InnerIdx = 2
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "3", LocX = 85, LocY = 0, InnerIdx = 3
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "4", LocX = 120, LocY = 0, InnerIdx = 4
                },

                new LineFoot()
                {
                    Color = colorFoot, Name = "5", LocX = 15, LocY = 140, InnerIdx = 5
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "6", LocX = 50, LocY = 140, InnerIdx = 6
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "7", LocX = 85, LocY = 140, InnerIdx = 7
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "8", LocX = 120, LocY = 140, InnerIdx = 8
                }
            };
            info.BackImage = "img\\amplifier.png";
            AddNewBaseComponent(info);
            //电阻
            info.Name      = enumComponent.Resistance.ToString();
            info.Number    = "resistan";
            info.FootType  = enumComponentType.NormalComponent;
            info.Size      = new Size(35, 10);
            info.BackColor = Color.Gray;
            info.LineFoots = new List <LineFoot>(2)
            {
                new LineFoot()
                {
                    Color = colorFoot, Name = "左", LocX = 0, LocY = 5, InnerIdx = 1
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "右", LocX = 35, LocY = 5, InnerIdx = 2
                }
            };
            info.BackImage = "img\\resistance.png";
            AddNewBaseComponent(info);
            //二极管
            info.Name      = enumComponent.Diode.ToString();
            info.Number    = string.Empty;
            info.FootType  = enumComponentType.NormalComponent;
            info.Size      = new Size(35, 10);
            info.BackColor = Color.Gray;
            info.LineFoots = new List <LineFoot>(2)
            {
                new LineFoot()
                {
                    Color = colorFoot, Name = "左", LocX = 0, LocY = 5, InnerIdx = 1
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "右", LocX = 35, LocY = 5, InnerIdx = 2
                }
            };
            info.BackImage = "img\\diode.png";
            AddNewBaseComponent(info);
            //三极管
            info.Name      = enumComponent.Triode.ToString();
            info.FootType  = enumComponentType.NormalComponent;
            info.Size      = new Size(70, 140);
            info.BackColor = Color.Gray;
            info.LineFoots = new List <LineFoot>(2)
            {
                new LineFoot()
                {
                    Color = colorFoot, Name = "左", LocX = 0, LocY = 70, InnerIdx = 1
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "右", LocX = 70, LocY = 70, InnerIdx = 2
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "下", LocX = 35, LocY = 140, InnerIdx = 3
                }
            };
            info.BackImage = "img\\triode.png";
            AddNewBaseComponent(info);
            //电容
            info.Name      = enumComponent.Capacitor.ToString();
            info.FootType  = enumComponentType.NormalComponent;
            info.Size      = new Size(58, 90);
            info.BackColor = Color.Gray;
            info.LineFoots = new List <LineFoot>(2)
            {
                new LineFoot()
                {
                    Color = colorFoot, Name = "左", LocX = 11, LocY = 90, InnerIdx = 1
                },
                new LineFoot()
                {
                    Color = colorFoot, Name = "右", LocX = 46, LocY = 90, InnerIdx = 2
                }
            };
            info.BackImage = "img\\capacitor.png";
            AddNewBaseComponent(info);
        }