private void buttonOpenChildFormClick(object sender, EventArgs e)
 {
     using (var childForm = new ChildForm(this))
     {
         childForm.ShowDialog();
     }
 }
Exemplo n.º 2
0
    private void button1_Click(object sender, EventArgs e)
    {
        ChildForm first = new ChildForm();

        first.Number = 1;
        first.Show();
    }
Exemplo n.º 3
0
        private void FormChild <ChildForm>() where ChildForm : Form, new()
        {
            Form formCenter;

            formCenter = PanelCenter.Controls.OfType <ChildForm>().FirstOrDefault();
            if (formCenter == null)
            {
                formCenter          = new ChildForm();
                formCenter.TopLevel = false;
                PanelCenter.Controls.Add(formCenter);
                formCenter.Dock = DockStyle.Fill;
                PanelCenter.Tag = formCenter;

                if (formCenter.Name == "frmHoSoNhanVien")
                {
                    if (IsSearch == true)
                    {
                        frmHoSoNhanVien.Action = "Tìm kiếm";
                        string MaNV = cbSearch.SelectedValue.ToString();
                        MaNV = MaNV.Split('-')[1];
                        frmHoSoNhanVien.MaNhanVien = Convert.ToInt32(MaNV.Trim());
                    }
                    else
                    {
                        frmHoSoNhanVien.Action = "Không tìm kiếm";
                    }
                }
                formCenter.Show();
                formCenter.BringToFront();
            }
            else
            {
                formCenter.BringToFront();
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Location changed.
 /// </summary>
 private void LoginForm_LocationChanged(object sender, EventArgs e)
 {
     if (ChildForm != null && ChildForm.Visible && ChildForm.Joined)
     {
         ChildForm.SetDesktopLocation(this.Location.X + this.Width, this.Location.Y);
     }
 }
    void openButton_Click(object sender, EventArgs e)
    {
        ChildForm childForm = new ChildForm();

        childForm.OKButtonClick += childForm_OKButtonClick;
        childForm.ShowDialog();
    }
Exemplo n.º 6
0
        private void sprOpenForm(string FormName)
        {
            string mlsFormName = FormName;

            try
            {
                FormType    = Type.GetType(mlsFormName, true, true);
                ObjFormName = (Form)Activator.CreateInstance(FormType);
                ObjFormName.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                foreach (Form ChildForm in this.MdiChildren)
                {
                    if (ChildForm.Name == ObjFormName.Name)
                    {
                        ChildForm.Show();
                        ChildForm.Activate();
                        Application.DoEvents();
                        ChildForm.BringToFront();
                        ChildForm.WindowState = FormWindowState.Normal;
                        ChildForm.Dock        = DockStyle.Fill;
                        return;
                    }
                }

                ObjFormName.MdiParent = this;
                ObjFormName.Show();
                Application.DoEvents();
                ObjFormName.BringToFront();
                ObjFormName.WindowState = FormWindowState.Normal;
                ObjFormName.Dock        = DockStyle.Fill;
            }
            catch (Exception ex)
            {
                MessageBox.Show("This module is under process", "Under Construction");
            }
        }
Exemplo n.º 7
0
 public ShowColumn(List <string> hidden, List <string> shown, ChildForm c)
 {
     InitializeComponent();
     Hiddenlist = hidden;
     Shownlist  = shown;
     child      = c;
 }
Exemplo n.º 8
0
 void ChangeCaption(ChildForm formParam)
 {
     // This will change openForm’s display text
     formParam.Text = "From name has now been changed";
     // No effect on openForm
     formParam = null;
 }
Exemplo n.º 9
0
 void ChangeCaption(ref ChildForm formParam)
 {
     // This will change openForm’s display text
     formParam.Text = "From name has now been changed";
     // This will destroy the openForm variable!
     formParam = null;
 }
Exemplo n.º 10
0
        public void ShowForm(string formName, Form MainForm)
        {
            ChildForm form = CreateForm(formName);

            form.MdiParent = MainForm;
            form.Show();
        }
Exemplo n.º 11
0
 //全部關閉
 private void Menu_3_CloseAll_Click(object sender, EventArgs e)
 {
     foreach (Form ChildForm in this.MdiChildren)
     {
         ChildForm.Close();
     }
 }
Exemplo n.º 12
0
        private void newWindowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ChildForm child = new ChildForm();

            child.MdiParent = this;
            child.Show();
        }
Exemplo n.º 13
0
 public virtual void OpenForm(Form mdiParent = null)
 {
     Create();
     ChildForm.MdiParent = mdiParent;
     ChildForm.Show();
     StageStatusChanged?.Invoke(this, StageStatus.OpenedForm);
 }
Exemplo n.º 14
0
        public void button1_Click(object sender, EventArgs e)
        {
            ChildForm newChild = new ChildForm();

            newChild.MdiParent = this;
            newChild.Show();
        }
Exemplo n.º 15
0
    private void btnAddWindow_Click(object sender, System.EventArgs e)
    {
        // Are any text fields blank?
        if (txtLeft.Text.Length == 0 || txtTop.Text.Length == 0 ||
            txtWidth.Text.Length == 0 || txtHeight.Text.Length == 0)
        {
            MessageBox.Show("Please fill in all text boxes",
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
            return;
        }

        ChildForm aChildForm = new ChildForm();

        aChildForm.Owner         = this;
        aChildForm.DesktopBounds = new Rectangle(
            Int32.Parse(txtLeft.Text),
            Int32.Parse(txtTop.Text),
            Int32.Parse(txtWidth.Text),
            Int32.Parse(txtHeight.Text));
        aChildForm.Show();

        // Create a new delegate for the child form's Repaint method
        ChangeColorDelegate newDelegate = new ChangeColorDelegate(aChildForm.Repaint);


        // Combine new delegate into the multicast delegate
        mAllRepaintMethods = (ChangeColorDelegate)System.Delegate.Combine(mAllRepaintMethods,
                                                                          newDelegate);

        // Use multicast delegate to count the child forms
        sbStatus.Text = "Created child form " +
                        mAllRepaintMethods.GetInvocationList().Length + ".";
    }
 private void buttonOpenChildFormClick(object sender, EventArgs e)
 {
     using (var childForm = new ChildForm(this))         //send this reference of MainForm to ChildForm
     {
         childForm.ShowDialog();
     }
 }
Exemplo n.º 17
0
 private void ShowChildForm( )
 {
     using (ChildForm frm = new ChildForm())
     {
         frm.SomeEvent += frm_SomeEvent;
         frm.ShowDialog();
     }
 }
Exemplo n.º 18
0
	void MainForm_Load (object sender, EventArgs e)
	{
		IsMdiContainer = true;

		ChildForm child = new ChildForm ();
		child.MdiParent = this;
		child.Show ();
	}
Exemplo n.º 19
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ChildForm document = new ChildForm();

            document.MdiParent = this;
            document.Text      = "Document" + this.MdiChildren.Length;
            document.Show();
        }
Exemplo n.º 20
0
    private void button1_Click(object sender, EventArgs e)
    {
        ChildForm childForm01 = new ChildForm();

        childForm01.doTheSizing();
        // now show the child window using Show() or ShowDialog().
        childForm01.ShowDialog();
    }
Exemplo n.º 21
0
 void ShowChildForm( )
 {
     using( ChildForm frm = new ChildForm() )
     {
         frm.SaveData += frm_SaveData;
         frm.ShowDialog();
     }
 }
Exemplo n.º 22
0
    private void button2_Click(object sender, EventArgs e)
    {
        ChildForm c = new ChildForm();

        c.StringValue = "TADA";
        c.IntValue    = 42;
        c.Show();
    }
Exemplo n.º 23
0
    private void button1_Click(object sender, EventArgs e)
    {
        panel1.Visible = false;
        ChildForm childForm = new ChildForm();

        childForm.MdiParent = this;
        childForm.Show();
    }
Exemplo n.º 24
0
    private void button1_Click(object sender, EventArgs e)
    {
        ChildForm child = new ChildForm();

        child.FormClosing += new FormClosingEventHandler(child_FormClosing);
        Hide();
        child.Show();
    }
Exemplo n.º 25
0
        private void NewMenuItem_Click(object sender, EventArgs e)
        {
            ChildForm newChild = new ChildForm();

            newChild.MdiParent = this;
            newChild.Show();
            newChild.Text = newChild.Text + " " + ++openDocuments;
        }
Exemplo n.º 26
0
 private void mnuProzoriZatvoriSve_Click(object sender, EventArgs e)
 {
     foreach (Form ChildForm in this.MdiChildren)
     {
         ChildForm.Focus();
         ChildForm.Close();
     }
 }
    protected override void OnLoad(EventArgs e)
    {
        var form = new ChildForm();

        form.Load   += form_Load;
        form.Closed += form_Closed;
        base.OnLoad(e);
    }
Exemplo n.º 28
0
	void MainForm_Load (object sender, EventArgs e)
	{
		Form frm = new ChildForm ();
		frm.MdiParent = this;
		frm.Show ();

		InstructionsForm instructionsForm = new InstructionsForm ();
		instructionsForm.Show ();
	}
    private void button1_Click(object sender, EventArgs e)
    {
        ChildForm cf = new ChildForm();

        cf.Show();
        string resp = cf.HellowWorld_mt(" extra!");

        this.Text = resp;
    }
Exemplo n.º 30
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (_OtherForm == null || _OtherForm.IsDisposed)
     {
         _OtherForm              = new ChildForm();
         _OtherForm.DisableBase += new ChildForm.DisableBaseHandler(DisableMe);
     }
     _OtherForm.Show();
 }
    private void button1_Click(object sender, EventArgs e)
    {
        ChildForm child = new ChildForm();

        // KeyPreview can be set in the properties of the child form instead
        child.KeyPreview  = true;
        child.KeyPressed += Child_KeyPressed;
        child.ShowDialog();
    }
Exemplo n.º 32
0
	void OpenMenuItem_Click (object sender, EventArgs e)
	{
		ChildForm child = new ChildForm ();
		child.MdiParent = this;
		child.Text = "Child " + _childFormNumber++;
		child.Activated += new EventHandler (ChildForm_Activated);
		child.Deactivate += new EventHandler (ChildForm_Deactivate);
		child.Show ();
	}
    private void button_Click(object sender, EventArgs e)
    {
        ChildForm _childForm = new ChildForm();

        _childForm.Owner  = this;
        _childForm.Number = this.Number + 1;
        this.Hide();
        _childForm.Show();
    }
Exemplo n.º 34
0
	void MainForm_Load (object sender, EventArgs e)
	{
		ChildForm child = new ChildForm ();
		child.ClientSize = new Size (150, 50);
		child.MdiParent = this;
		child.Show ();

		InstructionsForm instructionsForm = new InstructionsForm ();
		instructionsForm.Show ();
	}
        private void NewWindowToolStripMenuItemClick(object sender, EventArgs e)
        {
            var child = new ChildForm {MdiParent = this};

            var observable = _bus.Observe<GeoLocationItem>();
            observable.Subscribe(child);

            child.Tag = observable;
            child.FormClosed += ChildFormClosed;
            child.Show();
        }
Exemplo n.º 36
0
	void MainForm_Load (object sender, EventArgs e)
	{
		ChildForm childA = new ChildForm ();
		childA.MdiParent = this;
		childA.Text = "Child A";
		childA.Show ();

		ChildForm childB = new ChildForm ();
		childB.MdiParent = this;
		childB.Text = "Child B";
		childB.Show ();

		ChildForm childC = new ChildForm ();
		childC.MdiParent = this;
		childC.Text = "Child C";
		childC.Show ();

		InstructionsForm instructionsForm = new InstructionsForm ();
		instructionsForm.Show ();
	}
Exemplo n.º 37
0
	void ShowDialogButton_Click (object sender, EventArgs e)
	{
		ChildForm child = new ChildForm ();
		child.Closed += new EventHandler (ChildForm_Closed);
		child.ShowDialog ();
	}
Exemplo n.º 38
0
	void ShowNewForm (object sender, EventArgs e)
	{
		ChildForm child = new ChildForm ();
		child.MdiParent = this;
		child.Text = "Window " + childFormNumber++;
		child.Show ();
	}
Exemplo n.º 39
0
	void NewToolStripMenuItem_Click (object sender, EventArgs e)
	{
		ChildForm child = new ChildForm ();
		child.MdiParent = this;
		child.Text = "Child " + (++formCount).ToString (CultureInfo.InvariantCulture);
		child.Show ();
	}
Exemplo n.º 40
0
			public void Test () {
				using (Form main = new Form ()) {
					main.IsMdiContainer = true;
					main.ShowInTaskbar = false;
					main.Visible = true;

					ChildForm child = new ChildForm ();
					EventLogger log = new EventLogger (child);
					child.MdiParent = main;
					child.Visible = true;
					child.Close ();
					
					Assert.AreEqual (1, log.CountEvents ("Closed"), "#01");
					Assert.AreEqual (1, log.CountEvents ("Closing"), "#02");
					Assert.IsNull (child.MdiParent, "#03");
					Assert.AreEqual (0, main.MdiChildren.Length, "#04");		
					Assert.AreEqual (false, child.IsMdiChild, "#05");		
				}
			}
Exemplo n.º 41
0
	void ShowChildButton_Click (object sender, EventArgs e)
	{
		ChildForm child = new ChildForm ();
		child.Show ();
	}
Exemplo n.º 42
0
        private void btnCreateChild_Click(object sender, EventArgs e)
        {
            if (_originalSize.Height == 0 && _originalSize.Width == 0)
            {
                _originalSize = Size;
                Size = new Size(Size.Width, Size.Height * 2);

                this.IsMdiContainer = true;
            }

            Point location = new Point(10, _originalSize.Height - menuStrip1.Height - statusLabel.Height);
            _child = new ChildForm(this, location);
            _child.Show();
        }
Exemplo n.º 43
0
	void MainForm_Load (object sender, EventArgs e)
	{
		ChildForm f = new ChildForm ();
		f.MdiParent = this;
		f.Show ();
	}
Exemplo n.º 44
0
	void OpenFile (object sender, EventArgs e)
	{
		ChildForm child = new ChildForm ();
		child.MdiParent = this;
		child.Show ();
	}
Exemplo n.º 45
0
 protected virtual void OnPlusClick(object sender, DynamicListEventArgs e)
 {
     if (this.blockClickEvent)
     {
         this.blockClickEvent = false;
     }
     else
     {
         int num5;
         this.OnExpanding(e);
         ChildForm frm = new ChildForm();
         frm.Closed += delegate {
             this.blockClickEvent = true;
             if (this.expandedIn != null)
             {
                 this.expandedIn.Remove(e.List);
             }
             this.OnCollapsed(e);
             this.plus.RaiseItemChanged();
             Timer timer = new Timer {
                 Interval = 0x55
             };
             timer.Tick += delegate (object sender2, EventArgs e2) {
                 ((Timer) sender2).Stop();
                 ((Timer) sender2).Dispose();
                 this.blockClickEvent = false;
             };
             timer.Start();
         };
         Point point = e.List.PointToScreen(e.List.GetPositionFromRow(this));
         point.Offset(e.List.Columns[0].Width, base.Height);
         frm.StartPosition = FormStartPosition.Manual;
         frm.BackColor = this.childBorderColor;
         frm.Location = point;
         frm.ShowInTaskbar = false;
         frm.Owner = e.List.FindForm();
         VerticalScrollContainer container = new VerticalScrollContainer();
         container.Dock = DockStyle.Fill;
         DynamicList list = new DynamicList(this.childColumns, this.childRows);
         list.Dock = DockStyle.Fill;
         list.KeyDown += delegate (object sender2, KeyEventArgs e2) {
             if (e2.KeyData == Keys.Escape)
             {
                 frm.Close();
                 e.List.FindForm().Focus();
             }
         };
         container.Controls.Add(list);
         frm.Controls.Add(container);
         int num = Screen.FromPoint(point).WorkingArea.Bottom - point.Y;
         num -= frm.Size.Height - frm.ClientSize.Height;
         int num2 = list.TotalRowHeight + 4;
         int height = Math.Min(num2, num);
         if (height < num2)
         {
             int num4 = Math.Min(100, num2 - height);
             height += num4;
             frm.Top -= num4;
         }
         using (Graphics graphics = list.CreateGraphics())
         {
             num5 = 8 + list.GetRequiredWidth(graphics);
         }
         int num6 = Screen.FromPoint(point).WorkingArea.Right - point.X;
         if (num5 > num6)
         {
             int num7 = Math.Min(100, num5 - num6);
             num5 = num6 + num7;
             frm.Left -= num7;
         }
         frm.ClientSize = new Size(num5, height);
         frm.MinimumSize = new Size(100, Math.Min(50, height));
         isOpeningChild = true;
         frm.Show();
         isOpeningChild = false;
         list.Focus();
         if (this.expandedIn != null)
         {
             this.expandedIn.Add(e.List);
         }
         this.OnExpanded(e);
         this.plus.RaiseItemChanged();
     }
 }
Exemplo n.º 46
0
	void OpenFile (object sender, EventArgs e)
	{
		ChildForm child = new ChildForm ();
		child.MdiParent = this;
		child.Text = "Child " + childFormNumber++;
		child.Show ();
	}
Exemplo n.º 47
0
		protected virtual void OnPlusClick(object sender, DynamicListEventArgs e)
		{
			if (blockClickEvent) { blockClickEvent = false; return; }
			OnExpanding(e);
			// If OnExpanding displaies an error message, focus is lost, form is closed and we can not access the handle anymore
			if (e.List.IsDisposed) return;
			ChildForm frm = new ChildForm();
			frm.Closed += delegate {
				blockClickEvent = true;
				if (expandedIn != null)
					expandedIn.Remove(e.List);
				OnCollapsed(e);
				plus.RaiseItemChanged();
				Timer timer = new Timer();
				timer.Interval = 85;
				timer.Tick += delegate(object sender2, EventArgs e2) {
					((Timer)sender2).Stop();
					((Timer)sender2).Dispose();
					blockClickEvent = false;
				};
				timer.Start();
			};
			Point p = e.List.PointToScreen(e.List.GetPositionFromRow(this));
			p.Offset(e.List.Columns[0].Width, Height);
			frm.StartPosition = FormStartPosition.Manual;
			frm.BackColor = childBorderColor;
			frm.Location = p;
			frm.ShowInTaskbar = false;
			frm.Owner = e.List.FindForm();
			
			VerticalScrollContainer scrollContainer = new VerticalScrollContainer();
			scrollContainer.Dock = DockStyle.Fill;
			
			DynamicList childList = new DynamicList(childColumns, childRows);
			childList.Dock = DockStyle.Fill;
			childList.KeyDown += delegate(object sender2, KeyEventArgs e2) {
				if (e2.KeyData == Keys.Escape) {
					frm.Close();
					// workaround focus problem: sometimes the mainform gets focus after this
					e.List.FindForm().Focus();
				}
			};
			scrollContainer.Controls.Add(childList);
			
			frm.Controls.Add(scrollContainer);
			
			int screenHeight = Screen.FromPoint(p).WorkingArea.Bottom - p.Y;
			screenHeight -= frm.Size.Height - frm.ClientSize.Height;
			int requiredHeight = childList.TotalRowHeight + 4;
			int formHeight = Math.Min(requiredHeight, screenHeight);
			if (formHeight < requiredHeight) {
				int missingHeight = Math.Min(100, requiredHeight - formHeight);
				formHeight += missingHeight;
				frm.Top -= missingHeight;
			}
			// Autosize child window
			int formWidth;
			using (Graphics g = childList.CreateGraphics()) {
				formWidth = 8 + childList.GetRequiredWidth(g);
			}
			int screenWidth = Screen.FromPoint(p).WorkingArea.Right - p.X;
			if (formWidth > screenWidth) {
				int missingWidth = Math.Min(100, formWidth - screenWidth);
				formWidth = screenWidth + missingWidth;
				frm.Left -= missingWidth;
			}
			frm.ClientSize = new Size(formWidth, formHeight);
			frm.MinimumSize = new Size(100, Math.Min(50, formHeight));
			isOpeningChild = true;
			frm.Show();
			isOpeningChild = false;
			childList.Focus();
			if (expandedIn != null)
				expandedIn.Add(e.List);
			OnExpanded(e);
			plus.RaiseItemChanged();
		}
Exemplo n.º 48
0
	void MainForm_Load (object sender, EventArgs e)
	{
		Form child = new ChildForm ();
		child.MdiParent = this;
		child.Show ();
	}