public TableView() { InitializeComponent(); sfx = FormUtils.GetDpiScale(CreateGraphics()); InitializeComponent2(); scaleFactorComboBox.SelectedIndex = 3; tableView = new CompoundScrollableControl { Dock = DockStyle.Fill, Margin = new Padding(0) }; tableViewWf = new TableViewControlModel(this); tableView.Client = tableViewWf; tableViewWf.SelectionChanged += (sender, args) => { SelectionChanged?.Invoke(sender, args); SetCounts(); }; mainPanel.Controls.Add(tableView); textButton.Click += TextButton_OnClick; selectionAgentButton.Click += SelectionAgentButton_OnClick; KeyDown += (sender, args) => tableView.Focus(); auxTextBox = new TextBox { Dock = DockStyle.Fill, Padding = new Padding(0), Multiline = true, ReadOnly = true }; scaleFactorComboBox.SelectedIndexChanged += (sender, args) => { switch (scaleFactorComboBox.SelectedIndex) { case 0: tableViewWf.UserSf = 0.25f; break; case 1: tableViewWf.UserSf = 0.5f; break; case 2: tableViewWf.UserSf = 0.7f; break; case 3: tableViewWf.UserSf = 1f; break; case 4: tableViewWf.UserSf = 1.5f; break; case 5: tableViewWf.UserSf = 2f; break; case 6: tableViewWf.UserSf = 4f; break; } tableViewWf.UpdateScaling(); tableView.Invalidate(true); }; }