By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,710 Members | 1,371 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,710 IT Pros & Developers. It's quick & easy.

Highlight days in MonthCalendar

P: n/a
Hi,

I am new to Windows Form programming and now have a simple Q about
MonthCalendar.

I want to hightlight some days in the calendar by changing the
background color of these days. But I can't find any property or
method that let me do this. What I know is that I can bold them...

Thanks.

Michael

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
If you mean by MonthCalendar the DateTimePicker then the answer is no.

DateTimePicker is based on a DateTime Field in the Control.
This DateTime can have only one value.
The Date of the DateTime is highlighted.
Looking at DateTimePicker.cs offered by Microsoft show this as far as I can
see.

Sorry,
Mark Johnson, Berlin Germany
mj*****@mj10777.de

"michael_hk" <hk**********@yahoo.co-dot-jp.no-spam.invalid> schrieb im
Newsbeitrag news:3f**********@127.0.0.1...
Hi,

I am new to Windows Form programming and now have a simple Q about
MonthCalendar.

I want to hightlight some days in the calendar by changing the
background color of these days. But I can't find any property or
method that let me do this. What I know is that I can bold them...

Thanks.

Michael

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Nov 15 '05 #2

P: n/a
I think by MonthCalendar he means MonthCalendar!

"Mark Johnson" <mj*****@mj10777.de> wrote in message
news:3f***********************@newsread4.arcor-online.net...
If you mean by MonthCalendar the DateTimePicker then the answer is no.

DateTimePicker is based on a DateTime Field in the Control.
This DateTime can have only one value.
The Date of the DateTime is highlighted.
Looking at DateTimePicker.cs offered by Microsoft show this as far as I can see.

Sorry,
Mark Johnson, Berlin Germany
mj*****@mj10777.de

"michael_hk" <hk**********@yahoo.co-dot-jp.no-spam.invalid> schrieb im
Newsbeitrag news:3f**********@127.0.0.1...
Hi,

I am new to Windows Form programming and now have a simple Q about
MonthCalendar.

I want to hightlight some days in the calendar by changing the
background color of these days. But I can't find any property or
method that let me do this. What I know is that I can bold them...

Thanks.

Michael

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via

Encryption =---

Nov 15 '05 #3

P: n/a
bvh
Use the DayRender event for the calendar then target the days. Here
is some sample code that changes the background color of the cell if
there is a database entry for an appointment on any given day:

private void Calendar1_DayRender(object sender,
System.Web.UI.WebControls.DayRenderEventArgs e)
{
foreach (DataRow row in ds.Tables["Calendar"].Rows){
try {
DateTime eventdate=(DateTime)row["event_start_time"];
if
(eventdate.ToShortDateString().Equals(e.Day.Date.T oShortDateString()))
{

Here's what you want: e is coming of the DayRender method and gives
you a particular cell

----> e.Cell.BackColor=System.Drawing.Color.FromArgb(230 ,179,1); <--
}
}
catch
{
//if it can't do it, then so
be it
}
}
}
}

On 5 Jan 2004 21:10:27 -0600,
hk**********@yahoo.co-dot-jp.no-spam.invalid (michael_hk) wrote:
Hi,

I am new to Windows Form programming and now have a simple Q about
MonthCalendar.

I want to hightlight some days in the calendar by changing the
background color of these days. But I can't find any property or
method that let me do this. What I know is that I can bold them...

Thanks.

Michael

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.