10338 : OnScalerString Upper or lower band?

Question

Hello,
i’d like to ask something about the issue http://plexityhide.dyndns.org/InstantKB13/article.aspx?id=10282

I’ve picked (min_date) as start date a year where the first day of january is monday (es the 2007) and start from it to count.
I’ve set the UseDayNumbersNotWeeks to false to show the week counting.

after that i’ve implemented the function OnDateScalerDrawString

if(min_date != null)
{
 TimeSpan days = e.DateTime – (DateTime)min_date;

 switch(e.Resolution.ToString())
 {     
  case “days”:
  {
   e.OutputText = (days.Days>=0) ? “Day ” + (days.Days+1).ToString() : “”;
  }break;
  case “weeks”:
  {
   Int32 weeks = ((days.Days) / 7)+1;
   e.OutputText = weeks>0 ? “Week ” + weeks.ToString() : “”;
  }break;
  default:
   e.OutputText = “”;
   break;
 }
}

the problem is that the Resolution property give the minimum resolution of the bars in the DateScaler so if i can show in the lower bar the days in the above bar i can see the the middle day of the week (4, 11, etc). How can i check in what bar e is referring to?
Also i’d like to disable the resolution above the weeks, because in my  situation is not possible to count months, years and so on (the months have differents number of days), is this possible?

Answer

To find out if the event has been called for the long inverval (the top band) or the short interval (the bottom band) you can check the e.LongIntervall (true? then the top band).

To limit the resolution you can implement the OnBeforeScaleOrSpanChange event and stop any action you do not want to allow. You can also set DateScaler.MinSpan and MaxSpan to control this.

 

Leave a Reply