Calendar
TsgcHTMLComponent_Calendar — 渲染带有彩色事件圆点、今日高亮和上一月/下一月导航的月历网格,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_Calendar — 渲染带有彩色事件圆点、今日高亮和上一月/下一月导航的月历网格,适用于 Delphi、C++ Builder 和 .NET。
设置 Year 和 Month,在特定日期添加事件(或绑定数据集),然后读取 HTML 属性。
TsgcHTMLComponent_Calendar
带有月历网格 <table> 的 Bootstrap 5 卡片
Delphi, C++ Builder, .NET
设置 Year 和 Month,推入几个带有 Day、Title 和 Color 的 Events.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
您最常使用的成员。
Year 和 Month 选择网格;它们默认为当前月份,GetMonthName 驱动标题。
Events 保存带有 Day、Title、十六进制 Color 和枚举 ColorStyle 的项目;每个事件都渲染为其日期下方的彩色圆点。
LoadFromDataSet(aDataSet, aDateField, aTitleField) 为落在当前月份和年份内的每一行创建一个事件。
ShowNavigation 配合 PrevURL 和 NextURL 渲染上一月/下一月链接;NavButtonClass 为其设置样式。
HighlightToday 使用 TodayClass 中的类标记当前日期。
TableClass、EventDotSize 和 CalendarID 调整表格样式和圆点大小。