Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Simple Questions (Read 7750 times)
Nikola Nikolov
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 8
Joined: Mar 1st, 2016
Simple Questions
Mar 9th, 2016 at 2:28am
Print Post  
Hi,
I have been playing with the various calendar views for some time, and I have got several simple questions:
1.Is there a way to use the scroll wheel of the mouse in calendar views?
2.How can I scroll vertically over all my items in a horizontally oriented Timetable view instead of getting the arrows at the bottom?
3.Is there a way to select scheduled items programmatically?
Thanks in advance!

  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Simple Questions
Reply #1 - Mar 9th, 2016 at 8:54am
Print Post  
Hi Nikola,

Quote:
1.Is there a way to use the scroll wheel of the mouse in calendar views?


You can handle the MouseWheel event to change scroll position as shown here -
http://mindfusion.eu/Forum/YaBB.pl?num=1193924994

Quote:
2.How can I scroll vertically over all my items in a horizontally oriented Timetable view instead of getting the arrows at the bottom?


The timetable view should be showing a vertical scrollbar that lets you scroll if view size is larger than the control; doesn't the scrollbar appear?

Quote:
3.Is there a way to select scheduled items programmatically?


Add them to the Calendar.ItemSelection object.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Nikola Nikolov
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 8
Joined: Mar 1st, 2016
Re: Simple Questions
Reply #2 - Apr 12th, 2016 at 3:03am
Print Post  
Hi, there,
Thanks for your reply!
Regarding your comment on question 2:
"The timetable view should be showing a vertical scrollbar that lets you scroll if view size is larger than the control; doesn't the scrollbar appear?"
The vertical scrollbar appears, but for some reason it does not work. Is there any specific parameter that is supposed to be set? Please, take a look at the attachment. There are many more items in the view, but there is no way to make them appear.
« Last Edit: Apr 19th, 2016 at 1:20am by Nikola Nikolov »  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Simple Questions
Reply #3 - Apr 12th, 2016 at 6:20am
Print Post  
Hi Nikola,

At this time a timetable row cannot be larger than the calendar view. The scrollbar lets you scroll when there are more than one rows (i.e. dates in horizontal timetable), and scrolling only changes the first displayed row. You could let users see the hidden items by handling HiddenItemClick event and either listing them in your own UI or changing overlapping items' Visible or Priority values to change what's shown in the timetable. We'll try to implement scrolling inside a row for next release.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Nikola Nikolov
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 8
Joined: Mar 1st, 2016
Re: Simple Questions
Reply #4 - Apr 13th, 2016 at 3:40am
Print Post  
Hi, Slavcho,
Many thanks for your advice!
I will see what I can do.
Cheers,
Nikola
  
Back to top
 
IP Logged
 
Nikola Nikolov
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 8
Joined: Mar 1st, 2016
Re: Simple Questions
Reply #5 - Apr 23rd, 2016 at 2:59pm
Print Post  
Hi again,
One more simple question:
Is there a way to access components of the Calendar Resource View?
For example, if I have a list of contacts, and each contact is assigned to one or more Appointments, it would be nice to count the Appointments each contact is assigned to in a certain period of time.
Certainly, I can go trough all the Appointments, and try to count appearances of the contact in Contacts collections, but there must be a more elegant way.
Thank you in advance!
Best regards,
Nikola
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Simple Questions
Reply #6 - Apr 25th, 2016 at 10:09am
Print Post  
Hi,

Use one of the Schedule.GetAllItems overloads that accepts a Contact as an argument.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Nikola Nikolov
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 8
Joined: Mar 1st, 2016
Re: Simple Questions
Reply #7 - Apr 30th, 2016 at 9:54am
Print Post  
Hi,
Good stuff!
These methods work great and save a lot of time.
One more thing: I need to see just the headers in Timetable View when Orientation is set to Vertical. HeaderText must be rotated.
Thanks in advance!
Best regards,
Nikola
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Simple Questions
Reply #8 - May 3rd, 2016 at 9:38am
Print Post  
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:

Code
Select All
// 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
  
Back to top
 
IP Logged
 
Nikola Nikolov
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 8
Joined: Mar 1st, 2016
Re: Simple Questions
Reply #9 - May 4th, 2016 at 7:13am
Print Post  
Hi, Meppy,
My bad! I did not explain the problem correctly.
I need just item headers to be shown and rotated.
Something like the attached, but in Timetable View.
Thanks in advance!
Nikola
  

Vertical.JPG ( 30 KB | 153 Downloads )
Vertical.JPG
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Simple Questions
Reply #10 - May 5th, 2016 at 7:28am
Print Post  
Hi,

The same principle can be applied when drawing items only this time you need to handle the Calendar.ItemDrawing event. Here is some code which illustrates how to do this:

Code
Select All
calendar1.ItemDrawing += (s, e) =>
	{
		var bounds = e.Bounds;
		bounds.Width -= 1;
		bounds.Height -= 1;
		var rbounds = bounds;
		rbounds.Width = bounds.Height;
		rbounds.Height = bounds.Width;
		using (var brush = e.Style.Brush.CreateGdiBrush(e.Bounds))
			e.Graphics.FillRectangle(brush, bounds);
		DrawHeaderTextRotated(e.Graphics, e.Text, rbounds, e.Style);
		using (var pen = new Pen(e.Style.BorderLeftColor, e.Style.BorderLeftWidth))
			e.Graphics.DrawLine(pen, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom);
		using (var pen = new Pen(e.Style.BorderTopColor, e.Style.BorderTopWidth))
			e.Graphics.DrawLine(pen, bounds.Left, bounds.Top, bounds.Right, bounds.Top);
		using (var pen = new Pen(e.Style.BorderRightColor, e.Style.BorderRightWidth))
			e.Graphics.DrawLine(pen, bounds.Right, bounds.Top, bounds.Right, bounds.Bottom);
		using (var pen = new Pen(e.Style.BorderBottomColor, e.Style.BorderBottomWidth))
			e.Graphics.DrawLine(pen, bounds.Left, bounds.Bottom, bounds.Right, bounds.Bottom);

		e.Handled = true;
	}; 


The DrawHeaderTextRotated method is the same as the one above.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint