Datagrid column Resizing event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
iam currently working on winforms and iam using a a datagrid. in that
when i click on the border of a column it adjusts itz width itself according
to the data of that column. What i want to know is what even is fireing when
i double click on the column border

thanks in advance
 
Hi Deepson,

To capture double click on the datagrid's column border for clumn resizing,
you can use HitTest method. The following example shows this:

Dim myHitTest As System.Windows.Forms.DataGrid.HitTestInfo

Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown

' Use the DataGrid control's HitTest method with the x and y properties.

myHitTest = DataGrid1.HitTest(e.X, e.Y)

End Sub

Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.DoubleClick

If myHitTest.Type = DataGrid.HitTestType.ColumnResize Then

MessageBox.Show("Column resized!")

End If

End Sub

Hope this helps. Have a nice day!

Mona [GrapeCity]
 
Back
Top