private void ClearFormControls(bool _initial) { this.SuspendLayout(); //Profile //Level FormUpdatePlayerLevel(); //Skills foreach (CheckBox temp in ADRbuttonArray) { temp.Checked = false; } foreach (CheckBox temp in SkillButtonArray) { temp.Checked = false; } //User Colors UserColorsList.Clear(); for (int i = 0; i < 8; i++) { UserColorsList.Add(Color.FromArgb(0, 0, 0, 0)); } UpdateUserColorsButtons(); UserColorsList.Clear(); //Company pictureBoxCompanyLogo.Image = null; textBoxUserCompanyCompanyName.Text = ""; textBoxUserCompanyMoneyAccount.Text = ""; comboBoxUserCompanyHQcity.DataSource = null; listBoxVisitedCities.Items.Clear(); listBoxGarages.Items.Clear(); //Truck //Trailer //FreightMarket comboBoxFreightMarketCountries.DataSource = null; comboBoxFreightMarketCompanies.DataSource = null; comboBoxFreightMarketSourceCity.DataSource = null; comboBoxFreightMarketSourceCompany.DataSource = null; comboBoxFreightMarketDestinationCity.DataSource = null; comboBoxFreightMarketDestinationCompany.DataSource = null; comboBoxFreightMarketCargoList.DataSource = null; comboBoxFreightMarketUrgency.DataSource = null; comboBoxFreightMarketTrailerDef.DataSource = null; comboBoxFreightMarketTrailerVariant.DataSource = null; listBoxFreightMarketAddedJobs.Items.Clear(); // this.ResumeLayout(); }
internal void AddUserColor4slot() { Color userColor = Color.FromArgb(0, 0, 0, 0); for (int i = 0; i < 4; i++) { UserColorsList.Add(userColor); } //Scroll panel to the top to properly add buttons panelProfileUserColors.AutoScrollPosition = new Point(0, 0); UpdateUserColorsButtons(); //Return to top position int location = panelProfileUserColors.VerticalScroll.Maximum - panelProfileUserColors.Height; if (location > 0) { panelProfileUserColors.AutoScrollPosition = new Point(0, location); panelProfileUserColors.VerticalScroll.Value = location; } }
internal void RemoveUserColorUnused4slot() { int counter = UserColorsList.Count - 1; int slotCount = UserColorsList.Count / 4; try { for (int iCol = 0; iCol < slotCount; iCol++) { bool delete = false; for (int i = 0; i < 4; i++) { if (UserColorsList[counter - i].A == 0) { delete = true; } else { delete = false; break; } } counter = counter - 4; if (delete) { for (int i = 4; i > 0; i--) { int btnNumber = counter + i; Control[] tempArray = panelProfileUserColors.Controls.Find("buttonUC" + btnNumber.ToString(), false); if (tempArray.Length > 0) { panelProfileUserColors.Controls.Remove(tempArray[0]); UserColorsList.RemoveAt(btnNumber); } else { break; } } } else { break; } } if (UserColorsList.Count / 4 >= 40) { buttonAddUserColor.Enabled = false; } else { buttonAddUserColor.Enabled = true; } } catch { } //Scroll panel to the top to properly add buttons panelProfileUserColors.AutoScrollPosition = new Point(0, 0); UpdateUserColorsButtons(); //Return to top position int location = panelProfileUserColors.VerticalScroll.Maximum - panelProfileUserColors.Height; if (location > 0) { panelProfileUserColors.AutoScrollPosition = new Point(0, location); panelProfileUserColors.VerticalScroll.Value = location; } }