Calendar

TsgcHTMLComponent_Calendar — 渲染带有彩色事件圆点、今日高亮和上一月/下一月导航的月历网格,适用于 Delphi、C++ Builder 和 .NET。

TsgcHTMLComponent_Calendar

设置 YearMonth,在特定日期添加事件(或绑定数据集),然后读取 HTML 属性。

组件类

TsgcHTMLComponent_Calendar

渲染为

带有月历网格 <table> 的 Bootstrap 5 卡片

语言

Delphi, C++ Builder, .NET

设置月份、添加事件、渲染它

设置 YearMonth,推入几个带有 DayTitleColorEvents.Add 条目,然后读取 HTML

uses
  sgcHTML_Component_Calendar;

var
  oCal: TsgcHTMLComponent_Calendar;
  oEvt: TsgcHTMLCalendarEvent;
begin
  oCal := TsgcHTMLComponent_Calendar.Create(nil);
  try
    oCal.Year := 2026;
    oCal.Month := 6;
    oCal.HighlightToday := True;
    oCal.ShowNavigation := True;

    oEvt := oCal.Events.Add;
    oEvt.Day := 12;
    oEvt.Title := 'Release';
    oEvt.Color := '#7C3AED';

    WebModule.Response := oCal.HTML;   // card + month-grid table
  finally
    oCal.Free;
  end;
end;

// Or bind it straight to a dataset:
oCal.LoadFromDataSet(qryEvents, 'EventDate', 'Subject');
// includes: sgcHTML_Component_Calendar.hpp

TsgcHTMLComponent_Calendar *oCal = new TsgcHTMLComponent_Calendar(NULL);
try
{
  oCal->Year = 2026;
  oCal->Month = 6;
  oCal->HighlightToday = true;
  oCal->ShowNavigation = true;

  TsgcHTMLCalendarEvent *oEvt = oCal->Events->Add();
  oEvt->Day = 12;
  oEvt->Title = "Release";
  oEvt->Color = "#7C3AED";

  String html = oCal->HTML;   // card + month-grid table
}
__finally
{
  delete oCal;
}
using esegece.sgcWebSockets;

var cal = new TsgcHTMLComponent_Calendar();
cal.Year = 2026;
cal.Month = 6;
cal.HighlightToday = true;
cal.ShowNavigation = true;

var evt = cal.Events.Add();
evt.Day = 12;
evt.Title = "Release";
evt.Color = "#7C3AED";

string html = cal.HTML;   // card + month-grid table

关键属性与方法

您最常使用的成员。

月份

YearMonth 选择网格;它们默认为当前月份,GetMonthName 驱动标题。

事件

Events 保存带有 DayTitle、十六进制 Color 和枚举 ColorStyle 的项目;每个事件都渲染为其日期下方的彩色圆点。

数据集绑定

LoadFromDataSet(aDataSet, aDateField, aTitleField) 为落在当前月份和年份内的每一行创建一个事件。

导航

ShowNavigation 配合 PrevURLNextURL 渲染上一月/下一月链接;NavButtonClass 为其设置样式。

今日

HighlightToday 使用 TodayClass 中的类标记当前日期。

外观

TableClassEventDotSizeCalendarID 调整表格样式和圆点大小。

继续探索

所有 sgcHTML 组件浏览 60 多个组件的完整功能矩阵。
下载免费试用版30 天试用版附带 60.HTML 演示项目。
价格Single、Team 和 Site 授权,均含完整源代码。

准备好开始了吗?

下载免费试用版,开始在 Delphi、C++ Builder 和 .NET 中构建 Web 界面。