We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Preventing from Resizing Datagrid Columns

Thread ID:

Created:

Updated:

Platform:

Replies:

361 Jun 11,2002 06:12 PM Jun 12,2002 12:10 AM Windows Forms 1
loading
Tags: FAQ
Administrator [Syncfusion]
Asked On June 11, 2002 06:12 PM

You have suggested this solution in the Windows Forms FAQ. However, it is not working for me or shall I say that I don't really know how to implement it in my code. I just added a new Class in my project and added the code below. Nothing happens. Should I be calling the class from somewhere? Public Class MyDataGrid Inherits DataGrid Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs) Dim hti As DataGrid.HitTestInfo = Me.HitTest(New Point(e.X,e.Y)) If hti.Type = DataGrid.HitTestType.ColumnResize Then Return 'no baseclass call End If MyBase.OnMouseMove(e) End Sub End Class

Clay Burch [Syncfusion]
Replied On June 12, 2002 12:10 AM

If you have dropped a datagrid onto your form with the designer, then this datagrid is defined as Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid and created with this code Me.DataGrid1 = New System.Windows.Forms.DataGrid() So, the grid being displayed is NOT your MyDataGrid class, but the Systems.Windows.Forms.DataGrid. What you have to do is to make your code use your class. One way to do this is to just change the two statements (even though there are dire warnings about doing so as this code is part of the designer created code). Friend WithEvents DataGrid1 As MyDataGrid and Me.DataGrid1 = New MyDataGrid()

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;