10778 : The TimeItemTexts array?

Question

The TimeItemTexts are an array connected to the TimeItem and that seems great to store different texts to these Items and show them on occation. But how do I tell the timeitems what item of TimeItemTexts they shall display? Can I set the index to display in some property?

 

Answer< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The reason for having a collection of TimeItemTexts per TimeItem is to facilitate multiple shown parts of information (text or image) in or around each time item.

You can control the placement of the time item texts by setting the TimeItemTextLayout properties. So Align in horizontal and vertical to control any of 3×3 possible placements. 

Also the “Outside” property of the TimeItemTextLayout gives you 3×3 more placements outside but near your time item.

It will not make much sense to keep multiple TimeItemTexts on a single time item if they have the same TimeItemTextLayout (unless we introduce a visible property or the like).

11058 : I am trying to add 2 texts to a time item. I want to be able to show text1 on one line and text2 on the line below text1. How can I accomplish this?

Question

 

I am trying to add 2 texts to a time item. I want to be able to show text1 on one line and text3 on the line below text1. I have tried the code below but only the last text gets displayed. How can I accomplish this?

 

Answer

 

To accomplish this use two TimeItemTextLayouts with different padding. The second one should have a top padding to make it appear under the first one:

 

      TimeItemText titxt = new TimeItemText();
      titxt.Text = “Test”;
      titxt.TimeItemTextLayout =
      gantt1.TimeItemTextLayouts.GetFromName(“Default”);
      titxt.TimeItemTextLayout.Color = Color.Black;
      titxt.TimeItemTextLayout.Font = new Font(FontFamily.GenericMonospace, 10, FontStyle.Regular);
      titxt.TimeItemTextLayout.VertAlign = StringAlignment.Near;
      ti.TimeItemTexts.Add(titxt);

 

      TimeItemText titxt2 = new TimeItemText();
      titxt2.Text = “Test2”;
      titxt2.TimeItemTextLayout = gantt1.TimeItemTextLayouts.GetFromName(“Default”).Clone() as TimeItemTextLayout;
      titxt2.TimeItemTextLayout.Name = “SecondOne”;
      gantt1.TimeItemTextLayouts.Add(titxt2.TimeItemTextLayout);
      titxt2.TimeItemTextLayout.Padding=new Rectangle(0,20,0,0);
      ti.TimeItemTexts.Add(titxt2);