fork download
  1. using System;
  2.  
  3. using System.Collections.Generic;
  4.  
  5. using System.ComponentModel;
  6.  
  7. using System.Data;
  8.  
  9. using System.Drawing;
  10.  
  11. using System.Linq;
  12.  
  13. using System.Text;
  14.  
  15. using System.Windows.Forms;
  16.  
  17.  
  18.  
  19. namespace WindowsFormsApplication1
  20.  
  21. {
  22.  
  23. public partial class Form1 : Form
  24.  
  25. {
  26.  
  27. private Form2 mForm2;
  28.  
  29.  
  30.  
  31. public Form1()
  32.  
  33. {
  34.  
  35. InitializeComponent();
  36.  
  37. }
  38.  
  39.  
  40.  
  41. private void button1_Click(object sender, EventArgs e)
  42.  
  43. {
  44.  
  45. if (mForm2 == null)
  46.  
  47. {
  48.  
  49. mForm2 = new Form2();
  50.  
  51. mForm2.Show();
  52.  
  53. mForm2.FormClosed += new FormClosedEventHandler(mForm2_FormClosed);
  54.  
  55. }
  56.  
  57. }
  58.  
  59.  
  60.  
  61. void mForm2_FormClosed(object sender, FormClosedEventArgs e)
  62.  
  63. {
  64.  
  65. mForm2 = null;
  66.  
  67. }
  68.  
  69.  
  70.  
  71. private void DockForm(Form f)
  72.  
  73. {
  74.  
  75. if (tabPage1.Controls.Contains(f)) return;
  76.  
  77. f.TopLevel = false;
  78.  
  79. f.FormBorderStyle = FormBorderStyle.None;
  80.  
  81. tabPage1.Controls.Add(f);
  82.  
  83. f.Dock = DockStyle.Fill;
  84.  
  85. }
  86.  
  87.  
  88.  
  89. private void button2_Click(object sender, EventArgs e)
  90.  
  91. {
  92.  
  93. if (mForm2 != null) DockForm(mForm2);
  94.  
  95. }
  96.  
  97. }
  98.  
  99. }
  100.  
  101.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty