Reputation: 273
I create a form which makes lightbox effect.And after creating this lightbox form, i create another form.
//Execute from parent form
Form f = new Form();
f.ShowInTaskbar = false;
f.BackColor = Color.Black;
f.Size = this.Size;
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f.StartPosition = FormStartPosition.CenterParent;
f.Opacity = 0.6;
f.ShowDialog(); // Open Modal window
notificationSize nds = new notificationSize();
nds.Show(); // Open another form on Modal Dialog
After creating lightbox form, it doesn't show another form nds. Just showind the lightbox modal dialog.
how can i show the form on the modal form ?
Upvotes: 0
Views: 2824
Reputation: 39152
Display your "child" form by setting TopLevel
to false:
Form f = new Form();
f.ShowInTaskbar = false;
f.BackColor = Color.Black;
f.Size = this.Size;
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f.StartPosition = FormStartPosition.CenterParent;
f.Opacity = 0.6;
notificationSize nds = new notificationSize();
nds.TopLevel = false;
nds.FormBorderStyle = ... // you may want to set this to none
nds.Dock = ... // you may want to set this to fill
f.Controls.Add(nds);
nds.Show(); // Open another form on Modal Dialog
f.ShowDialog(); // Open Modal window
Upvotes: 2
Reputation:
Well i don't quite get what the purpose of this is but this will do the trick:
var f = new Form();
f.IsMdiContainer = true;
f.ShowInTaskbar = false;
f.BackColor = Color.Black;
f.Size = this.Size;
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f.StartPosition = FormStartPosition.CenterParent;
f.Opacity = 0.6;
var nds = new notificationSize();
nds.Show();
nds.MdiParent = f;
f.ShowDialog(); // Open Modal window
Upvotes: 1