Hi,
You have to create a class that inherits from datagrid for that. Here
is an example. Hope this helps.
Dim ds As New DataSet
Dim dg As New NoResizeDataGrid
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strPath As String
strPath = System.IO.Path.GetDirectoryName( _
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
ds.ReadXml(strPath & "\Categories.xml")
With dg
.Location = New Point(10, 10)
.Visible = True
End With
Me.Controls.Add(dg)
dg.DataSource = ds.Tables(0)
End Sub
End Class
Public Class NoResizeDataGrid
Inherits DataGrid
Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
Dim hti As DataGrid.HitTestInfo = Me.HitTest(e.X, e.Y)
If hti.Type = DataGrid.HitTestType.ColumnResize Or hti.Type =
DataGrid.HitTestType.RowResize Then
Return 'no baseclass call
End If
MyBase.OnMouseDown(e)
End Sub
Public Sub New()
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As
System.Windows.Forms.MouseEventArgs)
Dim hti As DataGrid.HitTestInfo = Me.HitTest(e.X, e.Y)
If hti.Type = DataGrid.HitTestType.ColumnResize Or hti.Type =
DataGrid.HitTestType.RowResize Then
Return 'no baseclass call
End If
MyBase.OnMouseMove(e)
End Sub
End Class
Ken
-------------------