使DevExpress SimpleButton在运行时可见的问题

时间:2012-03-26 13:53:17

标签: c# winforms devexpress

我正在使用一些使用一些DevExpress控件的C#WinForms应用程序。我正在努力弄清楚为什么我不能通过将其'Visible属性设置为true来使隐藏的SimpleButton在运行时可见。我试图给控制焦点,刷新控件,刷新表单无济于事。我在调试器中注意到的一件事是,在语句btnAddJob.Visible = true之后,Visible属性仍为false。有什么想法吗?

    public AddPredefinedJobsForm(WorkOrder workOrder)
        : this()
    {
        currentWorkOrder = workOrder;
        // Here I am just getting the position to display the button
        btnAddJob.Location = new Point(btnNewJob.Location.X, btnNewJob.Location.Y);
        // Hiding the button that my hidden button will replace below
        btnNewJob.Visible = false;
        // Give my hidden button focus
        btnAddJob.Focus();
        // Make my hidden button Visible
        btnAddJob.Visible = true;
        // Refresh the button
        btnAddJob.Refresh();

        // Refresh the entire form
        this.Refresh();

    }

1 个答案:

答案 0 :(得分:0)

如果容器控件中有按钮(如Panel),则需要将容器的可见性设置为True,以便其子控件可见。