10872 : If I a timeitem by clicking it how can i the coresponding row in the grid?

Question

If I select a timeitem by clicking it how can i select the coresponding row in the grid?

Answer

Implement OnTimeItem_SelectionChanged and go like this:

    private void gantt1_OnTimeItem_SelectionChanged(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
    {
      if (e.TimeItem.Selected)
      {        
        gantt1.Grid.GridStructure.ClearSelections();
        gantt1.Grid.GridStructure.FocusedCell=e.TimeItem.GanttRow.GridNode.GetCell(0);
      }
    }

10624 : The grid border style cannot be change when change to version 2.3.1.20 (GTP.Net)

Question

The grid border style cannot be change when change to version 2.3.1.20 (GTP.Net)

 

Answer

BorderStyle: The grid.BorderStyle demanded us to override the ControlParams. This is regarded as unsafe and was the last thing that stopped the entire GTP.NET to be regarded as a package of components that need no extra trust. We removed the Border implementation for this reason and we have currently no replacement for it. The gain was that you can embed the GTP.NET in a IE5 and IE6 and run a user control with zero trust (internet zone). Sample found here  http://www.plexityhide.nu/IEHostedGantt/Default.htm   (requires .NET 2.0 on client and late IE version).< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

Sorry for the inconvenience…

 

To workaround this limitation you can implement the Grid.OnOffscreenPaintBackground event and draw a border yourself (normally the border requires the grid to be two pixels wider and two pixels higher and we have no workaround to facilitate this)

10602 : Multi page print with scaling in GTP.NET

Multi page print with scaling in GTP.NET

If you want to scale your print you can do that very easily by applying a scaleTransform to the Graphics object.

 

This sample looks very much like the other samples for multi page print, but this will use the scale 0.5 and will fit twice as much Gantt rows to a single page.

Using a scaletransform ensures that the fonts used get scaled along with all the other graphics.


    private void buttonPrintWithScaling_Click(object sender, EventArgs e)
    {
      try
      {
        // Assumes the default printer.
        PrintDocument pd = new PrintDocument();
        pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPageWithScaling);
        pd.BeginPrint += new PrintEventHandler(this.pd_BeginPrint);
        pd.EndPrint += new PrintEventHandler(this.pd_EndPrint);
        printPreviewDialog1.Document = pd;
        printPreviewDialog1.ShowDialog(this);

      }
      catch (Exception ex)
      {
        MessageBox.Show("An error occurred while printing", ex.ToString());
      }
    }

    private void pd_PrintPageWithScaling(object sender, PrintPageEventArgs e)
    {
       Rectangle r = new Rectangle(e.MarginBounds.Location, e.MarginBounds.Size);
       float scalingApplied = 0.5F; // Make it half size
       e.Graphics.ScaleTransform(scalingApplied, scalingApplied);
       // If it is half as big we get twice the space -> make the rect bigger
       r = new Rectangle((int)(r.X / scalingApplied), (int)(r.Y / scalingApplied), (int)(r.Width / scalingApplied), (int)(r.Height / scalingApplied));
       
       bool aHasMorePages=false;
       gantt1.PrintPage(e.Graphics, r, gantt1.GridWidth /* just as on screen */, gantt1.DateScalerHeight /* just as on screen */, ref aHasMorePages);
       e.HasMorePages=aHasMorePages;
       
     }

    public void pd_BeginPrint(object sender,   PrintEventArgs e)
    {
        gantt1.PrintInit(null);
    }
    
    public void pd_EndPrint(object sender,PrintEventArgs e)
    {
      gantt1.PrintEnd();
    }

10620 : Drag in grid

Question

Can you tell me if it is possible to implement drag and drop of rows in the grid area?  I can’t see any built-in support but any advice would be much appreciated, we need to be able to drag rows within a “sibling” array and also between “parents”

Answer

You can do drag & drop. In the general download look for a sample called Gantt_GridDragDrop.

You need to start the drag in OnMouseDown, and decide what to do in OnDragDrop…


		Private Sub gantt1_OnGridMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
		  If Not gantt1.Grid.GridStructure.FocusedCell Is Nothing Then
			gantt1.Grid.StopRowResize()
			  gantt1.DoDragDrop(gantt1.Grid.GridStructure.FocusedCell.Content.Value.ToString(), DragDropEffects.All)
		  End If
		End Sub

		Private Sub gantt1_OnGridDragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)
		  ' Drag drop events return screen coordinates. 
		  ' You must convert it to a Client coordinate before using it in GTP.NET
		  Dim localpoint As Point=gantt1.Grid.PointToClient(New Point(e.X,e.Y))
		  Dim cell As Cell=gantt1.Grid.GridStructure.CellFromXY(localpoint.X,localpoint.Y)
		  If Not cell Is Nothing AndAlso Not cell.Node.ParentNode Is Nothing AndAlso Not gantt1.Grid.GridStructure.FocusedCell Is Nothing Then
				gantt1.Grid.GridStructure.FocusedCell.Node.MoveNode(cell.Node.ParentNode,cell.Node.Index)
		  End If
		End Sub

		Private Sub gantt1_OnGridDragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)
			If e.Data.GetDataPresent(DataFormats.Text) Then
				e.Effect = DragDropEffects.Move
			End If
		End Sub

		Private Sub gantt1_OnGridDragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)

			If e.Data.GetDataPresent(DataFormats.Text) Then
				e.Effect = DragDropEffects.Move
			Else
				e.Effect = DragDropEffects.None
			End If
		End Sub

       	Private Sub PrepareEvents()

	  AddHandler gantt1.OnGridDragDrop, AddressOf gantt1_OnGridDragDrop
	  AddHandler gantt1.OnGridDragEnter, AddressOf gantt1_OnGridDragEnter
	  AddHandler gantt1.OnGridDragOver, AddressOf gantt1_OnGridDragOver
	  AddHandler gantt1.OnGridMouseDown, AddressOf gantt1_OnGridMouseDown

	End Sub


10483 : Scroll the grid programatically so that it moves one node at a time when the next node in the list is not visible?

Question

Is there a way to scroll the grid programatically such that it moves one node at a time when the next node in the list is not visible? I have been trying to use MakeSureVisible but its not completely accurate and it causes the scroll bar to jump by a large increment.

Answer

You can control the TopNode set in the Grid by setting the Gantt.Grid.Gridstructure.TopNode.

Also from the very latest release you can access the scrollbars with Gantt.Grid.ScrollbarNodes (returns a Scrollbar)

 

10535 : Is it possible to get the edit windows (SingleEdit, DateTime, ComboText, etc) to appear in the middle of the cell?

Question

Is it possible to get the edit windows (SingleEdit, DateTime, ComboText, etc) to appear in the middle of the cell? My Cell layouts have their alignments to be
Horizontal: Center
Vertical: Center

When the edit starts, the editor appears top aligned with the cell, which can leave the cell text visible if the cell is taller than normal (eg capable of showing 3 lines of text)

Answer

From version 2.3.1.15  the CellLayout.VertAlign is taken into account when placing the DateTimePicker and the ComboBox. The SingleText edit looks at the CellLayout.HorzAlign

10479 : I use ontimeitem_userdraw to draw timeitems of custom shape. How do I make the mouse selection area match the custom shape of the timeitem?

Question

I use ontimeitem_userdraw to draw timeitems of custom shape.  How do I make the mouse selection area match the custom shape of the timeitem? 

Thanks

Answer

You implement the OnTimeItem_UserDrawBounds event, and return the e.BoundingRegion.

Nice to hear that you use these rather advanced details of the GTP.NET!

10478 : I was wondering if there is a way too have the gantt row associated with the grid item highlight when its grid item is selected?

Question

I am currently trying an evaluation copy of your control. I was wondering if there is a way too have the gantt row associated with the grid item highlight when its grid item is selected?

Answer

There is no such automatic function, sorry. But the workaround (yes there is always a workaround) is to implement the OnTimeItemAreaPaintBackground, and simply draw something in the GanttRow rectangle that belongs to the GridNode currently selected.

The code below draws a red frame on the gantt row that is owned by the focused grid node…


    private void gantt1_OnTimeItemAreaPaintBackground(PlexityHide.GTP.OffscreenDraw aOffscreenDraw, PlexityHide.GTP.OffscreenDrawArgs e)
    {
      if (gantt1.Grid.GridStructure.FocusedCell!=null )
      {        
        Rectangle r=Gantt.GanttRowFromGridNode(gantt1.Grid.GridStructure.FocusedCell.Node).Rect();
        e.G.DrawRectangle(new Pen(Color.Red,3),r);
      }
    }

10369 : Capability to accept user events on the interface, like moving or creating task bars or editing parameters in web gantt.

Question

We’re developing a project management system, full-web, using a knowledge-based development platform, that can generate the programming code in C# or Java (among others). I mean, our system will be multi-platform… And we can integrate external components is this platform.

So, we’re looking for Gantt chart solutions, web enabled, to integrate to our software. One important aspect is the capability to accept user events on the interface, like moving or creating task bars or editing parameters.

How your solutions can met these problems?

Thansk in advance.

Answer

First: Our windows forms Gantt handles all thinkable user interaction events and then some.

About the Gantt_ASP for web deployment: Currently the Gantt_ASP is much restricted in drag and drop operations and other user interactions, we catch clicks to single time items or Gantt rows. These events can be used to bring up dialogs with information that the user can change with text boxes (developer work needed).

We do handle everything presentation wise, like zooming, scrolling, time item collision etc, but the web being such as it is we are restricted in user interactions.

The possibility to include a client side control is always there but that would require downloads and also probably restrict the supported browser.

10349 : Frame-width in the TimeItem in GTP.NET?

Question

Hi all,
It is possible to change the size of Frame in the TimeItem in GTP.NET? Something like .FrameColor…

Answer

Currently there is no property to control the drawn FrameWidth on the TimeItemLayout. Putting it on the todo list… If you want it be zero, you can set  TimeItemLayout.FrameColor=TimeItemLayout.Color.

Other than that I suggest that you go with a user drawn time item. You can then draw a standard time item with the TimeItemDraw.Draw call, and then frame the time item with your own width-frame.