Ejemplo n.º 1
0
        //==========
        //  METHOD
        //==========
        private void ShowHorizontalSliders()
        {
            int xPos = 0;
            int yPos = 0;

            horizontalSliderArray = new HorizontalSlider.SliderControl[StaticUtilities.numberOfServos];
            for (int i = 0; i < StaticUtilities.numberOfServos; i++)
            {
                // Initialize one variable
                horizontalSliderArray[i] = new HorizontalSlider.SliderControl();
            }

            int n = 0;
            while (n < StaticUtilities.numberOfServos)
            {
                horizontalSliderArray[n].Tag = n + 1;
                horizontalSliderArray[n].TabIndex = n;
                horizontalSliderArray[n].sliderLabel = "CH" + horizontalSliderArray[n].Tag.ToString();
                if (yPos > 352) // Twelve Sliders in one column
                {
                    yPos = 0;
                    xPos = xPos + horizontalSliderArray[n].Width - 1;
                }
                horizontalSliderArray[n].Left = xPos;
                horizontalSliderArray[n].Top = yPos;
                horizontalSliderArray[n].sliderFunction = (int)Function.SERVO;
                yPos = yPos + horizontalSliderArray[n].Height - 1;
                this.Controls.Add(horizontalSliderArray[n]);
                horizontalSliderArray[n].BringToFront();
                horizontalSliderArray[n].SliderControlChanged += new SliderControl.SliderControlEventHandler(KHR_1HV_Trim_SliderControlChanged);
                n++;
            }
            cmdMnuControl.Tag = n + 1;
            cmdMnuControl.TabIndex = n;
            cmdMnuControl.Left = 0;
            cmdMnuControl.Top = yPos + 31;
            this.Controls.Add(cmdMnuControl);
            cmdMnuControl.BringToFront();
            cmdMnuControl.TrimFileDialogPressed += new TrimCommandMenu.TrimCommandMenuControl.TrimFileDialogEventHandler(cmdMnuControl_TrimFileDialogPressed);
        }
Ejemplo n.º 2
0
        private void KHR_1HV_Position_Load(object sender, EventArgs e)
        {
            // wat betekend dit
            //            displayBackgroundToolStripMenuItem.Checked = _iniPosValues.PosBackground;
            //            pictureBox1.Visible = false;
            panelLockToolStripMenuItem.Checked = true;
            panelLockToolStripMenuItem1.Checked = true;

            horizontalSliderArray = new HorizontalSlider.SliderControl[Roboard.StaticUtilities.numberOfServos];

            //load form size and color
            this.Size = new System.Drawing.Size(_iniPosValues.PosWidth, _iniPosValues.PosHeight);
            this.BackColor = ColorTranslator.FromOle(_iniPosValues.PosColor);

            // if there is a backgroundPicture in the ini file and it exists as file then load it.
            if ((_iniPosValues.PosPicture != string.Empty) && (System.IO.File.Exists(_iniPosValues.PosPicture) == true))
            {
                if (_iniPosValues.PosBackground)
                {
                    displayBackgroundToolStripMenuItem.Checked = true;
                    pictureBox1.Visible = true;
                }
                else
                {
                    displayBackgroundToolStripMenuItem.Checked = false;
                    pictureBox1.Visible = false;
                }
                pictureBox1.Image = Image.FromFile(_iniPosValues.PosPicture);
                pictureBox1.SendToBack();
            }

            horizontalSliderArray = new HorizontalSlider.SliderControl[Roboard.StaticUtilities.numberOfServos];
            int index;
            for (index = 0; index < Roboard.StaticUtilities.numberOfServos; index++)
            {
                // Initialize one variable
                horizontalSliderArray[index] = new HorizontalSlider.SliderControl();

                horizontalSliderArray[index].Tag = index + 1;
                horizontalSliderArray[index].Left = _iniPosValues.PosChannelLocationX[index];
                horizontalSliderArray[index].Top = _iniPosValues.PosChannelLocationY[index];
                horizontalSliderArray[index].BackColor = ColorTranslator.FromOle(_iniPosValues.PosChannelColor[index]);
                horizontalSliderArray[index].sliderFunction = _iniPosValues.PosChannelFunction[index];
                horizontalSliderArray[index].sliderLabel = _iniPosValues.PosChannelName[index];
                horizontalSliderArray[index].Visible = _iniPosValues.PosChannelVisible[index];
                horizontalSliderArray[index].sliderValue = int.Parse(saWidth[index]);
                this.Controls.Add(horizontalSliderArray[index]);

                // the event for the sliderchange
                horizontalSliderArray[index].SliderControlChanged += new HorizontalSlider.SliderControl.SliderControlEventHandler(KHR_1HV_Position_SliderControlChanged);
                // the Event of MouseDown
                horizontalSliderArray[index].MouseDown += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseDown);
                // the Event of MouseMove
                horizontalSliderArray[index].MouseMove += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseMove);
                // the Event of MouseUp
                horizontalSliderArray[index].MouseUp += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseUp);
                // the control for the contextMenuStrip
                horizontalSliderArray[index].ContextMenuStrip = this.contextMenuStrip2;

                horizontalSliderArray[index].BringToFront();
            }

            servos = new Servos();
            //servos.ServosHandler += new Servos.ServosEventHandler(servos_ServosHandler);
            servos.Start();

            speedSlider.Tag = index + 1;
            speedSlider.sliderLabel = "SPEED";
            speedSlider.Left = _iniPosValues.PosSpeedLocationX;
            speedSlider.Top = _iniPosValues.PosSpeedLocationY;
            speedSlider.BackColor = ColorTranslator.FromOle(_iniPosValues.PosSpeedColor);
            speedSlider.sliderFunction = 1;
            speedSlider.sliderMinRange = 1;
            speedSlider.sliderMaxRange = 10000;
            speedSlider.sliderValue = _speedSliderValue;
            this.Controls.Add(speedSlider);
            speedSlider.MouseDown += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseDown);
            speedSlider.MouseMove += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseMove);
            speedSlider.MouseUp += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseUp);
            speedSlider.ContextMenuStrip = this.contextMenuStrip2;
            speedSlider.BringToFront();
            index++;

            cmdMnuControl.Tag = index + 1;
            cmdMnuControl.Left = _iniPosValues.PosCMDLocationX;
            cmdMnuControl.Top = _iniPosValues.PosCMDLocationY;
            cmdMnuControl.BackColor = ColorTranslator.FromOle(_iniPosValues.PosCMDColor);
            this.Controls.Add(cmdMnuControl);
            cmdMnuControl.MouseDown += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseDown);
            cmdMnuControl.MouseMove += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseMove);
            cmdMnuControl.MouseUp += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseUp);
            cmdMnuControl.ContextMenuStrip = this.contextMenuStrip2;
            cmdMnuControl.BringToFront();
            index++;

            linkControl.Tag = index + 1;
            linkControl.Left = _iniPosValues.PosLinkLocationX;
            linkControl.Top = _iniPosValues.PosLinkLocationY;
            linkControl.BackColor = ColorTranslator.FromOle(_iniPosValues.PosLinkColor);
            this.Controls.Add(linkControl);
            linkControl.MouseDown += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseDown);
            linkControl.MouseMove += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseMove);
            linkControl.MouseUp += new System.Windows.Forms.MouseEventHandler(sliderControl_MouseUp);
            linkControl.ContextMenuStrip = this.contextMenuStrip2;
            linkControl.BringToFront();

            cH1ToolStripMenuItem1.Checked = cH1ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[0];
            cH2ToolStripMenuItem1.Checked = cH2ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[1];
            cH3ToolStripMenuItem1.Checked = cH3ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[2];
            cH4ToolStripMenuItem1.Checked = cH4ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[3];
            cH5ToolStripMenuItem1.Checked = cH5ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[4];
            cH6ToolStripMenuItem1.Checked = cH6ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[5];
            cH7ToolStripMenuItem1.Checked = cH7ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[6];
            cH8ToolStripMenuItem1.Checked = cH8ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[7];
            cH9ToolStripMenuItem1.Checked = cH9ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[8];
            cH10ToolStripMenuItem1.Checked = cH10ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[9];
            cH11ToolStripMenuItem1.Checked = cH11ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[10];
            cH12ToolStripMenuItem1.Checked = cH12ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[11];
            cH13ToolStripMenuItem1.Checked = cH13ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[12];
            cH14ToolStripMenuItem1.Checked = cH14ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[13];
            cH15ToolStripMenuItem1.Checked = cH15ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[14];
            cH16ToolStripMenuItem1.Checked = cH16ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[15];
            cH17ToolStripMenuItem1.Checked = cH17ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[16];
            cH18ToolStripMenuItem1.Checked = cH18ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[17];
            cH19ToolStripMenuItem1.Checked = cH19ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[18];
            cH20ToolStripMenuItem1.Checked = cH20ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[19];
            cH21ToolStripMenuItem1.Checked = cH21ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[20];
            cH22ToolStripMenuItem1.Checked = cH22ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[21];
            cH23ToolStripMenuItem1.Checked = cH23ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[22];
            cH24ToolStripMenuItem1.Checked = cH24ToolStripMenuItem.Checked = _iniPosValues.PosChannelVisible[23];
            speedToolStripMenuItem1.Checked = sPEEDToolStripMenuItem.Checked = _iniPosValues.PosSpeedVisible;
            cOMMANDToolStripMenuItem1.Checked = cOMMANDToolStripMenuItem.Checked = _iniPosValues.PosCMDVisible;
            lINKToolStripMenuItem1.Checked = lINKToolStripMenuItem.Checked = _iniPosValues.PosLinkVisible;

            servos.changeAllChannels(saWidth);
        }