Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can you set the default size of a popup form with which the Popup Editor shows up when you invoke it from a Property Grid.

In Mypropertygrid I am opening a winform. when the button [...] which you press it pops up a winform.

my form is apprearing maximized.
In my form properties I have set the windowstate to normal and disabled the maximized button for the form.
how to set the propertygrid popup form to normal size?

What I have tried:

I have tried this .
Its not working
C#
if (formType.IsAssignableFrom(m_EditControl.GetType()))
{
    Form EditForm = (Form)m_EditControl;
    System.Drawing.Rectangle resolutionRect =  System.Windows.Forms.Screen.FromControl(EditForm).Bounds;
    EditForm.WindowState = FormWindowState.Normal;
    if (EditForm.Width >= resolutionRect.Width || EditForm.Height >= resolutionRect.Height)
    {
        EditForm.WindowState = FormWindowState.Normal;
    }

    m_EditControl = (Control)EditForm;
    IEditorService.ShowDialog((Form)m_EditControl);
}
Posted
Updated 13-Mar-18 3:26am
v2

1 solution

You're casting the form to a control before you're showing it. A control doesn't have the WindowState property.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900