I am working on a C# WinForms application that uses some DevExpress controls. I am struggling to figure out why I cannot make a hidden SimpleButton visible at runtime by setting its’ Visible property to true. I’ve attempted to give the control focus, refresh the control, refresh the form to no avail. One thing that I have noticed in the debugger is that after the statement btnAddJob.Visible = true, the Visible property is still false. Any ideas?
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();
}
If you have the button inside of a container control (like a Panel), you’ll need to set the container’s visibility to
Truein order for its child controls to be visible.