Image

TsgcHTMLComponent_Image — Delphi, C++ Builder 및 .NET에서 모양, 반응형 크기 조정, 지연 로드 및 선택적 라이트박스와 캡션을 갖춘 Bootstrap 이미지를 렌더링합니다.

TsgcHTMLComponent_Image

Bootstrap 스타일링을 갖춘 그림 요소입니다. 소스와 대체 텍스트를 설정하고, 모양을 선택하고, 반응형 및 지연 로드를 토글한 다음, HTML 속성을 읽습니다.

컴포넌트 클래스

TsgcHTMLComponent_Image

렌더링

Bootstrap 5 이미지 마크업

언어

Delphi, C++ Builder, .NET

생성하고, 소스를 설정하고, 렌더링하기

SrcAlt를 할당하고, Shape를 선택하고, Responsive, LazyLoadLightbox를 토글한 다음, HTML을 읽습니다 — 또는 정적 한 줄 Build 헬퍼를 사용하십시오.

uses
  sgcHTML_Enums, sgcHTML_Component_Image;

var
  oImg: TsgcHTMLComponent_Image;
begin
  oImg := TsgcHTMLComponent_Image.Create(nil);
  try
    oImg.Src := '/img/team.jpg';
    oImg.Alt := 'Our team';
    oImg.Shape := isRounded;
    oImg.Responsive := True;
    oImg.Lightbox := True;
    oImg.Caption := 'The team at work';

    WebModule.Response := oImg.HTML;   // <img> markup
  finally
    oImg.Free;
  end;
end;

// Or in a single line with the static helper:
Result := TsgcHTMLComponent_Image.Build('/img/team.jpg', 'Our team',
  isRounded, True);
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Image.hpp

TsgcHTMLComponent_Image *oImg = new TsgcHTMLComponent_Image(NULL);
try
{
  oImg->Src = "/img/team.jpg";
  oImg->Alt = "Our team";
  oImg->Shape = isRounded;
  oImg->Responsive = true;
  oImg->Lightbox = true;
  oImg->Caption = "The team at work";

  String html = oImg->HTML;   // <img> markup
}
__finally
{
  delete oImg;
}

// Or in a single line with the static helper:
String html = TsgcHTMLComponent_Image::Build("/img/team.jpg", "Our team",
  isRounded, true);
using esegece.sgcWebSockets;

var img = new TsgcHTMLComponent_Image();
img.Src = "/img/team.jpg";
img.Alt = "Our team";
img.Shape = TsgcHTMLImageShape.isRounded;
img.Responsive = true;
img.Lightbox = true;
img.Caption = "The team at work";

string html = img.HTML;   // <img> markup

// Or in a single line with the static helper:
string oneLine = TsgcHTMLComponent_Image.Build("/img/team.jpg", "Our team",
    TsgcHTMLImageShape.isRounded, true);

주요 속성 및 메서드

가장 자주 사용하게 되는 멤버.

소스

Src는 이미지 URL을 설정하고 Alt는 접근 가능한 대체 텍스트를 설정합니다.

모양

Shape(TsgcHTMLImageShape: isRounded, isCircle, isThumbnail)는 모서리와 테두리 스타일을 지정합니다.

크기 조정

Responsiveimg-fluid를 적용하여 이미지가 컨테이너에 맞게 조정되게 합니다. WidthHeight는 명시적 치수를 설정합니다.

로딩

LazyLoadloading="lazy"를 추가하여 화면 밖 이미지가 필요할 때까지 로드를 미룹니다.

부가 기능

Lightbox는 이미지를 전체 크기 소스로 연결하는 링크로 감쌉니다. Caption은 캡션이 있는 figure로 감싸며, ImageID는 DOM id를 설정합니다.

한 줄 빌드

Build(aSrc, aAlt, aShape, aResponsive)는 단일 정적 호출로 이미지 HTML을 반환합니다.

계속 살펴보기

모든 sgcHTML 컴포넌트60개 이상의 컴포넌트 전체 기능 매트릭스를 둘러보십시오.
무료 체험판 다운로드30일 체험판에는 60.HTML 데모 프로젝트가 포함됩니다.
가격전체 소스 코드가 포함된 Single, Team 및 Site 라이선스.

시작할 준비가 되셨습니까?

무료 체험판을 다운로드하고 Delphi, C++ Builder 및 .NET에서 웹 UI를 구축하기 시작하십시오.