Datagrid column Resizing event

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
 
M

Mona

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top