Hi,
If you need to hide the timeline in the Timetable view, set Calendar.TimetableSettings.TimelineSize to 0.
The header texts in the vertical Timetable view cannot be rotated. However, you can perform custom drawing of the header texts and manually rotate them. Here is some code that can help you with this:
// Handle the Draw event
calendar1.CustomDraw = MindFusion.Scheduling.WinForms.CustomDrawElements.TimetableColumnHeader;
calendar1.Drawing += (s, e) =>
{
if (e.Element == CustomDrawElements.TimetableColumnHeader)
{
var bounds = e.Bounds;
bounds.Width = e.Bounds.Height;
bounds.Height = e.Bounds.Width;
DrawHeaderTextRotated(e.Graphics, e.Text, bounds, e.Style);
e.Handled = true;
}
};
// And the helper methods that perform the actual drawing
void DrawHeaderTextRotated(MindFusion.Drawing.IGraphics target, string text, Rectangle rc, Style style)
{
if (rc.Width == 0 || rc.Height == 0)
return;
// Setup graphics for rotation
GraphicsState state = target.Save();
float off = 0;
if (rc.Width > rc.Height)
off = (float)Math.Max(rc.Width, rc.Height) / 2;
else
off = (float)Math.Min(rc.Width, rc.Height) / 2;
target.TranslateTransform(rc.Left + off, rc.Top + off);
target.RotateTransform(270);
target.TranslateTransform(-rc.Left - off, -rc.Top - off);
DrawHeaderText(target, text, rc, style);
target.Restore(state);
}
void DrawHeaderText(MindFusion.Drawing.IGraphics target, string text, Rectangle rc, Style style)
{
if (rc.Width == 0 || rc.Height == 0)
return;
Font font = style.HeaderFont;
if (font == null)
return;
// Accommodate the destination rectangle with the header margins
Rectangle dest = rc;
dest.X += style.HeaderTextLeftMargin;
dest.Width -= style.HeaderTextLeftMargin;
dest.Width -= style.HeaderTextRightMargin;
dest.Y += style.HeaderTextTopMargin;
dest.Height -= style.HeaderTextTopMargin;
dest.Height -= style.HeaderTextBottomMargin;
if (dest.Width <= 0 || dest.Height <= 0)
return;
// Draw the text itself
Brush gdiTextBrush = new SolidBrush(style.HeaderTextColor);
target.DrawString(text, font, gdiTextBrush, dest, StringFormat.GenericTypographic);
gdiTextBrush.Dispose();
}
Let me know if this helps.
Regards,
Meppy