public FindForm(TypeFindForm typeForm, MainForm mainForm) { InitializeComponent(); _typeForm = typeForm; _mainForm = mainForm; _actClass = new ActionClass(); _actClass.LoadParameter(out _paramInfo); }
/// <summary> /// Показ формы для поиска/замены /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void menuActionFindReplace_Click(object sender, EventArgs e) { var tsmi = (ToolStripMenuItem)sender; TypeFindForm typeForm = tsmi.Name == menuActionFind.Name ? TypeFindForm.Find : TypeFindForm.Replace; if (m_FindForm == null || m_FindForm.IsDisposed) { m_FindForm = new FindForm(typeForm, this); m_FindForm.Show(); } else { m_FindForm.SetType(typeForm); m_FindForm.Focus(); } }
/// <summary> /// Установить нужный тип формы /// </summary> /// <param name="newType"></param> public void SetType(TypeFindForm newType) { _typeForm = newType; if (_typeForm == TypeFindForm.Replace) { buttonChangePlus.Visible = false; buttonChangeMinus.Visible = true; Height = 190; labelReplace.Visible = comboReplace.Visible = buttonReplace.Visible = buttonReplaceAll.Visible = true; comboReplace.Focus(); Text = "Замена"; } else { buttonChangePlus.Visible = true; buttonChangeMinus.Visible = false; Height = 160; labelReplace.Visible = comboReplace.Visible = buttonReplace.Visible = buttonReplaceAll.Visible = false; comboFind.Focus(); Text = "Поиск"; } }