Avatar
TsgcHTMLComponent_Avatar — affichez un avatar utilisateur à partir d'une image ou d'initiales avec taille, forme et point d'état de présence, en Delphi, C++ Builder et .NET.
TsgcHTMLComponent_Avatar — affichez un avatar utilisateur à partir d'une image ou d'initiales avec taille, forme et point d'état de présence, en Delphi, C++ Builder et .NET.
Un avatar utilisateur qui affiche soit une image, soit des initiales. Définissez la taille, la forme et l'état de présence, puis lisez la propriété HTML.
TsgcHTMLComponent_Avatar
Du balisage Bootstrap 5
Delphi, C++ Builder, .NET
Affectez Initials (ou une ImageURL), choisissez une Size, une Shape et un Status, puis lisez HTML — ou utilisez l'assistant statique Build en une ligne.
uses
sgcHTML_Enums, sgcHTML_Component_Avatar;
var
oAv: TsgcHTMLComponent_Avatar;
begin
oAv := TsgcHTMLComponent_Avatar.Create(nil);
try
oAv.Initials := 'JS';
oAv.AltText := 'Jane Smith';
oAv.Size := asLarge;
oAv.Shape := apCircle;
oAv.ColorStyle := hcPrimary;
oAv.Status := atOnline;
WebModule.Response := oAv.HTML; // avatar markup
finally
oAv.Free;
end;
end;
// Or in a single line with the static helpers:
Result := TsgcHTMLComponent_Avatar.Build('JS', asLarge, '#0d6efd', atOnline);
Result := TsgcHTMLComponent_Avatar.BuildImage('/img/jane.jpg', asLarge, atOnline);
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Avatar.hpp
TsgcHTMLComponent_Avatar *oAv = new TsgcHTMLComponent_Avatar(NULL);
try
{
oAv->Initials = "JS";
oAv->AltText = "Jane Smith";
oAv->Size = asLarge;
oAv->Shape = apCircle;
oAv->ColorStyle = hcPrimary;
oAv->Status = atOnline;
String html = oAv->HTML; // avatar markup
}
__finally
{
delete oAv;
}
// Or in a single line with the static helpers:
String html = TsgcHTMLComponent_Avatar::Build("JS", asLarge, "#0d6efd", atOnline);
String img = TsgcHTMLComponent_Avatar::BuildImage("/img/jane.jpg", asLarge, atOnline);
using esegece.sgcWebSockets;
var avatar = new TsgcHTMLComponent_Avatar();
avatar.Initials = "JS";
avatar.AltText = "Jane Smith";
avatar.Size = TsgcHTMLAvatarSize.asLarge;
avatar.Shape = TsgcHTMLAvatarShape.apCircle;
avatar.ColorStyle = TsgcHTMLColor.hcPrimary;
avatar.Status = TsgcHTMLAvatarStatus.atOnline;
string html = avatar.HTML; // avatar markup
// Or in a single line with the static helpers:
string oneLine = TsgcHTMLComponent_Avatar.Build("JS", TsgcHTMLAvatarSize.asLarge,
"#0d6efd", TsgcHTMLAvatarStatus.atOnline);
string fromImage = TsgcHTMLComponent_Avatar.BuildImage("/img/jane.jpg",
TsgcHTMLAvatarSize.asLarge, TsgcHTMLAvatarStatus.atOnline);
Les membres que vous utilisez le plus souvent.
ImageURL affiche une photo ; lorsqu'elle est vide, Initials rend une tuile colorée et AltText définit le texte alternatif de l'image.
Size (TsgcHTMLAvatarSize : asSmall, asMedium, asLarge, asXLarge) dimensionne l'avatar.
Shape (TsgcHTMLAvatarShape : apCircle, apRounded, apSquare) stylise les coins.
Status (TsgcHTMLAvatarStatus : atOnline, atOffline, atBusy, atAway) dessine un point de présence ; StatusBorderWidth et StatusBorderColor l'entourent.
ColorStyle (TsgcHTMLColor) thématise la tuile d'initiales ; Color la remplace par une valeur hexadécimale brute.
Build(aInitials, aSize, aColor, aStatus) et BuildImage(aImageURL, aSize, aStatus) renvoient le HTML de l'avatar en un seul appel statique.
| Tous les composants sgcHTMLParcourez la matrice complète des fonctionnalités de plus de 60 composants. | Ouvrir | |
| Télécharger la version d'essai gratuiteLa version d'essai de 30 jours fournit les projets de démonstration 60.HTML. | Ouvrir | |
| TarifsLicences Single, Team et Site avec code source complet. | Ouvrir |