Katalogerna
PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


GTP.NET FAQ 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? Please note that this article refers to the GTP.NET
Jump to article- 2007-11-17 11:25:00 - Email plexityHide

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);

 

Google
WWW plexityHide GTP.NET FAQ
Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ general

Testimonials

"This is too GREAT. I must say you have strong support and really good programmers at your place. Your entire team is good. Just Fantastic! – 100%"
Gaurav Patole,
WebTechDevelopers
More testimonials...