473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Hilight multiple dates in monthCalendar

Hi, it seems this is a common demand and the control does not provide
simple ways to do it, This is like a brute force attack but it worked
for me...

void SelectAllDates(){
Graphics g = monthCalendar1.CreateGraphics();

MonthCalendar.HitTestInfo oHTI;

ArrayList oDatesArray = new ArrayList();
for(int x=1;x<monthCalendar1.Size.Width;x=x+1)//try to increase the
step to speed up...
{
for (int y=1;y<monthCalendar1.Size.Height;y=y+1)
{
oHTI = monthCalendar1.HitTest(x,y);
if (oHTI.HitArea == MonthCalendar.HitArea.Date)
{
if(!oDatesArray.Contains(oHTI.Time))
{
oDatesArray.Add(oHTI.Time);
g.DrawRectangle(new Pen(Brushes.Red,2), x, y,24,15);//you will
probably have to adjust the height and width of the red square for you
control size which depends on the font size
}
}
}
}
}
Nov 16 '05 #1
0 1802

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rachel Suddeth | last post by:
Is there a way to have the non-selectable dates (those before MinDate and after MaxDate) draw differently so my users can see right away what dates aren't allowed? I'm not seeing it... ...
0
by: Steven | last post by:
Hello, I have an application with multiple forms. I open 2 (different) forms, one with numerous controls, say A, and one with a MonthCalendar, a Combobox and a datagrid, say B. When I work in...
0
by: Brian Henry | last post by:
Is there anyway to get bold dates to show up on the drop down month calendar on the date time picker? I need a way to show that something occured on a date on the dropdown, and I can't find a...
13
by: steven | last post by:
A monthcalendar checks every 2 minutes if theres a new day. Does anyone knows how to disable this ? The problem is that, everytime a monthcalendar checks this, the form where the monhcalendar is...
0
by: ramesh.nrk | last post by:
Hi, In my windows application I need to display MonthCalendar control with some selected dates. I am using the property "Bolded Dates" to add selected/some dates. But those dates are displayed in...
3
by: CuriousOne1 | last post by:
Hi all, I don't know if anyone has come accross this before. I've been using Steve Lebans Calendar control (available here: www.lebans.com/monthcalendar.htm ) for several database application...
0
by: jonasi | last post by:
Hi, I would like to use several colors to display some specific dates in my monthcalendar. By example, some dates will be displayed in red color, others in green color... Have you got any...
12
by: Chris Shepherd | last post by:
Greetings group, I have a situation where I'd like to visibly see disabled dates on a DateTimePicker. Frequently the Min and Max dates in the picker will be set only to days apart, and so I...
11
by: Randy | last post by:
I have a MonthCalendar on one of my forms. I have disovered that the DateChanged event is triggered not only when the user clicks on a new date, but also if they click on the Previous or Next...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.