Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Jumping Weekends (Read 4874 times)
GL@Olympus
YaBB Newbies
*
Offline


Too much work, too little
time, no doughnuts

Posts: 12
Joined: Jun 18th, 2011
Jumping Weekends
Jun 27th, 2011 at 12:31pm
Print Post  
Hi,

(Me again... sorry!)

Is there any way of setting an appointment in Resource View to let it "jump" over weekends. I know about hiding Sat/Sujn, but would prefer to see them still in the display.

For example: If I have an appointment that lasts for two weeks, I am telling the calendar the correct start and end dates,  but I need it to know that there is a weekend in between and not to paint the appointment over the two days

Possible?

Thanks

Graham
  

If a man states a fact in the woods when there are no women present, is he still wrong?
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Jumping Weekends
Reply #1 - Jun 27th, 2011 at 1:30pm
Print Post  
There is no easy way to do this. I was able to achieve it using appointments with custom viewers and clipping. But even then, the item handlers are visible and this approach requires quite some efforts to implement. If you are interested in the clipping technique, I can send you the sample demonstrating it, but its not elegant.

An easier option would be to draw an indication for the weekend cells on top of the items, using custom drawing.

Regards,
Meppy
  
Back to top
 
IP Logged
 
GL@Olympus
YaBB Newbies
*
Offline


Too much work, too little
time, no doughnuts

Posts: 12
Joined: Jun 18th, 2011
Re: Jumping Weekends
Reply #2 - Jun 27th, 2011 at 2:18pm
Print Post  
Thanks for that... Hmm, I thought not. I remember the pages and page of code I had to write to implement it for my old "home-made" calendar. Oh well.

As for your other suggestion, I like that idea, but given the timescales I am under to get this in front of management (and therefore get you some money!) I wonder if I could be cheeky and ask if you have any code that would illustrate the idea of custom drawing over the cells?

Thanks again for brilliant support!

Graham
  

If a man states a fact in the woods when there are no women present, is he still wrong?
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Jumping Weekends
Reply #3 - Jun 27th, 2011 at 2:49pm
Print Post  
Check out this sample:

https://mindfusion.eu/_samples/_sample_ClipWeekends.zip

It shows how to custom draw weekend cells on top of the items. You can also take a look at the clipping approach by uncommenting the two commented lines in the form's constructor.

Regards,
Meppy
  
Back to top
 
IP Logged
 
GL@Olympus
YaBB Newbies
*
Offline


Too much work, too little
time, no doughnuts

Posts: 12
Joined: Jun 18th, 2011
Re: Jumping Weekends
Reply #4 - Jun 27th, 2011 at 3:03pm
Print Post  
Thanks again Meppy!!!

However, there is the problem. As It  seems I can't post graphics here, I have emailed you a picture of the issue where the appointment text goes over the weekend.

Ideally, this should not happen, so I think I will have to resort to hiding the weekend days.

Cheers

Graham

« Last Edit: Jun 27th, 2011 at 4:14pm by GL@Olympus »  

If a man states a fact in the woods when there are no women present, is he still wrong?
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Jumping Weekends
Reply #5 - Jun 28th, 2011 at 6:25am
Print Post  
I've deliberately made the weekend cells semitransparent to give you the idea of how it works. The items actually render behind cells but the cells can be seen through. Replace the content of the calendar1_Paint event handler with the following code:

Code
Select All
Pen lanePen = null;
Brush laneBrush = null;

// The pen used to draw cell borders
switch (calendar1.ResourceViewSettings.GridStyle)
{

	case LineStyle.Dotted:
		laneBrush = new HatchBrush(HatchStyle.Percent50,
			calendar1.ResourceViewSettings.Style.LineColor, Color.Transparent);
		lanePen = new Pen(laneBrush, 1);
		break;

	case LineStyle.Solid:
		lanePen = new Pen(calendar1.ResourceViewSettings.Style.LineColor, 1);
		break;

	case LineStyle.Invisible:
		lanePen = new Pen(Color.Transparent, 1);
		break;

}

for (int i = 0; i < cells.Count; i++)
{
	Rectangle cell = cells[i];

	using (Brush brush = calendar1.ResourceViewSettings.WeekendStyle.Brush.CreateGdiBrush(cell))
	{
		e.Graphics.FillRectangle(brush, cell);
		e.Graphics.DrawRectangle(lanePen, cell);
	}
}

lanePen.Dispose();
if (laneBrush != null)
	laneBrush.Dispose(); 


Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
GL@Olympus
YaBB Newbies
*
Offline


Too much work, too little
time, no doughnuts

Posts: 12
Joined: Jun 18th, 2011
Re: Jumping Weekends
Reply #6 - Jun 28th, 2011 at 3:27pm
Print Post  
Hi Meppy,

Thanks again. This does improve the look, I will have a play and see if I can get a result that the users will be happy with.

Once again, I appreciate the speedy response and support.

GL.
  

If a man states a fact in the woods when there are no women present, is he still wrong?
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint