C++ Builder XE4 > TMonthCalendar > 1日から4日をBold表示 > Boldかどうか分かりにくい


動作環境
C++ Builder XE4
Windows 7 Pro (32bit)

処理概要

  • TMonthCalendarに関して、1日から4日をBold表示する

RadStudioのヘルプを見たが、意味が分からなかった。

参考

実装

Unit1.h
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ComCtrls.hpp>
#include <Vcl.Grids.hpp>
#include <Vcl.Samples.Calendar.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE で管理されるコンポーネント
    TMonthCalendar *MonthCalendar1;
    void __fastcall MonthCalendar1GetMonthBoldInfo(TObject *Sender, DWORD Month, DWORD Year,
          DWORD &MonthBoldInfo);



private:    // ユーザー宣言
public:     // ユーザー宣言
    __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

Unit1.cpp
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::MonthCalendar1GetMonthBoldInfo(TObject *Sender, DWORD Month,
          DWORD Year, DWORD &MonthBoldInfo)
{
    unsigned int bolddays[] = {1, 2, 3, 4};
    unsigned int days;
    MonthCalendar1->BoldDays(bolddays, 4, days);
    MonthBoldInfo = days;
}
//---------------------------------------------------------------------------

実行例

11月

12月

  • Boldかどうか分かりにくい
  • 月を変えた時、その月で1日から4日がBold表示
  • 設定していない日もBoldになっているような