/// <summary> /// Gets the <see cref="ToolStrip"/> with the given <paramref name="name"/> in the <paramref name="controls"/> /// </summary> /// <param name="controls">Collection of controls to search</param> /// <param name="name">Name of the <see cref="ToolStrip"/></param> /// <returns><see cref="ToolStrip"/> if found, null otherwise</returns> public static ToolStrip GetToolStrip(this ControlCollection controls, string name) { if (string.IsNullOrEmpty(name)) { return(null); } return((ToolStrip)controls.Find(name, true).FirstOrDefault()); }
public ChannelSettingsMapper(EventCode code, ControlCollection panel) { Code = code; var name = code.ToString(); switch (code) { case EventCode.FreeCompany: name = "FC"; break; case EventCode.TellFrom: name = "Tell"; break; } CheckBoxFilter = (CheckBox)panel.Find($"checkBoxChannelFilter{name}", true)[0]; ButtonColor = (Button)panel.Find($"buttonChannelColor{name}", true)[0]; CheckBoxLabel = (CheckBox)panel.Find($"checkBoxChannelLabel{name}", true)[0]; switch (code) { case EventCode.FreeCompany: ColorSettingKey = "ColorFCompany"; break; case EventCode.Novice: ColorSettingKey = "ColorBeginner"; break; case EventCode.NPC: ColorSettingKey = "ColorNpcSay"; break; case EventCode.CWLS1: ColorSettingKey = "ColorCWLS"; break; default: ColorSettingKey = $"Color{name}"; break; } }
public ChannelSettingsMapper(EventCode code, ControlCollection panel) { Code = code; var name = code.ToString(); switch (name) { case "FreeCompany": name = "FC"; break; case "TellFrom": name = "Tell"; break; } CheckBoxFilter = (CheckBox)panel.Find($"checkBoxChannelFilter{name}", true)[0]; ButtonColor = (Button)panel.Find($"buttonChannelColor{name}", true)[0]; CheckBoxLabel = (CheckBox)panel.Find($"checkBoxChannelLabel{name}", true)[0]; }
/// <summary>検索文字テキストボックスが空であるかを判定する</summary> /// <param name="outErrMsg"></param> /// <returns></returns> public static bool IsEmptySearchStringTextBox(ControlCollection controls) { int emptyTextBoxCount = 0; for (int i = 1; i <= Define.TEXTBOX_COUNT; i++) { Control[] cs = controls.Find("txt_SearchString" + i.ToString(), true); if (cs.Length <= 0) { continue; } TextBox textBox = cs[0] as TextBox; if (ErrCheck.IsEmptySearchStringTextBox(textBox.Text)) { emptyTextBoxCount++; } } return(emptyTextBoxCount == Define.TEXTBOX_COUNT); }
public void pintarBotoes(List <string> botoes, ControlCollection controls) { //RECEBE A LISTA DE BOTOES QUE DEVEM SER PINTADOS E EM QUAL CONTROLCOLLECTION Control[] c; //PEGA TODOSS OS COMPONENTESS DENTRO DO controls //E VERFICIA O TIPO DELE, CASO SEJA PANEL FAZ UM FOREACH //PARA PINTAR OS COMPONENTES DENTRO DO PANEL despintarCampos(controls); //DEPOIS DE PINTAR TODOS OS CAMPOS DE BRANCO, ELE PINTA //OS CAMPOS COM ERRO, DE VERMELHO foreach (var botao in botoes) { c = controls.Find(botao, true); foreach (Control ct in c) { ct.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFD2CA"); } } }