c# - How can i make that when i /drag/move form1 around the new form behind it will move with form1 on the same time? -


i don't want see new form. need him maximized , same size form1 not see it. when move/drag form1 around mouse need new form behind move/drag form1.

this button click event in form1 show new form:

private void beginoperationbut_click(object sender, eventargs e)         {             if (this.imagelist.count == 0)             {                 wbss = new webbrowserscreenshots();                 wbss.show();             }         } 

wbss new form.

i tried in new form designer set property locked true didn't change anything.

what want 2 things:

  1. the new form should show/start behind form1.
  2. the new form should locked when drag/move around form move new form also. not see new form form1.

the way when click button new form showing on in front of form1.

there lot of things need taken consideration make sure works intended. here snippet of code can use started:

public partial class followform : form {      readonly form _master;      private followform() {         initializecomponent();     }      public followform(form master) {         if (master == null)             throw new argumentnullexception("master");         _master = master;         _master.locationchanged += (s, e) => location = _master.location;         _master.sizechanged += (s, e) => size = _master.size;         showintaskbar = false;     }      protected override void onshown(eventargs e) {         base.onshown(e);         location = _master.location;         size = _master.size;         _master.activate();     }      protected override void onactivated(eventargs e) {         _master.activate();     } } 

i tried experimenting showwithoutactivation property, results not expected.

the main aspects tracking change of size or location of master form, , updating follower form's size , location accordingly. also, send follower form when shown , re-activating master form. give try. .net4.0 project, vs2013.

usage

public partial class masterform : form {      followform _follower;      public masterform() {         initializecomponent();     }      private void button1_click(object sender, eventargs e) {         _follower = new followform(this);         _follower.show();     } } 

for better approach no-activate feature, take at:


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -