10786 : Event when grid row is resized

Question

I use the following code to draw horizontal lines on the TimeItemArea.


private void gantt1_OnTimeItemAreaPaintBackground(OffscreenDraw aOffscreenDraw, OffscreenDrawArgs e)
{
  for (int i = 0; i < gantt1.Grid.GridStructure.RootNodes.Count; i++)
  {
    Rectangle rect = gantt1.Grid.GridStructure.RootNodes[i].Rect();
    Debug.Print(rect.Top.ToString() + " " + rect.Left.ToString());
    e.G.DrawLine(new Pen(new SolidBrush(Color.DeepSkyBlue)), aOffscreenDraw.CalcLeft, rect.Top, aOffscreenDraw.CalcRight, rect.Top);
  } 
}

What event is fired when a user resizes the height of a grid row to update the lines?

Answer

Grid.OnRowResize, this event was introduced recently and is not currently in the help file.

10980 : Changing all row heights when one row is changing

Question

I tried to use the OnRowResize event to change all rows while one was changing. The grid starts to flicker and behave weird when doing this…

Answer

To solve this we introduced a new event.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

New event added OnRowResizeDone

 

Event fires when user has resized a row.

You can implement this event to do other changes that you want as a result of a row height change,

like if you want to change all other Grid rows the same way.

 

This event is available from 3.0.9.1

 

So your code can look like this:

 

    /// <summary>

    /// This sample show how to detect a user row height change and how to change all the rows

    /// alike after the user has released the mouse button.

    /// </summary>

    void Grid_OnRowResizeDone(Grid aGrid, RowResizeDoneArgs e)

    {

      for (int i = 0; i < aGrid.GridStructure.RootNodes.Count; i++)

      {

        aGrid.GridStructure.RootNodes[i].UserRowHeight = e.GridNode.Rect().Height;

      }

    }

 

10679 : Is there an event that it fires when a row width is changed by a gui-action (not if you set it by code)?

Question

Is there an event that it fires when a row width is changed by a gui-action (not if you set it by code)?

Answer

Yes, Gantt.Grid.OnRowResize

Sample in VB.NET:


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

  AddHandler Gantt1.Grid.OnRowResize, AddressOf My_OnRowResize ' add an event handle thru code 

  Gantt1.Grid.Columns.AddNew(PlexityHide.GTP.CellType.SingleText)
  Gantt1.Grid.RootNodes.AddNode()
  Gantt1.Grid.RootNodes.AddNode()
  Gantt1.Grid.RootNodes.AddNode()

End Sub

' Implement the eventhandler
Private Sub My_OnRowResize(ByVal aGrid As PlexityHide.GTP.Grid, ByVal e As PlexityHide.GTP.RowResizeArgs)
  ' If the row is getting higher than 50 pixels we stop it from growing further
  If e.Delta > 0 And e.GridNode.Rect.Height > 50 Then
    e.Delta = 0
  End If
End Sub