private void mainGUI_Load(object sender, EventArgs e) { //First step, check it gui_settings file is exists or not, if not then start settings wizard //if (!File.Exists(sGuiSettingsFilename)) //{ // setup_wizard panelSetupWizard = new setup_wizard(); // panelSetupWizard.ShowDialog(); //} //Now there must be a valid settings file, so we can continue with normal execution //Start with Settings file read, and parse exit if unsuccessfull gui_settings = new GUI_settings(); //if (!gui_settings.read_from_xml(sGuiSettingsFilename)) //{ // Environment.Exit(-1); // } sOptionsConfigFilename = sOptionsConfigFilename + gui_settings.iSoftwareVersion + ".xml"; read_options_config(); //read and parse optionsconfig.xml file. sets iCheckBoxItems mw_gui = new mw_data_gui(iPidItems, iCheckBoxItems, gui_settings.iSoftwareVersion); mw_params = new mw_settings(iPidItems, iCheckBoxItems, gui_settings.iSoftwareVersion); //Quick hack to get pid names to mw_params untill redo the structures for (int i = 0; i < iPidItems; i++) { mw_params.pidnames[i] = Pid[i].name; } bSerialBuffer = new byte[65]; inBuf = new byte[300]; //init input buffer ToolTip toolTip1 = new ToolTip(); toolTip1.AutoPopDelay = 5000; toolTip1.InitialDelay = 1000; toolTip1.ReshowDelay = 500; toolTip1.ShowAlways = true; //rcOptions1 = new byte[iCheckBoxItems]; //rcOptions2 = new byte[iCheckBoxItems]; //Fill out settings tab //l_Settings_folder.Text = gui_settings.sSettingsFolder; #region Indicator_Struct //Build indicator lamps array indicators = new indicator_lamp[iCheckBoxItems]; int row = 0; int col = 0; int startx = 468; int starty = 269; for (int i = 0; i < iCheckBoxItems; i++) { indicators[i] = new indicator_lamp(); indicators[i].Location = new Point(startx + col * 52, starty + row * 19); indicators[i].Visible = true; indicators[i].Text = option_indicators[i]; indicators[i].indicator_color = 1; indicators[i].Anchor = AnchorStyles.Right; this.splitContainer1.Panel2.Controls.Add(indicators[i]); //this.panel1.Controls.Add(indicators[i]); col++; if (col == 2) { col = 0; row++; } } #endregion #region AUX_Checkbox_Struct //Build the RC control checkboxes structure aux = new CheckBoxEx[4, 4, iCheckBoxItems]; startx = 80; starty = 60; int a, b, c; for (c = 0; c < 4; c++) { for (a = 0; a < 3; a++) { for (b = 0; b < iCheckBoxItems; b++) { aux[c, a, b] = new CheckBoxEx(); aux[c, a, b].Location = new Point(startx + a * 18 + c * 70, starty + b * 25); aux[c, a, b].Visible = true; aux[c, a, b].Text = ""; aux[c, a, b].AutoSize = true; aux[c, a, b].Size = new Size(16, 16); aux[c, a, b].UseVisualStyleBackColor = true; aux[c, a, b].CheckedChanged += new System.EventHandler(this.aux_checked_changed_event); //Set info on the given checkbox position aux[c, a, b].aux = c; //Which aux channel aux[c, a, b].rclevel = a; //which rc level aux[c, a, b].item = b; //Which item this.groupBox5.Controls.Add(aux[c, a, b]); } } } aux_labels = new System.Windows.Forms.Label[4]; lmh_labels = new System.Windows.Forms.Label[4, 3]; // aux1-4, L,M,H string strlmh = "LMH"; for (a = 0; a < 4; a++) { aux_labels[a] = new System.Windows.Forms.Label(); aux_labels[a].Text = "AUX" + String.Format("{0:0}", a + 1); aux_labels[a].Location = new Point(startx + a * 70 + 8, starty - 35); aux_labels[a].AutoSize = true; aux_labels[a].ForeColor = Color.Black; this.groupBox5.Controls.Add(aux_labels[a]); for (b = 0; b < 3; b++) { lmh_labels[a, b] = new System.Windows.Forms.Label(); lmh_labels[a, b].Text = strlmh.Substring(b, 1); ; lmh_labels[a, b].Location = new Point(startx + a * 70 + b * 18, starty - 20); lmh_labels[a, b].AutoSize = true; lmh_labels[a, b].ForeColor = Color.Black; this.groupBox5.Controls.Add(lmh_labels[a, b]); } } cb_labels = new System.Windows.Forms.Label[20]; for (z = 0; z < iCheckBoxItems; z++) { cb_labels[z] = new System.Windows.Forms.Label(); cb_labels[z].Text = option_names[z]; cb_labels[z].Location = new Point(10, starty + z * 25); cb_labels[z].Visible = true; cb_labels[z].AutoSize = true; cb_labels[z].ForeColor = Color.Black; cb_labels[z].TextAlign = ContentAlignment.MiddleRight; toolTip1.SetToolTip(cb_labels[z], option_desc[z]); this.groupBox5.Controls.Add(cb_labels[z]); } #endregion //Build PID control structure based on the Pid structure. #region PID_Struct const int iLineSpace = 36; const int iRow1 = 25; const int iRow2 = 125; const int iRow3 = 220; const int iTopY = 30; Font fontField = new Font("Arial", 9, FontStyle.Regular); Size fieldSize = new Size(70, 25); for (int i = 0; i < iPidItems; i++) { Pid[i].pidLabel = new System.Windows.Forms.Label(); Pid[i].pidLabel.Text = Pid[i].name; Pid[i].pidLabel.Location = new Point(iRow1, 15 + i * iLineSpace); Pid[i].pidLabel.Visible = true; Pid[i].pidLabel.AutoSize = true; Pid[i].pidLabel.ForeColor = Color.Black; Pid[i].pidLabel.TextAlign = ContentAlignment.MiddleRight; toolTip1.SetToolTip(Pid[i].pidLabel, Pid[i].description); this.groupBox4.Controls.Add(Pid[i].pidLabel); if (Pid[i].Pshown) { Pid[i].Pfield = new System.Windows.Forms.NumericUpDown(); Pid[i].Pfield.ValueChanged += new EventHandler(pfield_valuechange); Pid[i].Pfield.Location = new Point(iRow1, iTopY + i * iLineSpace); Pid[i].Pfield.Size = fieldSize; Pid[i].Pfield.Font = fontField; Pid[i].Pfield.BorderStyle = BorderStyle.FixedSingle; Pid[i].Pfield.TextAlign = HorizontalAlignment.Center; Pid[i].Pfield.Maximum = Pid[i].Pmax; Pid[i].Pfield.Minimum = Pid[i].Pmin; Pid[i].Pfield.DecimalPlaces = decimals(Pid[i].Pprec); Pid[i].Pfield.Increment = 1 / (decimal)Pid[i].Pprec; this.groupBox4.Controls.Add(Pid[i].Pfield); Pid[i].Plabel = new System.Windows.Forms.Label(); Pid[i].Plabel.Text = "P"; Pid[i].Plabel.Font = fontField; Pid[i].Plabel.ForeColor = Color.Black; Pid[i].Plabel.Location = new Point(iRow1 - 20, iTopY + i * iLineSpace); this.groupBox4.Controls.Add(Pid[i].Plabel); } if (Pid[i].Ishown) { Pid[i].Ifield = new System.Windows.Forms.NumericUpDown(); Pid[i].Ifield.ValueChanged += new EventHandler(ifield_valuechange); Pid[i].Ifield.Location = new Point(iRow2, iTopY + i * iLineSpace); Pid[i].Ifield.Size = fieldSize; Pid[i].Ifield.Font = fontField; Pid[i].Ifield.BorderStyle = BorderStyle.FixedSingle; Pid[i].Ifield.TextAlign = HorizontalAlignment.Center; Pid[i].Ifield.Maximum = Pid[i].Imax; Pid[i].Ifield.Minimum = Pid[i].Imin; Pid[i].Ifield.DecimalPlaces = decimals(Pid[i].Iprec); Pid[i].Ifield.Increment = 1 / (decimal)Pid[i].Iprec; this.groupBox4.Controls.Add(Pid[i].Ifield); Pid[i].Ilabel = new System.Windows.Forms.Label(); Pid[i].Ilabel.Text = "I"; Pid[i].Ilabel.Font = fontField; Pid[i].Ilabel.ForeColor = Color.Black; Pid[i].Ilabel.Location = new Point(iRow2 - 20, iTopY + i * iLineSpace); this.groupBox4.Controls.Add(Pid[i].Ilabel); } if (Pid[i].Dshown) { Pid[i].Dfield = new System.Windows.Forms.NumericUpDown(); Pid[i].Dfield.ValueChanged += new EventHandler(dfield_valuechange); Pid[i].Dfield.Location = new Point(iRow3, iTopY + i * iLineSpace); Pid[i].Dfield.Size = fieldSize; Pid[i].Dfield.Font = fontField; Pid[i].Dfield.BorderStyle = BorderStyle.FixedSingle; Pid[i].Dfield.TextAlign = HorizontalAlignment.Center; Pid[i].Dfield.Maximum = Pid[i].Dmax; Pid[i].Dfield.Minimum = Pid[i].Dmin; Pid[i].Dfield.DecimalPlaces = decimals(Pid[i].Dprec); Pid[i].Dfield.Increment = 1 / (decimal)Pid[i].Dprec; this.groupBox4.Controls.Add(Pid[i].Dfield); Pid[i].Dlabel = new System.Windows.Forms.Label(); Pid[i].Dlabel.Text = "D"; Pid[i].Dlabel.Font = fontField; Pid[i].Dlabel.ForeColor = Color.Black; Pid[i].Dlabel.Location = new Point(iRow3 - 18, iTopY + i * iLineSpace); this.groupBox4.Controls.Add(Pid[i].Dlabel); } } #endregion this.Refresh(); serial_ports_enumerate(); foreach (string speed in sSerialSpeeds) { cb_serial_speed.Items.Add(speed); } cb_serial_speed.SelectedItem = "115200"; if (cb_serial_port.Items.Count == 0) { b_connect.Enabled = false; //Nos serial port, disable connect } //Init serial port object serialPort = new SerialPort(); //Set up serial port parameters (at least the ones what we know upfront serialPort.DataBits = 8; serialPort.Parity = Parity.None; serialPort.StopBits = StopBits.One; serialPort.Handshake = Handshake.None; serialPort.DtrEnable = false; //?? serialPort.ReadBufferSize = 4096; //4K byte of read buffer serialPort.ReadTimeout = 500; // 500msec timeout; //Init Realtime Monitor panel controls foreach (string rate in sRefreshSpeeds) { cb_monitor_rate.Items.Add(rate); } cb_monitor_rate.SelectedIndex = 0; //20Hz is the default //cb_serial_speed.SelectedItem = "115200"; //Setup timers timer_realtime.Tick += new EventHandler(timer_realtime_Tick); timer_realtime.Interval = iRefreshIntervals[cb_monitor_rate.SelectedIndex]; timer_realtime.Enabled = true; timer_realtime.Stop(); //Set up zgMonitor control for real time monitoring GraphPane myPane = zgMonitor.GraphPane; // Set the titles and axis labels myPane.Title.Text = ""; myPane.XAxis.Title.Text = ""; myPane.YAxis.Title.Text = ""; #region Zed_Points_Curves //Set up pointlists and curves list_acc_roll = new RollingPointPairList(300); curve_acc_roll = myPane.AddCurve("acc_roll", list_acc_roll, Color.Red, SymbolType.None); list_acc_pitch = new RollingPointPairList(300); curve_acc_pitch = myPane.AddCurve("acc_pitch", list_acc_pitch, Color.Green, SymbolType.None); list_acc_z = new RollingPointPairList(300); curve_acc_z = myPane.AddCurve("acc_z", list_acc_z, Color.Blue, SymbolType.None); list_gyro_roll = new RollingPointPairList(300); curve_gyro_roll = myPane.AddCurve("gyro_roll", list_gyro_roll, Color.Gold, SymbolType.None); list_gyro_pitch = new RollingPointPairList(300); curve_gyro_pitch = myPane.AddCurve("gyro_pitch", list_gyro_pitch, Color.DarkCyan, SymbolType.None); list_gyro_yaw = new RollingPointPairList(300); curve_gyro_yaw = myPane.AddCurve("gyro_yaw", list_gyro_yaw, Color.Magenta, SymbolType.None); list_mag_roll = new RollingPointPairList(300); curve_mag_roll = myPane.AddCurve("mag_roll", list_mag_roll, Color.CadetBlue, SymbolType.None); list_mag_pitch = new RollingPointPairList(300); curve_mag_pitch = myPane.AddCurve("mag_pitch", list_mag_pitch, Color.MediumPurple, SymbolType.None); list_mag_yaw = new RollingPointPairList(300); curve_mag_yaw = myPane.AddCurve("mag_yaw", list_mag_yaw, Color.DarkGoldenrod, SymbolType.None); list_alt = new RollingPointPairList(300); curve_alt = myPane.AddCurve("alt", list_alt, Color.Maroon, SymbolType.None); list_head = new RollingPointPairList(300); curve_head = myPane.AddCurve("head", list_head, Color.Orange, SymbolType.None); // Show the x axis grid myPane.XAxis.MajorGrid.IsVisible = true; myPane.YAxis.MajorGrid.IsVisible = true; // Make the Y axis scale red myPane.YAxis.Scale.FontSpec.FontColor = Color.Black; myPane.YAxis.Title.FontSpec.FontColor = Color.Black; // turn off the opposite tics so the Y tics don't show up on the Y2 axis myPane.YAxis.MajorTic.IsOpposite = false; myPane.YAxis.MinorTic.IsOpposite = false; // Don't display the Y zero line myPane.YAxis.MajorGrid.IsZeroLine = true; // Align the Y axis labels so they are flush to the axis myPane.YAxis.Scale.Align = AlignP.Inside; myPane.YAxis.Scale.IsVisible = false; // Manually set the axis range myPane.YAxis.Scale.Min = -150; myPane.YAxis.Scale.Max = 150; myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(123, 194, 205), 45.0f); myPane.Fill = new Fill(Color.White, Color.White, 45.0f); myPane.Legend.IsVisible = false; myPane.Border.IsVisible = false; myPane.XAxis.Scale.IsVisible = false; myPane.YAxis.Scale.IsVisible = true; myPane.XAxis.Scale.MagAuto = true; myPane.YAxis.Scale.MagAuto = false; zgMonitor.IsEnableHPan = true; zgMonitor.IsEnableHZoom = true; foreach (ZedGraph.LineItem li in myPane.CurveList) { li.Line.Width = 1; } myPane.YAxis.Title.FontSpec.FontColor = Color.Black; myPane.XAxis.Title.FontSpec.FontColor = Color.Black; myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 300; myPane.XAxis.Type = AxisType.Linear; zgMonitor.ScrollGrace = 0; xScale = zgMonitor.GraphPane.XAxis.Scale; zgMonitor.AxisChange(); #endregion //Disable buttons that are not working till connected b_reset.Enabled = false; b_cal_acc.Enabled = false; b_cal_mag.Enabled = false; b_read_settings.Enabled = false; b_write_settings.Enabled = false; }
private void create_RC_Checkboxes(string[] names) { //Build indicator lamps array indicators = new indicator_lamp[iCheckBoxItems]; int row = 0; int col = 0; int startx = 459; int starty = 7; for (int i = 0; i < iCheckBoxItems; i++) { indicators[i] = new indicator_lamp(); indicators[i].Location = new Point(startx + col * 67, starty + row * 19); indicators[i].Visible = true; indicators[i].Text = names[i]; indicators[i].indicator_color = 1; this.splitContainer3.Panel1.Controls.Add(indicators[i]); col++; if (col == 2) { col = 0; row++; } } //Build a second indicator lamps array on Mission plane indicators_mission = new indicator_lamp[iCheckBoxItems]; startx = this.splitContainer9.Panel1.Location.X + this.splitContainer9.Panel1.Width - 67; starty = this.splitContainer9.Panel1.Location.Y + 20; for (int i = 0; i < iCheckBoxItems; i++) { indicators_mission[i] = new indicator_lamp(); indicators_mission[i].Location = new Point(startx , starty + i * 19); indicators_mission[i].Text = names[i]; indicators_mission[i].indicator_color = 1; indicators_mission[i].Anchor = ( AnchorStyles.Right | AnchorStyles.Top ); indicators_mission[i].Visible = bShowGauges; this.splitContainer9.Panel1.Controls.Add(indicators_mission[i]); this.splitContainer9.Panel1.Controls.SetChildIndex(indicators_mission[i], 0); } //Build the RC control checkboxes structure if (!check_capability(CAP.EXTENDED_AUX)) { #region normal_aux_states aux = new CheckBoxEx[4, 4, iCheckBoxItems]; startx = 200; starty = 60; int a, b, c; for (c = 0; c < 4; c++) { for (a = 0; a < 3; a++) { for (b = 0; b < iCheckBoxItems; b++) { aux[c, a, b] = new CheckBoxEx(); aux[c, a, b].Location = new Point(startx + a * 18 + c * 70, starty + b * 25); aux[c, a, b].Visible = true; aux[c, a, b].Text = ""; aux[c, a, b].AutoSize = true; aux[c, a, b].Size = new Size(16, 16); aux[c, a, b].UseVisualStyleBackColor = true; aux[c, a, b].CheckedChanged += new System.EventHandler(this.aux_checked_changed_event); //Set info on the given checkbox position aux[c, a, b].aux = c; //Which aux channel aux[c, a, b].rclevel = a; //which rc level aux[c, a, b].item = b; //Which item this.tabPageRC.Controls.Add(aux[c, a, b]); } } } aux_labels = new System.Windows.Forms.Label[4]; lmh_labels = new System.Windows.Forms.Label[4, 3]; // aux1-4, L,M,H string strlmh = "LMH"; for (a = 0; a < 4; a++) { aux_labels[a] = new System.Windows.Forms.Label(); aux_labels[a].Text = "AUX" + String.Format("{0:0}", a + 1); aux_labels[a].Location = new Point(startx + a * 70 + 8, starty - 35); aux_labels[a].AutoSize = true; aux_labels[a].ForeColor = Color.White; this.tabPageRC.Controls.Add(aux_labels[a]); for (b = 0; b < 3; b++) { lmh_labels[a, b] = new System.Windows.Forms.Label(); lmh_labels[a, b].Text = strlmh.Substring(b, 1); ; lmh_labels[a, b].Location = new Point(startx + a * 70 + b * 18, starty - 20); lmh_labels[a, b].AutoSize = true; lmh_labels[a, b].ForeColor = Color.White; this.tabPageRC.Controls.Add(lmh_labels[a, b]); } } cb_labels = new System.Windows.Forms.Label[20]; for (z = 0; z < iCheckBoxItems; z++) { cb_labels[z] = new System.Windows.Forms.Label(); cb_labels[z].Text = names[z]; cb_labels[z].Location = new Point(10, starty + z * 25); cb_labels[z].Visible = true; cb_labels[z].AutoSize = true; cb_labels[z].ForeColor = Color.White; cb_labels[z].TextAlign = ContentAlignment.MiddleRight; this.tabPageRC.Controls.Add(cb_labels[z]); } #endregion } // EXTNEDED AUX CAPABILITY else { #region extended_aux_states aux = new CheckBoxEx[4, 6, iCheckBoxItems]; startx = 150; starty = 60; int a, b, c; for (c = 0; c < 4; c++) { for (a = 0; a < 6; a++) { for (b = 0; b < iCheckBoxItems; b++) { aux[c, a, b] = new CheckBoxEx(); aux[c, a, b].Location = new Point(startx + a * 18 + c * 130, starty + b * 25); aux[c, a, b].Visible = true; aux[c, a, b].Text = ""; aux[c, a, b].AutoSize = true; aux[c, a, b].Size = new Size(16, 16); aux[c, a, b].UseVisualStyleBackColor = true; aux[c, a, b].CheckedChanged += new System.EventHandler(this.aux_checked_changed_event); //Set info on the given checkbox position aux[c, a, b].aux = c; //Which aux channel aux[c, a, b].rclevel = a; //which rc level aux[c, a, b].item = b; //Which item this.tabPageRC.Controls.Add(aux[c, a, b]); } } } aux_labels = new System.Windows.Forms.Label[4]; lmh_labels = new System.Windows.Forms.Label[4, 6]; // aux1-4, L,M,H string strlmh = "123456"; for (a = 0; a < 4; a++) { aux_labels[a] = new System.Windows.Forms.Label(); aux_labels[a].Text = "AUX" + String.Format("{0:0}", a + 1); aux_labels[a].Location = new Point(startx + a * 130 + 32, starty - 35); aux_labels[a].AutoSize = true; aux_labels[a].ForeColor = Color.White; this.tabPageRC.Controls.Add(aux_labels[a]); for (b = 0; b < 6; b++) { lmh_labels[a, b] = new System.Windows.Forms.Label(); lmh_labels[a, b].Text = strlmh.Substring(b, 1); ; lmh_labels[a, b].Location = new Point(startx + a * 130 + b * 18, starty - 20); lmh_labels[a, b].AutoSize = true; lmh_labels[a, b].ForeColor = Color.White; this.tabPageRC.Controls.Add(lmh_labels[a, b]); } } cb_labels = new System.Windows.Forms.Label[20]; for (z = 0; z < iCheckBoxItems; z++) { cb_labels[z] = new System.Windows.Forms.Label(); cb_labels[z].Text = names[z]; cb_labels[z].Location = new Point(10, starty + z * 25); cb_labels[z].Visible = true; cb_labels[z].AutoSize = true; cb_labels[z].ForeColor = Color.White; cb_labels[z].TextAlign = ContentAlignment.MiddleRight; this.tabPageRC.Controls.Add(cb_labels[z]); } #endregion } }
private void create_RC_Checkboxes(string[] names) { //Build indicator lamps array indicators = new indicator_lamp[iCheckBoxItems]; int row = 0; int col = 0; int startx = 800; int starty = 3; for (int i = 0; i < iCheckBoxItems; i++) { indicators[i] = new indicator_lamp(); indicators[i].Location = new Point(startx + col * 52, starty + row * 19); indicators[i].Visible = true; indicators[i].Text = names[i]; indicators[i].indicator_color = 1; indicators[i].Anchor = AnchorStyles.Right; this.splitContainer2.Panel2.Controls.Add(indicators[i]); col++; if (col == 3) { col = 0; row++; } } //Build the RC control checkboxes structure aux = new CheckBoxEx[4, 4, iCheckBoxItems]; startx = 200; starty = 60; int a, b, c; for (c = 0; c < 4; c++) { for (a = 0; a < 3; a++) { for (b = 0; b < iCheckBoxItems; b++) { aux[c, a, b] = new CheckBoxEx(); aux[c, a, b].Location = new Point(startx + a * 18 + c * 70, starty + b * 25); aux[c, a, b].Visible = true; aux[c, a, b].Text = ""; aux[c, a, b].AutoSize = true; aux[c, a, b].Size = new Size(16, 16); aux[c, a, b].UseVisualStyleBackColor = true; aux[c, a, b].CheckedChanged += new System.EventHandler(this.aux_checked_changed_event); //Set info on the given checkbox position aux[c, a, b].aux = c; //Which aux channel aux[c, a, b].rclevel = a; //which rc level aux[c, a, b].item = b; //Which item this.tabPageRC.Controls.Add(aux[c, a, b]); } } } aux_labels = new System.Windows.Forms.Label[4]; lmh_labels = new System.Windows.Forms.Label[4, 3]; // aux1-4, L,M,H string strlmh = "LMH"; for (a = 0; a < 4; a++) { aux_labels[a] = new System.Windows.Forms.Label(); aux_labels[a].Text = "AUX" + String.Format("{0:0}", a + 1); aux_labels[a].Location = new Point(startx + a * 70 + 8, starty - 35); aux_labels[a].AutoSize = true; aux_labels[a].ForeColor = Color.White; this.tabPageRC.Controls.Add(aux_labels[a]); for (b = 0; b < 3; b++) { lmh_labels[a, b] = new System.Windows.Forms.Label(); lmh_labels[a, b].Text = strlmh.Substring(b, 1); ; lmh_labels[a, b].Location = new Point(startx + a * 70 + b * 18, starty - 20); lmh_labels[a, b].AutoSize = true; lmh_labels[a, b].ForeColor = Color.White; this.tabPageRC.Controls.Add(lmh_labels[a, b]); } } cb_labels = new System.Windows.Forms.Label[20]; for (z = 0; z < iCheckBoxItems; z++) { cb_labels[z] = new System.Windows.Forms.Label(); cb_labels[z].Text = names[z]; cb_labels[z].Location = new Point(10, starty + z * 25); cb_labels[z].Visible = true; cb_labels[z].AutoSize = true; cb_labels[z].ForeColor = Color.White; cb_labels[z].TextAlign = ContentAlignment.MiddleRight; this.tabPageRC.Controls.Add(cb_labels[z]); } }