运行后将显示8种不同颜色的警报框,从上到下依次为:
蓝色 (primary)
灰色 (secondary)
绿色 (success)
红色 (danger)
黄色 (warning)
浅蓝 (info)
浅灰 (light)
深灰 (dark)
unit Unit1;interfaceusesClasses, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes,IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompLabel,Vcl.Controls, Vcl.Forms, IWVCLBaseContainer, IWContainer, IWHTMLContainer,IWHTML40Container, IWRegion, IWBS4CustomRegion, IWBS4Region;typeTIWForm1 = class(TIWAppForm)IWBS4Region1: TIWBS4Region;IWLabel1: TIWLabel;IWLabel2: TIWLabel;IWLabel3: TIWLabel;IWLabel4: TIWLabel;IWLabel5: TIWLabel;IWLabel6: TIWLabel;IWLabel7: TIWLabel;IWLabel8: TIWLabel; // 警报8procedure IWAppFormCreate(Sender: TObject);publicend;implementation{$R *.dfm}procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin// 1. 响应式布局设置PageContext.ExtraHeader.Add('<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">');// 2.在ServerController里添加全局CSS HTMLHeaders.Add('<link rel="stylesheet" href="/css/bootstrap.min.css">');// 3. 容器设置IWBS4Region1.Css := 'container mt-3';// 4. 设置所有警报IWLabel1.RawText := True;IWLabel1.Text :='<div class="alert alert-primary mt-2" role="alert">主要警报示例</div>';IWLabel2.RawText := True;IWLabel2.Text :='<div class="alert alert-secondary mt-2" role="alert">次要警报示例</div>';IWLabel3.RawText := True;IWLabel3.Text :='<div class="alert alert-success mt-2" role="alert">成功警报示例</div>';IWLabel4.RawText := True;IWLabel4.Text :='<div class="alert alert-danger mt-2" role="alert">危险警报示例</div>';IWLabel5.RawText := True;IWLabel5.Text :='<div class="alert alert-warning mt-2" role="alert">警告警报示例</div>';IWLabel6.RawText := True;IWLabel6.Text :='<div class="alert alert-info mt-2" role="alert">信息警报示例</div>';IWLabel7.RawText := True;IWLabel7.Text :='<div class="alert alert-light mt-2" role="alert">浅色警报示例</div>';IWLabel8.RawText := True;IWLabel8.Text :='<div class="alert alert-dark mt-2" role="alert">深色警报示例</div>';
end;initializationTIWForm1.SetAsMainForm;end.