using System; using System.Windows.Forms; using System.Collections.Generic; using System.Drawing; public class Test { static void Main() { Application.Run(new ReportDialogForm()); } } class ReportDialogForm : Form { public ReportDialogForm() { tabControl1 = new TabControl(); tabPage1 = new TabPage(); reportListBox = new ListBox(); tabControl1.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); tabControl1.Controls.Add(tabPage1); tabControl1.Location = new Point(0, 0); tabControl1.Padding = new Point(0, 0); tabControl1.SelectedIndex = 0; tabControl1.Size = new Size(591, 296); tabControl1.TabIndex = 0; tabPage1.Controls.Add(reportListBox); tabPage1.Location = new Point(4, 29); tabPage1.Margin = new Padding(0); tabPage1.Size = new Size(583, 263); tabPage1.TabIndex = 0; tabPage1.Layout += new LayoutEventHandler(tabPage1_Layout); reportListBox.Anchor = AnchorStyles.None; reportListBox.Size = new Size(287, 384); reportListBox.TabIndex = 1000; ClientSize = new Size(588, 292); Controls.Add(tabControl1); for (int i = 0; i < 100; i++) reportListBox.Items.Add( "MMMMMMMMMMMMMMMMMMMMMM"); Load += new EventHandler(ReportDialogForm_Load); } void ReportDialogForm_Load(object sender, EventArgs e) { StartPosition = FormStartPosition.Manual; Location = new Point(10, 10); ClientSize = new Size(400, 400); } void tabPage1_Layout(object sender, LayoutEventArgs e) { SuspendLayout(); int height = 100; reportListBox.Top = height; reportListBox.Height = tabPage1.Height - height; reportListBox.Width = tabPage1.Width / 2; reportListBox.Left = 0; ResumeLayout(); } TabControl tabControl1; TabPage tabPage1; ListBox reportListBox; }