public void InitializeComponent() { table = new TableLayoutPanel(); view = new ViewportPanel(); scroll = new VScrollBar(); scroll.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom; view.Dock = DockStyle.Fill; table.Dock = DockStyle.Fill; table.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); table.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 0)); table.RowCount = 1; table.ColumnCount = 2; table.Controls.Add(view); table.Controls.Add(scroll); table.SetColumn(view, 0); table.SetColumn(scroll, 1); scroll.Scroll += (sender, e) => OnScroll(e); view.Paint += (sender, e) => OnPaint(e); Controls.Add(table); }