<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Monthcalendar problem mit bolddays - FAQ = nix gefunden]]></title><description><![CDATA[<p>hallo,</p>
<p>bitte erst lesen, nicht auf faq verweisen:</p>
<p>ich habe ein problem festgestellt mit dem Kalender vom BCB. ich habe mir ostern errechnet (wichtig wegen wanderndem datum) und auch mit bolddays anzeigen lassen, funkt prima, wenn man es macht. jedoch habe ich bemerkt, dass er irgendein notwendiges event nicht mehr aufruft, wenn man direkt oben die jahres zahl ändert. er rechnet zwar ostern und so richtig aus, allerdings zeichnet er für das neu ausgewählte jahr nicht die bolddays sofort neu, sondern erst, wenn sich der monat ändert. wer kann helfen?</p>
<p>zum nachvollziehen:</p>
<p>Unit1.h</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
#include &lt;ComCtrls.hpp&gt;
#include &lt;math.h&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// Von der IDE verwaltete Komponenten
	TMonthCalendar *MonthCalendar1;
	TListBox *ListBox1;
	void __fastcall MonthCalendar1GetMonthInfo(TObject *Sender, DWORD Month,
          DWORD &amp;MonthBoldInfo);
	void __fastcall MonthCalendar1Click(TObject *Sender);
private:	// Anwender-Deklarationen
public:		// Anwender-Deklarationen
	__fastcall TForm1(TComponent* Owner);
    TDate __fastcall Ostern(int Year);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Unit1.cpp</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
TDate __fastcall TForm1::Ostern(int Year)
{
	int a, b, c, d, e, f, g, h, i, k, l, m, n, p;

  	a = Year % 19;
  	b = Year / 100;
  	c = Year % 100;

  	d = b / 4;
  	e = b % 4;

  	f = (b + 8) / 25;

  	g = (b - f + 1) / 3;

  	h = (19 * a + b - d - g + 15) % 30;

  	i = c / 4;
  	k = c % 4;

  	l = (32 + 2 * e + 2 * i - h - k) % 7;

  	m = (a + 11 * h + 22 * l) / 451;

  	n = (h + l - 7 * m + 114) / 31;
  	p = (h + l - 7 * m + 114) % 31;

  	/*
    Jetzt enthält n die Monatsnummer
  	(also 3 = März bzw. 4 = April),
  	und (p + 1) gibt den Tag an,
  	auf den in diesem Monat
  	das Osterdatum fällt.
  	*/

  return EncodeDate(Year, n, p + 1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::MonthCalendar1GetMonthInfo(TObject *Sender,
      DWORD Month, DWORD &amp;MonthBoldInfo)
{
	// Feiertagsberechnung pro Monat hier hin
    TDate my;
	unsigned short y,m,d;
    unsigned long day;
    unsigned int month;

    MonthCalendar1-&gt;Date.DecodeDate(&amp;y,&amp;m,&amp;d);
    my = Ostern(y);

    my.DecodeDate(&amp;y,&amp;m,&amp;d);
    day = d;
    month = m;

  	MonthBoldInfo = 0;
    ListBox1-&gt;Clear();
	ListBox1-&gt;Items-&gt;Add(DateToStr(my) + &quot; - Ostern&quot;);
    if(Month == month)
    {
    	MonthBoldInfo += pow(2 , day-1); // Ostersonntag
    	MonthBoldInfo += pow(2 , day-3); // Karfreitag
      	MonthBoldInfo += pow(2 , day);   // Ostermontag
    }
    my = my + 39;
    my.DecodeDate(&amp;y,&amp;m,&amp;d);
    day = d;
    month = m;

    if(Month == month)
    {
    	MonthBoldInfo += pow(2 , day-1); // Himmelfahrt
    }

    my = my + 10;
    my.DecodeDate(&amp;y,&amp;m,&amp;d);
    day = d;
    month = m;

    if(Month == month)
    {
    	MonthBoldInfo += pow(2 , day-1); // Pfingstsonntag
        MonthBoldInfo += pow(2 , day); // Pfingstmontag
    }

    if(Month == 12)
    {
    	MonthBoldInfo += pow(2 , 24); // Weihnachten 1
        MonthBoldInfo += pow(2 , 25); // Weihnachten 2
    }
    if(Month == 10)
    {
	   	MonthBoldInfo += pow(2 , 2);  // Tag der deutschen Einheit
    }
    if(Month == 1)
    {
       	MonthBoldInfo += pow(2 , 0);  // Neujahr
		MonthBoldInfo += pow(2 , 5);  // Hlg. 3 Könige
    }
    if(Month == 5)
    {
    	MonthBoldInfo += pow(2 , 0);  // Tag der Arbeit
    }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::MonthCalendar1Click(TObject *Sender)
{
	MonthCalendar1-&gt;Update();	
}
//---------------------------------------------------------------------------
</code></pre>
<p>gruß gerd</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/148474/monthcalendar-problem-mit-bolddays-faq-nix-gefunden</link><generator>RSS for Node</generator><lastBuildDate>Thu, 06 Aug 2026 18:02:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/148474.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 26 May 2006 23:52:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Monthcalendar problem mit bolddays - FAQ = nix gefunden on Fri, 26 May 2006 23:52:49 GMT]]></title><description><![CDATA[<p>hallo,</p>
<p>bitte erst lesen, nicht auf faq verweisen:</p>
<p>ich habe ein problem festgestellt mit dem Kalender vom BCB. ich habe mir ostern errechnet (wichtig wegen wanderndem datum) und auch mit bolddays anzeigen lassen, funkt prima, wenn man es macht. jedoch habe ich bemerkt, dass er irgendein notwendiges event nicht mehr aufruft, wenn man direkt oben die jahres zahl ändert. er rechnet zwar ostern und so richtig aus, allerdings zeichnet er für das neu ausgewählte jahr nicht die bolddays sofort neu, sondern erst, wenn sich der monat ändert. wer kann helfen?</p>
<p>zum nachvollziehen:</p>
<p>Unit1.h</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
#include &lt;ComCtrls.hpp&gt;
#include &lt;math.h&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// Von der IDE verwaltete Komponenten
	TMonthCalendar *MonthCalendar1;
	TListBox *ListBox1;
	void __fastcall MonthCalendar1GetMonthInfo(TObject *Sender, DWORD Month,
          DWORD &amp;MonthBoldInfo);
	void __fastcall MonthCalendar1Click(TObject *Sender);
private:	// Anwender-Deklarationen
public:		// Anwender-Deklarationen
	__fastcall TForm1(TComponent* Owner);
    TDate __fastcall Ostern(int Year);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Unit1.cpp</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
TDate __fastcall TForm1::Ostern(int Year)
{
	int a, b, c, d, e, f, g, h, i, k, l, m, n, p;

  	a = Year % 19;
  	b = Year / 100;
  	c = Year % 100;

  	d = b / 4;
  	e = b % 4;

  	f = (b + 8) / 25;

  	g = (b - f + 1) / 3;

  	h = (19 * a + b - d - g + 15) % 30;

  	i = c / 4;
  	k = c % 4;

  	l = (32 + 2 * e + 2 * i - h - k) % 7;

  	m = (a + 11 * h + 22 * l) / 451;

  	n = (h + l - 7 * m + 114) / 31;
  	p = (h + l - 7 * m + 114) % 31;

  	/*
    Jetzt enthält n die Monatsnummer
  	(also 3 = März bzw. 4 = April),
  	und (p + 1) gibt den Tag an,
  	auf den in diesem Monat
  	das Osterdatum fällt.
  	*/

  return EncodeDate(Year, n, p + 1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::MonthCalendar1GetMonthInfo(TObject *Sender,
      DWORD Month, DWORD &amp;MonthBoldInfo)
{
	// Feiertagsberechnung pro Monat hier hin
    TDate my;
	unsigned short y,m,d;
    unsigned long day;
    unsigned int month;

    MonthCalendar1-&gt;Date.DecodeDate(&amp;y,&amp;m,&amp;d);
    my = Ostern(y);

    my.DecodeDate(&amp;y,&amp;m,&amp;d);
    day = d;
    month = m;

  	MonthBoldInfo = 0;
    ListBox1-&gt;Clear();
	ListBox1-&gt;Items-&gt;Add(DateToStr(my) + &quot; - Ostern&quot;);
    if(Month == month)
    {
    	MonthBoldInfo += pow(2 , day-1); // Ostersonntag
    	MonthBoldInfo += pow(2 , day-3); // Karfreitag
      	MonthBoldInfo += pow(2 , day);   // Ostermontag
    }
    my = my + 39;
    my.DecodeDate(&amp;y,&amp;m,&amp;d);
    day = d;
    month = m;

    if(Month == month)
    {
    	MonthBoldInfo += pow(2 , day-1); // Himmelfahrt
    }

    my = my + 10;
    my.DecodeDate(&amp;y,&amp;m,&amp;d);
    day = d;
    month = m;

    if(Month == month)
    {
    	MonthBoldInfo += pow(2 , day-1); // Pfingstsonntag
        MonthBoldInfo += pow(2 , day); // Pfingstmontag
    }

    if(Month == 12)
    {
    	MonthBoldInfo += pow(2 , 24); // Weihnachten 1
        MonthBoldInfo += pow(2 , 25); // Weihnachten 2
    }
    if(Month == 10)
    {
	   	MonthBoldInfo += pow(2 , 2);  // Tag der deutschen Einheit
    }
    if(Month == 1)
    {
       	MonthBoldInfo += pow(2 , 0);  // Neujahr
		MonthBoldInfo += pow(2 , 5);  // Hlg. 3 Könige
    }
    if(Month == 5)
    {
    	MonthBoldInfo += pow(2 , 0);  // Tag der Arbeit
    }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::MonthCalendar1Click(TObject *Sender)
{
	MonthCalendar1-&gt;Update();	
}
//---------------------------------------------------------------------------
</code></pre>
<p>gruß gerd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1065868</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065868</guid><dc:creator><![CDATA[gerd01]]></dc:creator><pubDate>Fri, 26 May 2006 23:52:49 GMT</pubDate></item><item><title><![CDATA[Reply to Monthcalendar problem mit bolddays - FAQ = nix gefunden on Sat, 27 May 2006 09:57:50 GMT]]></title><description><![CDATA[<p>Und die Hinweise aus <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-49012.html" rel="nofollow">diesem</a> FAQ-Beitrag helfen tatsächlich nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1065966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065966</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Sat, 27 May 2006 09:57:50 GMT</pubDate></item><item><title><![CDATA[Reply to Monthcalendar problem mit bolddays - FAQ = nix gefunden on Sat, 27 May 2006 10:00:47 GMT]]></title><description><![CDATA[<p>ich werde es nochmals damit versuchen, jedoch reagiert er nicht bevor nicht ein Monatswechsel stattfindet. erst danach wird der monat aktualisiert, und die feiertage für z.b. 2007 korrigiert.</p>
<p>gruß gerd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1065969</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065969</guid><dc:creator><![CDATA[gerd01]]></dc:creator><pubDate>Sat, 27 May 2006 10:00:47 GMT</pubDate></item><item><title><![CDATA[Reply to Monthcalendar problem mit bolddays - FAQ = nix gefunden on Sat, 27 May 2006 11:53:56 GMT]]></title><description><![CDATA[<p>also, mein ergebnis ist nicht befriedigend. er aktuelisiert das datum immer ein jahr zu spät.</p>
<p>irgendwelche ideen?</p>
<p>gruß gerds</p>
<p>hier mal der neue code:</p>
<p>Unit1.h</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
#include &lt;ComCtrls.hpp&gt;
#include &lt;math.h&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// Von der IDE verwaltete Komponenten
	TMonthCalendar *MonthCalendar1;
	TListBox *ListBox1;
	void __fastcall MonthCalendar1GetMonthInfo(TObject *Sender, DWORD Month,
          DWORD &amp;MonthBoldInfo);
private:	// Anwender-Deklarationen
public:		// Anwender-Deklarationen
	__fastcall TForm1(TComponent* Owner);
    TDate __fastcall Ostern(int Year);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Unit1.cpp</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
TDate __fastcall TForm1::Ostern(int Year)
{
	int a, b, c, d, e, f, g, h, i, k, l, m, n, p;

  	a = Year % 19;
  	b = Year / 100;
  	c = Year % 100;

  	d = b / 4;
  	e = b % 4;

  	f = (b + 8) / 25;

  	g = (b - f + 1) / 3;

  	h = (19 * a + b - d - g + 15) % 30;

  	i = c / 4;
  	k = c % 4;

  	l = (32 + 2 * e + 2 * i - h - k) % 7;

  	m = (a + 11 * h + 22 * l) / 451;

  	n = (h + l - 7 * m + 114) / 31;
  	p = (h + l - 7 * m + 114) % 31;

  	/*
    Jetzt enthält n die Monatsnummer
  	(also 3 = März bzw. 4 = April),
  	und (p + 1) gibt den Tag an,
  	auf den in diesem Monat
  	das Osterdatum fällt.
  	*/

  return EncodeDate(Year, n, p + 1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::MonthCalendar1GetMonthInfo(TObject *Sender,
      DWORD Month, DWORD &amp;MonthBoldInfo)
{
	TCommonCalendar *Calendar = dynamic_cast &lt;TCommonCalendar *&gt; (Sender); 
    unsigned short y,m,d;
	TDate my;
	MonthCalendar1-&gt;Date.DecodeDate(&amp;y,&amp;m,&amp;d);
	my=Ostern(y);
    my.DecodeDate(&amp;y,&amp;m,&amp;d);
	unsigned bdays[11] = {d};
	MonthBoldInfo = 0;
	Calendar-&gt;BoldDays(bdays, sizeof(bdays)/sizeof(bdays[0]), (unsigned)MonthBoldInfo);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1066033</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1066033</guid><dc:creator><![CDATA[gerd01]]></dc:creator><pubDate>Sat, 27 May 2006 11:53:56 GMT</pubDate></item><item><title><![CDATA[Reply to Monthcalendar problem mit bolddays - FAQ = nix gefunden on Mon, 29 May 2006 07:58:44 GMT]]></title><description><![CDATA[<p>gibt es vielleicht irgend eine möglichkeit den klick auf den jahresbereich abzufangen und nicht durch zu führen? sodass der klick vorher abgewickelt wird, und die komponente nicht das jahreszahlfenster öffnet?</p>
<p>oder gibt es eventuell die möglichkeit auf der canvas des tmonthcalendars zu zeichnen? das wäre noch besser! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>gruß gerd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067135</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067135</guid><dc:creator><![CDATA[gerd01]]></dc:creator><pubDate>Mon, 29 May 2006 07:58:44 GMT</pubDate></item></channel></rss>