public void SelectAll() { OpenControl(); if (SelectAllButton.Enabled) { SelectAllButton.Click(); } CloseControl(); }
private void Localize() { Text = LText.ScanAllFMsBox.TitleText; ScanAllFMsForLabel.Text = LText.ScanAllFMsBox.ScanAllFMsFor; TitleCheckBox.Text = LText.ScanAllFMsBox.Title; AuthorCheckBox.Text = LText.ScanAllFMsBox.Author; GameCheckBox.Text = LText.ScanAllFMsBox.Game; CustomResourcesCheckBox.Text = LText.ScanAllFMsBox.CustomResources; SizeCheckBox.Text = LText.ScanAllFMsBox.Size; ReleaseDateCheckBox.Text = LText.ScanAllFMsBox.ReleaseDate; TagsCheckBox.Text = LText.ScanAllFMsBox.Tags; SelectAllButton.SetTextAutoSize(LText.Global.SelectAll); SelectNoneButton.SetTextAutoSize(LText.Global.SelectNone); ScanButton.SetTextAutoSize(LText.ScanAllFMsBox.Scan, ScanButton.Width); Cancel_Button.SetTextAutoSize(LText.Global.Cancel, Cancel_Button.Width); }
public void SelectAll() { SelectAllButton.Click(); }
public MessageBoxCustomForm( string messageTop, string messageBottom, string title, MessageBoxIcon icon, string okText, string cancelText, bool okIsDangerous, string[]?choiceStrings = null, bool multiSelectionAllowed = true) { #if DEBUG InitializeComponent(); #else InitializeComponentSlim(); #endif _multiChoice = choiceStrings?.Length > 0; #region Set fonts // Set these after InitializeComponent() in case that sets other fonts, but before anything else MessageTopLabel.Font = SystemFonts.MessageBoxFont; MessageBottomLabel.Font = SystemFonts.MessageBoxFont; SelectAllButton.Font = SystemFonts.MessageBoxFont; OKButton.Font = SystemFonts.MessageBoxFont; Cancel_Button.Font = SystemFonts.MessageBoxFont; ChoiceListBox.Font = SystemFonts.DefaultFont; #endregion #region Set passed-in values if (icon != MessageBoxIcon.None) { ControlUtils.SetMessageBoxIcon(IconPictureBox, icon); } Text = title; MessageTopLabel.Text = messageTop; MessageBottomLabel.Text = messageBottom; if (_multiChoice) { ChoiceListBox.MultiSelect = multiSelectionAllowed; ChoiceListBox.BeginUpdate(); // Set this first: the list is now populated for (int i = 0; i < choiceStrings !.Length; i++) { ChoiceListBox.Items.Add(choiceStrings[i]); } ChoiceListBox.EndUpdate(); if (!multiSelectionAllowed) { SelectAllButton.Hide(); } } else { ChoiceListBox.Hide(); SelectButtonsFLP.Hide(); MessageBottomLabel.Hide(); } #endregion #region Autosize controls int innerControlWidth = MainFLP.Width - 10; MessageTopLabel.MaximumSize = new Size(innerControlWidth, MessageTopLabel.MaximumSize.Height); MessageBottomLabel.MaximumSize = new Size(innerControlWidth, MessageBottomLabel.MaximumSize.Height); if (_multiChoice) { // Set this second: the list is now sized based on its content ChoiceListBox.Size = new Size(innerControlWidth, (ChoiceListBox.ItemHeight * ChoiceListBox.Items.Count.Clamp(5, 20)) + (SystemInformation.BorderSize.Height * 2)); // Set this before window autosizing SelectButtonsFLP.Width = innerControlWidth + 1; } // Set these before setting button text if (okIsDangerous) { OKButton.TextImageRelation = TextImageRelation.ImageBeforeText; OKButton.ImageAlign = ContentAlignment.MiddleCenter; OKButton.Image = Images.RedExclamationMarkCircle; } // This is here instead of in the localize method because it's not really localizing, it's just setting // text that was passed to it. Which in our case actually is localized, but you know. OKButton.Text = okText; Cancel_Button.Text = cancelText; #endregion Localize(); SelectButtonsFLP.Height = SelectAllButton.Height; #region Autosize window // Run this after localization, so we have the right button widths #region Local functions int GetControlFullHeight(Control control, bool onlyIfVisible = false) => !onlyIfVisible || _multiChoice ? control.Margin.Vertical + control.Height : 0;