0
votes

I have a DataGridView control docked in Panel1 of a SplitContainer (docked into the form) which has Panel2 Fixed.

I'm trying to preview User resizing of the DataGridView Control. The two Events raised when the DataGridView border is dragged are Resize and ClientSizeChanged.

There isn't an e.Handled property or similar that I can cancel out the action, there doesn't seem to be any Property associated with the Control EventArgs that stops User resizing the DataGridView Control.

I only want to allow resizing of both controls when the Form is resized.

Any ideas?

1

1 Answers

0
votes

If I understand correctly the answer is very simple: don't use a SplitContainer.

You can use:

  • a Panel docked to Right or Left
  • a DataGridView to Fill the empty space

If you want more 'control' over Panel.Size you can use Resize event of your Form.

Private Sub yourForm_Resize(sender As Object, e As System.EventArgs) Handles Me.Resize
    Me.Panel.Width = Me.Width * 0.2
End Sub