Using 2012.2 with VS 2012.
I have an UltraMonthViewMulti calendar on a form. The form currently shows 20 months so it crosses two years. When a user double-clicks a particular date, I want to color that date. This is how they are signifying that the particular date is not available for use.
I can get the day they are on and use the CalendarLook to color it; however it colors it for the same date in all years that are showing. I only want it for the specific date they clicked on - not all dates across all years that happen to be displayed. Below is what I am doing. dDateSelected contains the date the user double-clicked on.
UltraCalendarLook1.DaysOfYearLook(dDateSelected.DayOfYear + 1).Appearance.BackColor = color.blue
Is there a way to do this?
ThanksHoward
Howard,
I am glad to hear this! Please let me know if you have any other questions in the future, I will be happy to assist you!
Yes, this is what I need. I was able to use this and got the state stuff I needed working with it.
Thanks for all the help.
Howard
Thank you for the clarifications!
At first, I thought that you would like those numbers hidden. I believe that you should be drawing them after filling the rectangle with the desired color.
Please use the 'DrawString(..,..,..,..)' method, like this:
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
{
if (drawPhase == DrawPhase.AfterDrawElement)
foreach (DayUIElement day in days)
drawParams.Graphics.FillRectangle(Brushes.Red, day.Rect);
drawParams.DrawString(day.Rect, day.Text, false, false);
}
return false;
Please feel free to let me know if I misunderstood you or if you have any other questions.
I just want it to be colored, but the number visible through the color like when you select the date.
I will basically be allowing them several options. So, first double-click it might turn blue, double-click again and it will turn pink (for example) and a third time it will go back to normal. So, I was looking for a way to shade it and be able to see the day number, then clear out that shading (if they double-click the third time or press a button to say "clear").
I would keep a state record to allow me to know what state it is in so that I could change colors or set back to normal. I think I can handle the state stuff fine, it is just knowing how to draw a clear color and reset it that I am struggling with.
Thanks
What would you like to draw? Perhaps you are not entering the right 'DrawPhase', just a guess.