0

I created one class library file for visual inherited form for my project. In the class library project I take one form. In this form I take one panel control and its Modifiers property set to public. Now my this form's name is BaseEditDialog and the BaseEditDialog.cs file is as following:

namespace BaseObjects
{
    public partial class BaseEditDialog : System.Windows.Forms.Form
    {
        public BaseEditDialog()
        {
            InitializeComponent();
        }
        private void BaseEditDialog_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
        }
        public void BaseEditDialog_Resize(object sender, EventArgs e)
        {   
            panel1.Left = (this.ClientSize.Width - panel1.Width) / 2;
            panel1.Top = (this.ClientSize.Height - panel1.Height) / 2;
        }
    }
}

and in my actual project I take one inherited form selected with this BaseEditDialog.dll file

My first question:
but in this form when I move panel control it easily moves but when I resize my form then the panel control automatically move to the center of the form at the design time. I inherit this form because when my application actually run at run time at that time panel is automatically reside at the center position of the form. but in my problem at design time when I resize my form then panel is centered out of the form.

my second question:
I cannot able to resize my panel control at design time.

KDeogharkar
  • 10,939
  • 7
  • 51
  • 95
user3216114
  • 305
  • 4
  • 13

1 Answers1

0

You should probably check if you are in design mode in the Resize event. If you are in design mode you should take some extra actions. Maybe you shouldn't try to center then the panel then? Same goes for maximi,ing the form in the onload event. Here is how to tell if you are running in deaign mode: How to tell if .NET code is being run by Visual Studio designer

Community
  • 1
  • 1
Pavel Donchev
  • 1,809
  • 1
  • 17
  • 29
  • Thanks you. Pavel Donchev, i learned above link from that i got the answer of my first question but my second problem is that inherited form's panel is not resizing at design time means i am not able to resize it as with the mouse pointer to the border of the panel's pointers. but also we can resize it from the property window. so any code that i use and resize panel with the mouse. – user3216114 Apr 17 '14 at 06:42