Exemple #1
0
        public Form1()
        {
            InitializeComponent();

            port = new SerialPort();


            portControl = new PortUC(port, 10, 10, "portControl");
            this.tabPage1.Controls.Add(portControl);
            //this.Controls.Add(portControl);

            p = new ParameterUC(portControl, 10, 150, "p", 1.0);
            this.tabPage1.Controls.Add(p);
            //this.Controls.Add(p);
            i = new ParameterUC(portControl, 10, 185, "i", 0.1);
            this.tabPage1.Controls.Add(i);
            //this.Controls.Add(i);
            d = new ParameterUC(portControl, 10, 220, "d", 0.1);
            this.tabPage1.Controls.Add(d);
            //this.Controls.Add(d);
            ang = new ParameterUC(portControl, 10, 255, "ang", 0.1);
            this.tabPage1.Controls.Add(ang);
            //this.Controls.Add(ang);
            c = new ParameterUC(portControl, 10, 290, "c", 0.01);
            this.tabPage1.Controls.Add(c);
            //this.Controls.Add(c);

            artificalHorizon = new ArtificialHorizon(400, 10, "artificalHorizon");
            this.tabPage1.Controls.Add(artificalHorizon);
            artificalHorizon.SetLeftValue("LEFT");
            artificalHorizon.SetRightValue("RIGHT");
            //this.Controls.Add(artificalHorizon);



            // This bit of code (using double buffer) reduces flicker from Refresh commands

            /*
             * this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
             * this.SetStyle(ControlStyles.UserPaint, true);
             * this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
             * this.SetStyle(ControlStyles.ResizeRedraw, true);
             */
            //////////// END "reduce flicker" code ///////

            pThreadRead = new Thread(new ThreadStart(ReadThread));
            pThreadRead.Start();
        }
Exemple #2
0
        public ParameterUC(PortUC portControl, int xOffset, int yOffset, string name, double increment)
        {
            this.Location = new System.Drawing.Point(xOffset, yOffset);
            this.Name     = name;
            this.Size     = new System.Drawing.Size(344, 35);
            this.TabIndex = 0;

            InitializeComponent();


            this.label.Text = name;
            this.command    = name;

            this.portControl           = portControl;
            this.port                  = portControl.port;
            this.incrementValue        = increment;
            this.incrementTextBox.Text = increment.ToString();
        }