Avatar

TsgcHTMLComponent_Avatar — renderiza un avatar de usuario a partir de una imagen o iniciales con tamaño, forma y un punto de estado de presencia, en Delphi, C++ Builder y .NET.

TsgcHTMLComponent_Avatar

Un avatar de usuario que muestra una imagen o iniciales. Establece el tamaño, la forma y el estado de presencia, y luego lee la propiedad HTML.

Clase de componente

TsgcHTMLComponent_Avatar

Renderiza

Marcado de Bootstrap 5

Lenguajes

Delphi, C++ Builder, .NET

Créalo, establece la identidad, renderízalo

Asigna Initials (o una ImageURL), elige un Size, Shape y Status, y luego lee HTML — o usa el ayudante estático de una línea Build.

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);

Propiedades y métodos clave

Los miembros que más vas a usar.

Identidad

ImageURL muestra una foto; cuando está vacía, Initials renderiza un mosaico coloreado y AltText establece el texto alternativo de la imagen.

Tamaño

Size (TsgcHTMLAvatarSize: asSmall, asMedium, asLarge, asXLarge) escala el avatar.

Forma

Shape (TsgcHTMLAvatarShape: apCircle, apRounded, apSquare) da estilo a las esquinas.

Estado

Status (TsgcHTMLAvatarStatus: atOnline, atOffline, atBusy, atAway) dibuja un punto de presencia; StatusBorderWidth y StatusBorderColor lo rodean.

Color

ColorStyle (TsgcHTMLColor) tematiza el mosaico de iniciales; Color lo sobrescribe con un valor hexadecimal en bruto.

Construcción de una línea

Build(aInitials, aSize, aColor, aStatus) y BuildImage(aImageURL, aSize, aStatus) devuelven el HTML del avatar en una única llamada estática.

Sigue explorando

Todos los componentes sgcHTMLExplora la matriz completa de más de 60 componentes.
Descargar prueba gratuitaLa prueba de 30 días incluye los proyectos demo 60.HTML.
PreciosLicencias Single, Team y Site con código fuente completo.

¿Listo para empezar?

Descarga la prueba gratuita y empieza a crear interfaces web en Delphi, C++ Builder y .NET.