Re: Datagrid Column widths (VB.NET) -
01-24-2005
, 07:04 AM
Hi,
Try something like this is the datagrid mouse move
event.
Private Sub DataGrid1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseMove
Dim hti As DataGrid.HitTestInfo
hti = DataGrid1.HitTest(e.X, e.Y)
If hti.Type = DataGrid.HitTestType.ColumnResize Then
Debug.WriteLine(String.Format("Resized Column {0}", hti.Column))
End If
End Sub
Ken
-------------------
"spongebob-straight-pants" <asd (AT) asd (DOT) com> wrote
Hi,
I apologize if this was discussed before but I could not find a solution
that worked by looking through these NGs.
If I made the DG resizeable, the user resizes it in run time and the form is
reloaded, the column widths are setting back to their default values. How
would I prevent that (in other words, have the resized width persist??)
I tried this code with a module level variable marr() but I have no idea on
where to place this code? Is there a resize event that fires when the
columns are resized? There is a resize event but that does not get fired
when the columns are resized.
'Dim idx As Integer
'With dgLocations.TableStyles(0)
' ReDim marrCol(.GridColumnStyles.Count - 1)
' For idx = 0 To .GridColumnStyles.Count - 1
' marrCol(idx) = .GridColumnStyles(idx).Width
' Next idx
'End With |