コード例 #1
0
        public ErrorProviderAccessibleObjectTests()
        {
            _form = new Form();
            _form.CreateControl();
            _form.Visible = true;

            _control1 = new Control();
            _control1.CreateControl();
            _control1.Visible = true;

            _control2 = new Control();
            _control2.CreateControl();
            _control2.Visible = true;

            _form.Controls.Add(_control1);
            _form.Controls.Add(_control2);

            _errorText1 = "Test text 1";
            _errorText2 = "Test text 2";

            _errorProvider = new ErrorProvider();
            _errorProvider.SetError(_control1, _errorText1);
            _errorProvider.SetError(_control2, _errorText2);

            _errorWindow  = _errorProvider.EnsureErrorWindow(_form);
            _controlItem1 = _errorWindow.ControlItems.Count > 0 ? _errorWindow.ControlItems[0] : null;
            _controlItem2 = _errorWindow.ControlItems.Count > 0 ? _errorWindow.ControlItems[1] : null;
        }