为什么在按钮点击事件上winform filckers

时间:2011-07-14 08:02:50

标签: winforms c#-4.0

我有winform app有3种形式,有2种形式,我正在接受用户输入和when user click button my form flickers (i means its like form disappear and appears, and sometimes sends my app to back of other app)。谁能告诉我我的申请有什么问题?有没有人在winform中遇到过这种奇怪的行为?

EDITED

Cursor currentCursor = this.Cursor;
        try
        {
            this.Cursor = Cursors.WaitCursor;
            this.btnSave.Enabled = false;
            if (isDataModified)
            {
                if (CheckMandatoryData(mpgUserInfo, ref errorMessage))
                {
                    AppMessageBoxResult appMessageBoxResult =
                        AppMessageBox.ShowQuestion("Confirmation",
                    "Do you want to continue?", Environment.NewLine));

                    if (appMessageBoxResult == AppMessageBoxResult.Yes)
                    {
                        if (customerInformation != null)
                        {
                            //Assigning value to variable and saving
                            RefreshData();
                        }
                    }
                }
                else
                {
                    AppMessageBoxResult appMessageBoxResult =
                        AppMessageBox.ShowQuestion("Confirmation",
                        "Do you want to continue to save?",
                        errorMessage, Environment.NewLine));

                    if (appMessageBoxResult == AppMessageBoxResult.Yes)
                    {
                        if (customerInformation != null)
                        {
                            //Assigning value to variable and saving
                            RefreshData();
                        }
                    }
                    errorMessage.Clear();
                }
            }
        }
        catch (Exception exception)
        {
    AppMessageBox.ShowException("Error", exception.Message, 
               exception.InnerException.Message, exception);
        }
        finally
        {
            this.Cursor = currentCursor;
            this.btnSave.Enabled = true;
        }

此处AppMessageBox是我们的扩展MessageBox,是我们自定义框架的一部分。

1 个答案:

答案 0 :(得分:0)

我认为您在AppMessageBox中有焦点/模态对话框问题