10368 : XP visual styles

Question

What does one need to do to enable XP visual styles in the Scrollbars in the Grid in GTP.NET?

Answer

Make sure this is called in the application Main:

static void Main()
{
  Application.EnableVisualStyles();                      <– THIS
  Application.SetCompatibleTextRenderingDefault(false);   <– AND THIS
  Application.Run(new Form1());
}

 

10354 : When the dateScaler is zoomed in or out, is it possible to detect when the mode switch occurs?

Question

When the dateScaler is zoomed in or out, is it possible to detect when the mode switch occurs?

Answer

Currently there is no perfect way to detect mode switches. I have no oother explanation other than we have missed it. Sorry.

Workaround:

You can implement the event OnDateScalerDrawString of the DateScaler, in this events argument you will find a Resolution parameter (e.Resolution). That value is of type NonLinearTime.TimeResolution. You can remember the value of this (in a member variable) and fire your own event when it changes (it will be a mode switch).

10329 : What must I do to run the Gantt_Database sample?

Question

What do I do with the gtpnetdemo.bck file and what must I do to run the Gantt_Database sample?

Answer

To restore the database backup gtpnetdemo.bck you should have admin access to a sqlserver database, or a msde local installation (that you can download for free at microsoft).

Once you have that you can use the osql command prompt tool to restore the database.
(if you have sqlserver you probably will use the Enterprise Manager)

In the project folder you will find a file called Sample_OSQL_Commands.txt
It contains this info:

Start a cmd tool.

Start OSQL with:

OSQL -S <your msde or sqlserver server name> -E

To back up the database:

1> backup database gtpnetdemo to disk=’c:\temp\gtpnetdemo.bck’

2> go

 

To Restore the database (you will need to do this before running the sample):

1> restore database gtpnetdemo from disk =’c:\temp\gtpnetdemo.bck’ with replace

2> go

with replace is only needed if you already have a db with this name.

10336 : Spaces before and after a timeitemtext?

Question

Hi, is there a way to have spaces before and after a timeitemtext, so that it is completely readable and not hidden by the link arrow?

Answer

On the time item text layout you can set Padding to reduce the rect that the time item text is drawn in.

TimeItemText titext1=new TimeItemText(); 
titext1.Text=”Sample text”; 
//titext1.TimeItemTextLayout=new TimeItemTextLayout(); 
titext1.TimeItemTextLayout=gantt1.TimeItemTextLayouts.GetFromName(“Default”); 
titext1.TimeItemTextLayout.Color=Color.PowderBlue; 
titext1.TimeItemTextLayout.Font=new Font(FontFamily.GenericMonospace,14,FontStyle.Bold); 
titext1.TimeItemTextLayout.Padding=new Rectangle(2,2,2,2);  // the rect is reduced with 2 pixels all around
titext1.TimeItemTextLayout.VertAlign=StringAlignment.Near; 
ti1.TimeItemTexts.Add(titext1); 

10283 : I need to show activities that occur every x time in the graph: ex. every week

Question

I need to insert activities that occur every x time in the graph: ex. every week, every 3 days, every month, etc. I’ve seen the Gantt_DateDependentBackground example that has a similar behaviour but when i maximize the window, for example, the background is drawn also on the timeline. Also in that way the user is not able to select that objects in the graph and i’d need to implement a custom management of this activities for theirself

Answer

Using the techniques shown in the Gantt_DateDependentBackground sample is one way to go (this samples had some issues that has been corrected in newer assemblies, see the info node on download info), but you can also add separate time items to show these items. You can add them to another drawing layer if you want to control the z-order between these two types of time items. You can have one databound list of time items per time item layer.

But if you choose to go on the “dead-drawing” solution, you can still catch mouse events in the time item area and use the PixelToDate to convert a pixel on the time item area to the corresponding date time. This way you can calculate if the user clicked one of your drawn areas.

10284 : What about printing

Question

An important task for my customers is printing. I’ve seen in the knowledge base in the website that there’s a simple example on how to print but it prints only the current graph situation on screen. Usually i’d need to print from date to date, or print from the beginning of the graph page to page all in a time, without scrolling myself avery page and print many times. If it possible to do it can you add a simple example of that in the examples of the component package?

Answer

Printing is very important, we could not agree more. But printing is also very solution oriented, there must be a way to control every aspect of printing, like paging and size and integration of the pages of the Gantt into a slot on a printout filled with other data.

The developer needs to be free to break pages along the Y-Axis as well as the X-Axis.
The developer needs to be free to control Start and Stop in time (X-Axis) and control what nodes that should print (Y-Axis).

The printing functionality of GTP.NET allows for all of this since it is very flexible. The flexibility comes with the price of complexity.

To minimize the complexity we strictly print what is set to show in the Gantt. This does not mean that you cannot print from Date1 to Date2, but it means that you need to set the viewed area in the PrintPage method (Gantt.DateScaler.TimeSpanSet(Date1,Date2)), and if you change it back in the EndPrint to the original value, no one will be the wiser…

Below a sample of a print page event. Read the comment, it does a pretty good job to examplify the complexity involved…

private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{

      bool hasMorePages=false;
      Rectangle r=Rectangle.FromLTRB(20,20,ev.MarginBounds.Right-20,ev.MarginBounds.Bottom-100);

      // In this print I choose to divide the time axel into two pages.
      // Then I must call PrintPage once with SuppressGrid=false and doNotStepGridWillPrintTheSameRowsOneMoreTime=true
      // and once with SuppressGrid=true and doNotStepGridWillPrintTheSameRowsOneMoreTime=false
      // In the second call I change the DateScaler intervall to reflect another area in time, then I set it back
      // after the print to prepare for the first page in time (x) direction

      if (firstInx)
      {
        gantt1.PrintPage(ev.Graphics,r,100,50,false,ref hasMorePages,true);
        start=gantt1.DateScaler.StartTime;
        stop=gantt1.DateScaler.StopTime;
        ev.HasMorePages=hasMorePages;
        firstInx=false;
      }
      else
      {     
        gantt1.DateScaler.TimeSpanSet(stop,stop.Add(stop.Subtract(start)));
        gantt1.PrintPage(ev.Graphics,r,100,50,true,ref hasMorePages,false);
        gantt1.DateScaler.TimeSpanSet(start,stop);
        ev.HasMorePages=hasMorePages;
        firstInx=true;
      }
}

 

10315 : interruptions/divisions of the activities like ms project?

Question

it supports the interruptions/divisions of the activities like ms project?  thanks

Answer

You can certainly visiulize interupted tasks. The Gantt chart has no practical limitation on how many time items that can exist on a single row so if your implementation calls for representation of a task that is broken up into 5 active periods and 4 pauses you visualize this by creating 5 different time items and possibly 4 time items of another style to represent the pause.

Another solution is to implement a user drawn time item and keep the information about pauses in the UserReference of the time item (as an object). You can then access this information upon drawing and visualize the pause within the time item by a different drawing style.

10270 : No components in my toolbox?

Question

(Im still using Demo)
No Item in the Toolbox to be dragged onto (win-)form? Both Whidbey Beta 2 as VS2K3 dont show me an Item in the toolbox to work with? To built a new Gantt Diagram. So I dont know which option I missed because there are no arrows on my diagramm to move through time, as in all examples (and no showing of ed date, either). Ok that are too questions at once, hope you can help anyway?

Answer

They should be there but you can add the components to your toolbox by hand. In VS2005 beta2, right click the toolbox and choose  “Choose Items”, click “Browse”, go to c:\program\plexityhide.com\GTP.NET 2.0 and choose PlexityHide.GTP.dll and PlexityHide.GTP.WEB.dll… Click OK.

They should now be in your toolbox

 

 

10296 : When I click om something in the “Getting started” all the links fails.

Question

I have another problem, this time with the help file:

When I click om something in the “Getting started” all the links fails. they are all linked to file:///C:/Pexlain_WF/ph.NET/HelpDocX/AdditionalHTM/Time_Items.htm or equal! I would really like to be able to read this.

Answer

This was a help file bug that is fixed in the latest help file that is enclosed in the general download for GTP.NET 2.0.13